hp41programs

CURVELENGTH

Arc Length of a Parametric Curve for the HP-41


Overview
 

 1°) 3-Dimensional Problem

   a) With Newton-Cotes Integration
   b) Discrete Data
   c) With Romberg's Method

 2°) N-Dimensional Problem

   a) With Newton-Cotes Integration
   b) With Romberg's Method  ( N < 10 )
 

Latest Update:

-The program in paragraph 1-a) has been improved to take into account the cylindrical & spherical coordinates.
-In paragraph 1-b) "CRVL" may be used if we only know a finite number of data points, equally spaced.
 
 

1°)  3-Dimensional Problem
 

     a) With Newton-Cotes Integration
 

 "CRVL" evaluates the integral  §ab  [ ( dx/dt )2 + ( dy/dt )2 + ( dz/dt )2 ] 1/2  dt      with cartesian coordinates    ( CF 02-CF03 )
                    or  §ab  [ ( dr/dt )2 + r2 ( dL/dt )2 + ( dz/dt )2 ] 1/2  dt                         with cylindrical coordinates  ( SF 02-CF 03 )
                    or  §ab  [ ( dr/dt )2 + r2 ( Cos b )2 ( dL/dt )2 + r2 ( db/dt )2 ] 1/2  dt     with spherical coordinates    ( CF 02-SF 03 )
 

-The derivatives are estimated by the following formula of order 10

       df/dx ~ (1/2520.h).[ 2100.( f1 - f-1 ) - 600.( f2 - f-2 ) + 150.( f3 - f-3 ) - 25.( f4 - f-4 ) + 2.( f5 - f-5 ) ]

    (  f(x+k.h) is denoted fk to simplify these expressions )

-And the integral is approximated by Newton-Cotes 7-point formula:

   §x1x7  f(x).dx  ~  h [ 41f(x1)+216f(x2)+27f(x3)+272f(x4)+27f(x5)+216f(x6)+41f(x7) ] / 140    with   xi+1 - xi = h = Cste

-The intervall [a,b] may be divided into n parts to get more and more accurate results.
 
 

Data Registers:          •  R00 = function name                                      ( Registers R00 thru R03 are to be initialized before executing "CRVL" )

                                     •  R01 = a      R04 = L             R06 to R19: temp
                                     •  R02 = b      R05 = h   ( to estimate the derivatives )
                                     •  R03 = n

Flags:  F02-F03             CF 02  CF 03  ->   Cartesian coordinates
                                       SF 02   CF 03  ->   Cylindrical coordinates
                                       CF 02   SF 03  ->   Spherical coordinates

Subroutine:  1 program that takes t in X-register and returns  x(t) , y(t) , z(t)  in registers  X , Y , Z respectively
                                                                                      or      r(t) , L(t) , z(t)  ---------------------------------
                                                                                      or      r(t) , L(t) , b(t)  ---------------------------------
 

-Line 28 is a three-byte GTO 01
 
 

 01 LBL "CRVL"
 02 STO 05        
 03 RCL 02
 04 RCL 01
 05 -
 06 RCL 03
 07 6
 08 *
 09 STO 09
 10 /
 11 STO 06
 12 2
 13 STO 10
 14 STO 19
 15 CLX
 16 STO 04
 17 600
 18 CHS
 19 STO 16
 20 150
 21 STO 17
 22 14
 23 *
 24 STO 15
 25 25
 26 CHS
 27 STO 18
 28 GTO 01
 29 LBL 00
 30 RCL 06
 31 RCL 09
 32 *
 33 RCL 01
 34 +
 35 STO 11        
 36 XEQ 02
 37 CLX
 38 SIGN
 39 FC? 02
 40 FS? 03
 41 X=0?
 42 GTO 00
 43 D-R
 44 FC? 43
 45 ST* 13
 46 SIGN
 47 FS? 03
 48 D-R
 49 FC? 43
 50 ST* 14
 51 RCL 11
 52 XEQ IND 00
 53 ST* 13
 54 FS? 03
 55 ST* 14
 56 X<> Z
 57 COS
 58 FS? 03
 59 ST* 13
 60 LBL 00
 61 RCL 12
 62 X^2
 63 RCL 13
 64 X^2
 65 RCL 14
 66 X^2
 67 +
 68 +
 69 SQRT
 70 RTN
 71 LBL 02
 72 5
 73 STO 07        
 74 19
 75 STO 08
 76 CLX
 77 STO 12
 78 STO 13
 79 STO 14
 80 LBL 03
 81 RCL 11
 82 RCL 05
 83 RCL 07
 84 *
 85 +
 86 XEQ IND 00
 87 RCL IND 08
 88 ST* T
 89 ST* Z
 90 *
 91 ST+ 12
 92 RDN
 93 ST+ 13
 94 X<>Y
 95 ST+ 14
 96 RCL 11
 97 RCL 05
 98 RCL 07
 99 *
