Curvature Center for the HP-41
Overview
1°) Y = F(X)
2°) X = X(t) & Y = Y(t)
3°) R = R(µ)
-These programs use approximate derivative formulae of order 6:
y' ~ (1/(60.h)) ( -y-3 + 9.y-2 - 45.y-1 + 45.y1 - 9.y2 + y3 )
y'' ~ (1/(90.h2)) [ y-3 - (27/2).y-2 + 135.y-1 - 245.y0 + 135.y1 - (27/2).y2 + y3 ]
-They compute the coordinates X & Y of the curvature center & the curvature Khi
1°) Y = F(X)
Formula:
Khi = y" / ( 1 + y'2 )3/2
X = x - y' ( 1 + y'2 ) / y"
Y = y + ( 1 + y'2 ) / y"
Data Registers: • R00 = f name ( Register R00 is to be initialized before executing "CCR" )
R01 = x
R04 = f '(x)
R02 = y
R05 = f ''(x)
R03
= h
Flags: /
Subroutine: A program that takes x in
X-register and returns f(x) in X-register
01 LBL "CCR" 02 STO 01 03 X<>Y 04 STO 03 05 4 06 * 07 STO 07 08 RCL 01 09 XEQ IND 00 10 STO 02 11 XEQ 01 12 STO 05 13 RCL 06 14 STO 04 15 XEQ 01 16 13.5 |
17 * 18 ST- 05 19 RCL 06 20 9 21 * 22 ST- 04 23 XEQ 01 24 135 25 * 26 ST+ 05 27 RCL 06 28 45 29 * 30 ST+ 04 31 GTO 02 32 LBL 01 |
33 RCL 03 34 ST- 07 35 RCL 01 36 RCL 07 37 + 38 XEQ IND 00 39 STO 06 40 RCL 01 41 RCL 07 42 - 43 XEQ IND 00 44 RCL 06 45 X<>Y 46 ST- 06 47 + 48 RCL 02 |
49 ST+ X 50 - 51 RTN 52 LBL 02 53 RCL 03 54 60 55 * 56 ST/ 04 57 1.5 58 * 59 RCL 03 60 * 61 ST/ 05 62 RCL 05 63 RCL 04 64 X^2 |
65 1 66 + 67 STO 06 68 ST/ Y 69 SQRT 70 / 71 RCL 02 72 RCL 06 73 RCL 05 74 / 75 ST+ Y 76 RCL 04 77 * 78 CHS 79 RCL 01 80 + 81 END |
( 119 bytes / SIZE 008 )
STACK | INPUTS | OUTPUTS |
Z | / | Khi(x) |
Y | h | Y |
X | x | X |
01
LBL "T" 02 E^X 03 LASTX 04 CHS 05 E^X 06 + 07 2 08 / 09 END |
"T" ASTO 00
-And if we choose h = 0.04
0.04 ENTER^
2 XEQ "CCR" >>>> X = -11.64495785 ---Execution time = 9s---
RDN Y = 7.524391171
RDN Khi = 0.070650829
Note:
-Exact results are -11.644958599... 7.524391382... 0.070650825...
2°) X = X(t) & Y = Y(t)
Khi = ( x' y" - x" y' ) / ( x'2 + y'2 )3/2
X = x - y' ( x'2 + y'2 ) / ( x' y" - x" y' )
Y = y + x' ( x'2 + y'2 ) / ( x' y" - x" y' )
Data Registers: • R00 = f name ( Register R00 is to be initialized before executing "CCR" )
R01 = t R04 = h
R05 = x'(t) R07 = y'(t)
R02 = x
R06 = x''(t)
R08 = y"(t)
R03
= y
Flags: /
Subroutine: A program that takes t in
X-register and returns x(t) in X-register & y(t) in Y-register
01 LBL "CCR" 02 STO 01 03 X<>Y 04 STO 04 05 4 06 * 07 STO 11 08 RCL 01 09 XEQ IND 00 10 STO 02 11 X<>Y 12 STO 03 13 XEQ 01 14 STO 08 15 X<>Y 16 STO 06 17 RCL 09 18 STO 05 19 RCL 10 20 STO 07 21 XEQ 01 22 13.5 23 ST* Z 24 * |
25 ST- 08 26 X<>Y 27 ST- 06 28 RCL 09 29 9 30 ST* 10 31 * 32 ST- 05 33 RCL 10 34 ST- 07 35 XEQ 01 36 135 37 ST* Z 38 * 39 ST+ 08 40 X<>Y 41 ST+ 06 42 RCL 09 43 45 44 ST* 10 45 * 46 ST+ 05 47 RCL 10 48 ST+ 07 |
49 GTO 02 50 LBL 01 51 RCL 04 52 ST- 11 53 RCL 01 54 RCL 11 55 + 56 XEQ IND 00 57 STO 09 58 X<>Y 59 STO 10 60 RCL 01 61 RCL 11 62 - 63 XEQ IND 00 64 RCL 09 65 X<>Y 66 ST- 09 67 + 68 RCL 02 69 ST+ X 70 - 71 RCL 10 72 RCL Z |
73 ST- 10 74 + 75 RCL 03 76 ST+ X 77 - 78 RTN 79 LBL 02 80 RCL 04 81 60 82 * 83 ST/ 05 84 ST/ 07 85 1.5 86 * 87 RCL 04 88 * 89 ST/ 06 90 ST/ 08 91 RCL 05 92 RCL 08 93 * 94 RCL 06 95 RCL 07 96 * |
97 - 98 STO 10 99 RCL 05 100 X^2 101 RCL 07 102 X^2 103 + 104 ST/ Y 105 ST/ 10 106 SQRT 107 / 108 RCL 02 109 RCL 07 110 RCL 10 111 / 112 - 113 RCL 05 114 RCL 10 115 / 116 RCL 03 117 + 118 X<>Y 119 END |
( 170 bytes / SIZE 012 )
STACK | INPUTS | OUTPUTS |
Z | / | Khi(t) |
Y | h | Y |
X | t | X |
Example: x = ( 3 - 4.t ) / ( 1 + 2.t2 ) y = t ( 3 - 4.t ) / ( 1 + 2.t2 ) t = 1
01
LBL "T" 02 ENTER 03 STO Z 04 4 05 * 06 CHS 07 3 08 + 09 X<>Y 10 X^2 11 ST+ X 12 1 13 + 14 / 15 ST* Y 16 END |
"T" ASTO 00
-And if we choose h = 0.04
0.04 ENTER^
2 XEQ "CCR" >>>> X = 0.775054442 ---Execution time = 11s---
RDN Y = -1.139433488
RDN Khi = 0.729650866
Notes:
x = ( 3 - 4.t ) / ( 1 + 2.t2 ) y = t ( 3 - 4.t ) / ( 1 + 2.t2 ) -> 2.y2 + 4.y + x2 - 3.x = 0
-Exact results are 0.775054466.... -1.139433551... 0.729650836....
3°) R = R(µ)
( polar coordinates )
Formula:
Khi = ( r2 + 2 r'2 - r.r" ) / ( r2 + r'2 )3/2
X = r Cos µ - ( r2 + r'2 ) ( r Cos µ + r' Sin µ ) / ( r2 + 2 r'2 - r.r" )
Y = r Sin µ - ( r2 + r'2 ) ( r Sin µ - r' Cos µ ) / ( r2 + 2 r'2 - r.r" )
Data Registers: • R00 = f name ( Register R00 is to be initialized before executing "CCR" )
R01 = µ R04 = r'(t)
R06 = Khi
R02 = r R05 = r''(t)
R03
= h
Flags: /
Subroutine: A program that takes µ
in X-register and returns r(µ) in X-register
01 LBL "CCR" 02 RAD 03 STO 01 04 X<>Y 05 STO 03 06 4 07 * 08 STO 07 09 RCL 01 10 XEQ IND 00 11 STO 02 12 XEQ 01 13 STO 05 14 RCL 06 15 STO 04 16 XEQ 01 17 13.5 18 * 19 ST- 05 20 RCL 06 21 9 22 * |
23 ST- 04 24 XEQ 01 25 135 26 * 27 ST+ 05 28 RCL 06 29 45 30 * 31 ST+ 04 32 GTO 02 33 LBL 01 34 RCL 03 35 ST- 07 36 RCL 01 37 RCL 07 38 + 39 XEQ IND 00 40 STO 06 41 RCL 01 42 RCL 07 43 - 44 XEQ IND 00 |
45 RCL 06 46 X<>Y 47 ST- 06 48 + 49 RCL 02 50 ST+ X 51 - 52 RTN 53 LBL 02 54 RCL 03 55 60 56 * 57 ST/ 04 58 1.5 59 * 60 RCL 03 61 * 62 ST/ 05 63 RCL 02 64 X^2 65 STO 07 66 RCL 04 |
67 X^2 68 ST+ 07 69 ST+ X 70 + 71 RCL 02 72 RCL 05 73 * 74 - 75 STO 08 76 RCL 07 77 ST/ Y 78 ST/ 08 79 SQRT 80 / 81 STO 06 82 RCL 01 83 COS 84 RCL 02 85 * 86 STO Y 87 RCL 04 88 RCL 01 89 SIN |
90 * 91 + 92 RCL 08 93 / 94 - 95 STO 09 96 RCL 01 97 SIN 98 RCL 02 99 * 100 STO Y 101 RCL 04 102 RCL 01 103 COS 104 * 105 - 106 RCL 08 107 / 108 - 109 RCL 06 110 X<>Y 111 RCL 09 112 END |
( 154 bytes / SIZE 010 )
STACK | INPUTS | OUTPUTS |
Z | / | Khi(t) |
Y | h | Y |
X | µ (rd) | X |
Example: r = 2 / ( 1 - Cos µ ) µ = Arc Tan ( sqrt(8) ) = 1.230959417 rd
01
LBL "T" 02 COS 03 1 04 X<>Y 05 - 06 2 07 X<>Y 08 / 09 END |
"T" ASTO 00
-And if we choose h = 0.04
0.04 ENTER^
1.230959417 XEQ "CCR" >>>> X = 6.999997151 ---Execution time = 12s---
RDN Y = -5.656848738
RDN Khi = 0.096225102
Notes:
r = 2 / ( 1 - Cos µ ) -> y = sqrt(x+1)
-Exact results are 7 -5.656854249... 0.096225045....