100 -
101 XEQ IND 00
102 RCL IND 08
103 ST* T
104 ST* Z
105 *
106 ST- 12
107 RDN
108 ST- 13
109 X<>Y
110 ST- 14
111 DSE 08
112 DSE 07
113 GTO 03
114 RTN
115 LBL 01
116 XEQ 00
117 82
118 RCL 10        
119 /
120 *
121 ST+ 04
122 CLX
123 SIGN
124 ST- 09
125 STO 10
126 XEQ 00
127 216
128 *
129 ST+ 04
130 DSE 09
131 XEQ 00
132 27
133 *
134 ST+ 04
135 DSE 09
136 XEQ 00
137 272
138 *
139 ST+ 04
140 DSE 09
141 XEQ 00
142 27
143 *
144 ST+ 04
145 DSE 09
146 XEQ 00
147 216
148 *
149 ST+ 04
150 DSE 09
151 GTO 01        
152 XEQ 00
153 41
154 *
155 RCL 04
156 +
157 RCL 06
158 *
159 RCL 05
160 /
161 352800
162 /
163 STO 04
164 END

 
        ( 262 bytes / SIZE 020 )
 
 

      STACK        INPUT      OUTPUT
           X             h            L

 
Example1:    x(t) = t2 ,  y(t) = exp(t)  ,  z(t) = Ln t   ;  a = 1 ,  b = 2
 
 

 01  LBL "T"
 02  X^2
 03  LASTX
 04  E^X
 05  LASTX
 06  LN
 07  RTN

 
 "T"  ASTO 00   1  STO 01  2  STO 02    CF 02  CF 03

-If you choose  n = 1  &  h = 0.1   1  STO 03

    0.1   XEQ "CRVL"  >>>>   L = 5.609133827                        ---Execution time = 95s---

-With  n = 2 - and the same h-value -  it yields   L = 5.609132375

-The exact result is  L = 5.609132359...
 

Example2:    r(t) = exp(t) ,  L(t) = t  ,  b(t) = t2   ;  a = 0 ,  b = 1     ( all angles in radians )
 
 

 01  LBL "T"
 02  X^2
 03  LASTX
 04  ENTER^
 05  E^X
 06  RTN

 
   XEQ "RAD"  SF 02  CF 03

   0  STO 01  1  STO 02

-With n = 1  &  h = 0.1   1  STO 03

    0.1   XEQ "CRVL"  >>>>   L = 2.645584611                        ---Execution time = 84s---

-With n = 2 & h = 0.1   we get  L = 2.645588402

-The exact value is  2.645588439...

Example3:    r(t) = exp(t) ,  L(t) = t2  ,  b(t) = t3   ;  a = 0 ,  b = 1     ( all angles in radians )
 
 
 

 01  LBL "T"
 02  ENTER^
 03  X^2
 04  ST* Y
 05  LASTX
 06  E^X
 07  RTN

 
   XEQ "RAD"  CF 02  SF 03

   0  STO 01  1  STO 02

-With n = 1  &  h = 0.1   1  STO 03

    0.1   XEQ "CRVL"  >>>>   L = 3.449957472                        ---Execution time = 90s---

-With n = 2 & h = 0.1   we get  L = 3.449386896

-The exact result is  3.449386684...

Notes:

-"CRVL" works in RAD mode & in DEG mode but not in GRAD mode

-The spherical coordinates that are used here are the radius "vector" r , the longitude L and the latitude b
-If you prefer the co-latitude, replace line 57 COS  by  SIN
 

     b) Discrete Data
 

-The following variant calculates the same integrals with the Simpson's rule and the derivatives with approximate formulas of order 4.

-The coordinates of the N points are to be stored in Rbb thru Ree  ( bb > 15 )
 

Warning:  the number of points N must be odd and at least 5
 
 

Data Registers:            R00: temp                               ( Registers Rbb thru Ree are to be initialized before executing "CRVL" )

                                      R02 to R15: temp

                                     •  Rbb   = x1         r1          r1  ..................................  •  Re-2  = xn        rn          rn
                                     •  Rb+1 = y1   or  L1   or   L1  ..................................  •  Re-1 = yn   or  Ln   or   Ln       bbb > 015
                                     •  Rb+2 = z1        z1          b1   .................................   •  Ree   = zn        zn          bn

Flags:  F02-F03             CF 02  CF 03  ->   Cartesian coordinates
                                       SF 02   CF 03  ->   Cylindrical coordinates
                                       CF 02   SF 03  ->   Spherical coordinates

Subroutines:  /
 
 

 01 LBL "CRVL"
 02 STO 02        
 03 STO 03
 04 INT
 05 DSE X
 06 CHS
 07 LASTX
 08 FRC
 09  E3
 10 *
 11 STO 01
 12 STO 10
 13 +
 14 3
 15 STO 15
 16 /
 17 4
 18 STO 13
 19 -
 20 STO 00
 21 9
 22 STO 14
 23 CLX
 24 STO 04
 25 STO 05
 26 STO 06
 27 STO 07
 28 STO 08
 29 STO 09
 30 SIGN
 31 STO 11
 32 STO 12
 33 FC? 02
 34 FS? 03
 35 D-R
 36 FC? 43
 37 STO 11        
 38 SIGN
 39 FS? 03
 40 D-R
 41 FC? 43
 42 STO 12
 43 25
 44 XEQ 02
 45 48
 46 CHS
 47 XEQ 02
 48 36
 49 XEQ 02
 50 16
 51 CHS
 52 XEQ 02
 53 XEQ 02
 54 13
 55 XEQ 03
 56 X<> 01
 57 STO 10
 58 RCL 02
 59 STO 03
 60 CLX
 61 STO 04
 62 STO 05
 63 STO 06
 64 STO 07
 65 STO 08
 66 STO 09
 67 3
 68 XEQ 02
 69 10
 70 XEQ 02
 71 18
 72 CHS
 73 XEQ 02
 74 6
 75 XEQ 02
 76 SIGN
 77 CHS
 78 XEQ 02
 79 10
 80 XEQ 03
 81 2
 82 STO 09
 83 X^2
 84 STO 08        
 85 *
 86 ST+ 01
 87 GTO 01
 88 LBL 02
 89 SIGN
 90 LBL 04
 91 RCL IND 03
 92 LASTX
 93 *
 94 ST- IND 13
 95 RCL IND 10
 96 LASTX
 97 *
 98 ST+ IND 14
 99 1
100 ST+ 03
101 ST- 10
102 ST+ 13
103 ST- 14
104 DSE 15
105 GTO 04
106 3
107 ST- 13
108 ST+ 14
109 STO 15        
110 RTN
111 LBL 03
112 ENTER
113 X<> 10
114 +
115 2
116 X<>Y
117 ST+ Y
118 RCL IND Y
119 COS
120 RCL IND Y
121 FS? 02
122 ST* 08
123 FS? 03
124 ST* 09
125 *
126 FS? 03
127 ST* 08
128 2
129 RCL 03
130 RCL 10
131 2
132 +
133 -
134 ST+ Y
135 RCL IND Y
136 COS
137 RCL IND Y
138 FS? 02
139 ST* 05
140 FS? 03
141 ST* 06
142 *
143 FS? 03
144 ST* 05
145 RCL 04        
146 X^2
147 RCL 05
148 RCL 11
149 *
150 X^2
151 RCL 06
152 RCL 12
153 *
154 X^2
155 +
156 +
157 SQRT
158 RCL 07
159 X^2
160 RCL 08
161 RCL 11
162 *
163 X^2
164 +
165 RCL 09
166 RCL 12
167 *
168 X^2
169 +
170 SQRT
171 +
172 RTN
173 LBL 05
174 SIGN
175 LBL 06
176 RCL IND 02
177 LASTX
178 *
179 ST+ IND 13
180 1
181 ST+ 02
182 ST+ 13
183 DSE 15
184 GTO 06
185 3
186 ST- 13
187 STO 15        
188 RTN
189 LBL 01
190 CLX
191 STO 04
192 STO 05
193 STO 06
194 SIGN
195 XEQ 05
196 8
197 CHS
198 XEQ 05
199 ST+ 02
200 8
201 XEQ 05
202 SIGN
203 CHS
204 XEQ 05
205 2
206 RCL 02
207 9
208 -
209 ST+ Y
210 RCL IND Y
211 COS
212 RCL IND Y
213 FS? 02
214 ST* 05
215 FS? 03
216 ST* 06
217 *
218 FS? 03
219 ST* 05
220 RCL 04        
221 X^2
222 RCL 05
223 RCL 11
224 *
225 X^2
226 RCL 06
227 RCL 12
228 *
229 X^2
230 +
231 +
232 SQRT
233 RCL 08
234 X<> 09
235 STO 08
236 *
237 ST+ 01
238 12
239 ST- 02
240 DSE 00
241 GTO 01
242 36
243 ST/ 01
244 RCL 01
245 END

 
        ( 361 bytes / SIZE var )
 
 

      STACK        INPUT      OUTPUT
           X        bbb.eee            L

   With  bbb > 015

Example1:    x(t) = t2 ,  y(t) = exp(t)  ,  z(t) = Ln t   ;  a = 1 ,  b = 2   but you only have the coordinates of 9 points corresponding to t = 1 , 9/8 , ... , 15/8 , 2

( you can store these coordinates with the following routine, for example in R21 to R47 )
 
 

 LBL 10
 9
 STO 00
 47
 STO 01
 LBL 01
 RCL 00
 1
 -
 8
 /
 1
 +
 LN
 STO IND 01
 DSE 01
 LASTX
 E^X
 STO IND 01
 E^X
 DSE 01
 LASTX
 X^2
 STO IND 01
 DSE 01
 DSE 00
 GTO 01

 
  CF 02  CF 03   21.047   XEQ "CRVL"  >>>>   L = 5.609125853                        ---Execution time = 66s---

-The exact result is  L = 5.609132359...
 

Example2:    r(t) = exp(t) ,  L(t) = t  ,  b(t) = t2   ;  a = 0 ,  b = 1     ( all angles in radians )

   but you only have the coordinates of 9 points corresponding to t = 0 , 1/8 , ... , 7/8 , 1

( you can store these coordinates with the following routine, for example in R21 to R47 )
 
 

 LBL 10
 9
 STO 00
 47
 STO 01
 LBL 01
 RCL 00
 1
 -
 8
 /
 X^2
 STO IND 01
 DSE 01
 LASTX
 STO IND 01
 DSE 01
 E^X
 STO IND 01
 DSE 01
 DSE 00
 GTO 01

 
   XEQ "RAD"  SF 02  CF 03

   21.047   XEQ "CRVL"  >>>>   L = 2.645598006                        ---Execution time = 66s---

-The exact value is  2.645588439...

Example3:    r(t) = exp(t) ,  L(t) = t2  ,  b(t) = t3   ;  a = 0 ,  b = 1     ( all angles in radians )

  but you only have the coordinates of 9 points corresponding to t = 0 , 1/8 , ... , 7/8 , 1

( you can store these coordinates with the following routine, for example in R21 to R47 )
 
 
 

 LBL 10
 9
 STO 00
 47
 STO 01
 LBL 01
 RCL 00
 1
 -
 8
 /
 X^2
 LASTX
 *
 STO IND 01
 DSE 01
 LASTX
 X^2
 STO IND 01
 DSE 01
 LASTX
 E^X
 STO IND 01
 DSE 01
 DSE 00
 GTO 01

 
   XEQ "RAD"  CF 02  SF 03

   21.047   XEQ "CRVL"  >>>>   L = 3.449756039                        ---Execution time = 67s---

-The exact result is  3.449386684...

Notes:

-"CRVL" works in RAD mode & in DEG mode but not in GRAD mode
-This routine does not check if the control number is correct !

-The spherical coordinates that are used here are the radius "vector" r , the longitude L and the latitude b
-If you prefer the co-latitude, replace lines 119-136-211   by  SIN
 

     c) With Romberg Method
 

-This variant uses Pythagoreas theorem and Romberg method to evaluate the integral
 
 

Data Registers:          •  R00 = function name                                      ( Register R00 is to be initialized before executing "CRVL" )

                                        R01 = a      R03 = L     R04 to R16......: temp
                                        R02 = b
Flags: /
Subroutine:  1 program  that takes t in X-register and R07 and returns  X(t) , Y(t) , Z(t) in registers X , Y , Z  respectively
 

-Line 96 is a three-byte GTO 01
 
 

 01 LBL "CRVL"
 02 STO 02
 03 X<>Y
 04 STO 01        
 05 1
 06 STO 04
 07 LBL 01
 08 RCL 02
 09 RCL 01
 10 -
 11 RCL 04
 12 STO 05
 13 /
 14 STO 11
 15 CLX
 16 STO 06
 17 RCL 02
 18 STO 07 
 19 XEQ IND 00
 20 STO 08
 21 RDN
 22 STO 09
 23 X<>Y
 24 STO 10
 25 LBL 02
 26 RCL 05
 27 RCL 11
 28 ST* Y
 29 -
 30 RCL 01
 31 +
 32 STO 07        
 33 XEQ IND 00
 34 ENTER
 35 X<> 08
 36 -
 37 X^2
 38 X<>Y
 39 ENTER
 40 X<> 09
 41 -
 42 X^2
 43 +
 44 X<>Y
 45 ENTER
 46 X<> 10
 47 -
 48 X^2
 49 +
 50 SQRT
 51 ST+ 06
 52 DSE 05
 53 GTO 02
 54 RCL 06        
 55 SIGN
 56 ST* X
 57 RCL 04
 58 ST+ 04
 59 X#Y?
 60 GTO 00
 61 STO 14
 62 LASTX
 63 STO 16
 64 GTO 01
 65 LBL 00
 66 4
 67 STO 12
 68 16
 69 STO 13
 70 RCL 14
 71 STO 15        
 72 LASTX
 73 ISG 14
 74 LBL 03
 75 ENTER
 76 ENTER
 77 X<> IND 13
 78 -
 79 RCL 12
 80 4
 81 ST* 12
 82 SIGN
 83 ST+ 13
 84 -
 85 /
 86 +
 87 DSE 15
 88 GTO 03
 89 STO 03        
 90 STO IND 13
 91 VIEW X
 92 RND
 93 X<>Y
 94 RND
 95 X#Y?
 96 GTO 01
 97 RCL 03
 98 END

 
        ( 132 bytes / SIZE 016+??? )
 
 

      STACK        INPUTS      OUTPUTS
           Y             a             /
           X             b         L(a,b)

 
Example:    X(t) = t4 ,  Y(t) = t2  ,  Z(t) = exp t   ;  a = 0 ,  b = 1
 
 

 01  LBL "T"
 02  E^X
 03  LASTX
 04  X^2
 05  ENTER^
 06  X^2
 07  RTN

 
-If you try 9 decimals

     T  ASTO 00
     FIX 9

     0     ENTER^
     1     XEQ "CRVL"  >>>>   L = 2.342116456                        ---Execution time = 97s---
 

Notes:

-The HP41 displays the successive approximations.
-The result depends on the display format ( lines 92-94 )
-The exact result is  L = 2.342116459....
 

2°)  N-Dimensional Problem
 

     a) With Newton-Cotes Integration
 

 "CRVLN" evaluates the integral  §ab  [ ( dX1/dt )2 + ( dX2/dt )2 + ............ + ( dXN/dt )2 ] 1/2  dt
 

-The derivatives and the integral are estimated by the same formulas of order 10.

-The inervall [a,b] may be divided in m parts to get more and more accurate results.
 

Data Registers:             R00:  temp

                                        R01 = a      R04 = h      R06 to R15: temp
                                        R02 = b      R05 = L
                                        R03 = m
Flags: /
Subroutine:  N programs named  "X1"  "X2" ............. "XN"   that take t in X-register and return  X1(t) , X2(t) , .......... , XN(t) respectively  in X-register
 
 
 

 01 LBL "CRVLN"
 02 "DIM=?"
 03 PROMPT
 04 STO 14 
 05 "H^M^A^B"
 06 PROMPT
 07 STO 02 
 08 X<>Y
 09 STO 01         
 10 -
 11 X<>Y
 12 STO 03
 13 6
 14 *
 15 STO 07
 16 /
 17 STO 06
 18 X<>Y
 19 STO 04
 20 6
 21 *
 22 STO 09
 23 FIX 0
 24 CF 29
 25 XEQ 00
 26 41
 27 *
 28 STO 05 
 29 DSE 07
 30 GTO 01
 31 LBL 00
 32 RCL 06 
 33 RCL 07         
 34 *
 35 RCL 01
 36 +
 37 STO 11
 38 CLX
 39 STO 13
 40 RCL 14
 41 STO 15
 42 LBL 04
 43 "X"
 44 ARCL 15
 45 XEQ 02
 46 X^2
 47 ST+ 13
 48 DSE 15
 49 GTO 04
 50 RCL 13
 51 SQRT
 52 RTN
 53 LBL 02
 54 ASTO 00
 55 RCL 09 
 56 STO 10         
 57 XEQ 03
 58 ST+ X
 59 STO 08
 60 XEQ 03
 61 25
 62 *
 63 ST- 08
 64 XEQ 03
 65 150
 66 *
 67 ST+ 08
 68 XEQ 03
 69 600
 70 *
 71 ST- 08
 72 XEQ 03
 73 2100
 74 *
 75 RCL 08
 76 +
 77 RCL 04
 78 2520
 79 *
 80 /
 81 RTN
 82 LBL 03
 83 RCL 04         
 84 ST- 10
 85 RCL 11
 86 RCL 10 
 87 -
 88 XEQ IND 00
 89 STO 12
 90 RCL 11
 91 RCL 10
 92 +
 93 XEQ IND 00
 94 RCL 12
 95 -
 96 RTN
 97 LBL 01
 98 XEQ 00
 99 216
100 *
101 ST+ 05
102 DSE 07 
103 XEQ 00
104 27
105 *
106 ST+ 05        
107 DSE 07
108 XEQ 00
109 272
110 *
111 ST+ 05
112 DSE 07 
113 XEQ 00
114 27
115 *
116 ST+ 05
117 DSE 07
118 XEQ 00
119 216
120 *
121 ST+ 05
122 DSE 07
123 CLX
124 XEQ 00
125 STO M
126 82
127 *
128 ST+ 05
129 DSE 07 
130 GTO 01
131 CLX
132 X<> M        
133 41
134 *
135 ST- 05
136 RCL 05 
137 RCL 06
138 *
139 140
140 /
141 STO 05
142 FIX 9
143 SF 29
144 END

 
     ( 251 bytes / SIZE 016 )
 
 

      STACK        INPUT      OUTPUT
           X             /         L(a,b)

 
Example:    X1(t) = t4 ,  X2(t) = t2  ,  X3(t) = t3  ,  X4(t) = exp t   ;  a = 0 ,  b = 1
 
 
 

 01  LBL "X1"
 02  X^2
 03  X^2
 04  RTN
 05  LBL "X2"
 06  X^2
 07  RTN
 08  LBL "X3"
 09  ENTER^
 10  X^2
 11  *
 12  RTN
 13  LBL "X4"
 14  E^X
 15  RTN

 
-With  h = 0.1  and  m = 1

    XEQ "CRVLN"  >>>>  "DIM=?"

               4               R/S    "H^M^A^B"

             0.1   ENTER^
               1    ENTER^
               0    ENTER^
               1        R/S          >>>>      L = 2.579075091                        ---Execution time = 180s---

-With  m = 2 - and the same h-value -  it yields   L = 2.579079247

-The exact result is  L = 2.579079231....
 

     b) With Romberg Method  ( n < 10 )
 

-Like the 2nd version of "CRVL", this variant of "CRVLN" uses an extrapolation to the limit.
 
 

Data Registers:             R00 = n

                                        R01 = a      R03 = L     R04 to R26......: temp
                                        R02 = b
Flags: /
Subroutine:  N programs named  "X1"  "X2" ....... "XN"   that take t in X-register & R07 and return  X1(t) , X2(t) , ....... , XN(t) respectively  in X-register

-Line 115 is a three-byte GTO 01
 
 

 01 LBL "CRVLN"
 02 STO 02
 03 RDN
 04 STO 01
 05 X<>Y
 06 STO 00 
 07 1
 08 STO 04          
 09 RCLFLAG
 10 STO 20
 11 LBL 01
 12 FIX 00
 13 CF 29
 14 RCL 00
 15 STO 18
 16 17
 17 STO 19
 18 LBL 02
 19 "X"
 20 ARCL 18
 21 ASTO L
 22 RCL 02
 23 STO 07
 24 XEQ IND L
 25 STO IND 19
 26 DSE 19
 27 DSE 18
 28 GTO 02
 29 CLX
 30 STO 06
 31 RCL 02          
 32 RCL 01
 33 -
 34 RCL 04
 35 STO 05
 36 /
 37 STO 08
 38 LBL 03
 39 RCL 05
 40 RCL 08
 41 ST* Y
 42 -
 43 RCL 01
 44 +
 45 STO 07
 46 RCL 00
 47 STO 18
 48 17
 49 STO 19
 50 CLX
 51 STO 21
 52 LBL 04
 53 "X"
 54 ARCL 18
 55 ASTO L
 56 RCL 07
 57 XEQ IND L
 58 ENTER
 59 X<> IND 19
 60 -
 61 X^2
 62 ST+ 21
 63 DSE 19
 64 DSE 18
 65 GTO 04
 66 RCL 21          
 67 SQRT
 68 ST+ 06
 69 DSE 05
 70 GTO 03
 71 RCL 20
 72 STOFLAG
 73 RCL 06
 74 SIGN
 75 ST* X
 76 RCL 04
 77 ST+ 04
 78 X#Y?
 79 GTO 00
 80 STO 24
 81 LASTX
 82 STO 26
 83 GTO 01
 84 LBL 00
 85 4
 86 STO 22
 87 26
 88 STO 23 
 89 RCL 24
 90 STO 25          
 91 LASTX
 92 ISG 24
 93 LBL 05
 94 ENTER
 95 ENTER
 96 X<> IND 23
 97 -
 98 RCL 22 
 99 4
100 ST* 22
101 SIGN
102 ST+ 23
103 -
104 /
105 +
106 DSE 25
107 GTO 05
108 STO 03          
109 STO IND 23
110 VIEW X
111 RND
112 X<>Y
113 RND
114 X#Y?
115 GTO 01
116 RCL 03
117 END

 
        ( 184 bytes / SIZE 026+??? )
 
 

      STACK        INPUTS      OUTPUTS
           Z          n < 10             /
           Y             a             /
           X             b         L(a,b)

 
Example:    X1(t) = t4 ,  X2(t) = t2  ,  X3(t) = t3  ,  X4(t) = exp t   ;  a = 0 ,  b = 1
 
 
 

 01  LBL "X1"
 02  X^2
 03  X^2
 04  RTN
 05  LBL "X2"
 06  X^2
 07  RTN
 08  LBL "X3"
 09  ENTER^
 10  X^2
 11  *
 12  RTN
 13  LBL "X4"
 14  E^X
 15  RTN

 
-If you try to find 9 decimals

    FIX 9

    4   ENTER^
    0   ENTER^
    1   XEQ "CRVLN"  >>>>      L = 2.579079231                                ---Execution time = 4m16s---

Notes:

-The HP41 displays the successive approximations.
-The result depends on the display format ( lines 111-113 )
-The exact result is  L = 2.579079231....

-So, there is no roundoff error in this example ( this is not always the case... ).