Tangent & Normal for the HP-41
1°) Tangent Line & Normal Plane of a Curve
a) X = X(t) Y = Y(t) Z = Z(t)
b) F(X,Y,Z) = 0 & G(X,Y,Z) = 0
2°) Tangent Plane & Normal Line of a Surface: F(X,Y,Z) = 0
-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 ]
1°) Tangent Line & Normal Plane of a Curve
a) X = X(t) Y = Y(t)
Z = Z(t)
Formulae:
-At a point P(x0,y0,z0) ( with t = t0 ), the equations of the tangent line are:
( x - x0 ) / ( dx/dt ) = ( y - y0 ) / ( dy/dt ) = ( z - z0 ) / ( dz/dt )
and the equation of the normal plane is:
( x - x0 ) ( dx/dt ) + ( y - y0 ) ( dy/dt ) + ( z - z0 ) ( dz/dt ) = 0
Data Registers: • R00 = f name ( Register R00 is to be initialized before executing "TLNP" )
R01 = t0 R03 = x0 R04 = y0 R05 = z0R02 = h R06 = dx/dt R07 = dy/dt R08 = dz/dt
Flags: /
Subroutine: A program that takes
t in X-register and returns x(t) in X-register , y(t) in Y-register
& z(t) in Z-register
01 LBL "TLNP" 02 STO 01 03 X<>Y 04 STO 02 05 4 06 * 07 STO 09 08 X<>Y 09 XEQ IND 00 10 STO 03 11 RDN 12 STO 04 13 X<>Y 14 STO 05 |
15 CLX 16 STO 06 17 STO 07 18 STO 08 19 SIGN 20 XEQ 01 21 9 22 CHS 23 XEQ 01 24 45 25 XEQ 01 26 GTO 02 27 LBL 01 28 STO 10 |
29 RCL 02 30 ST- 09 31 RCL 01 32 RCL 09 33 + 34 XEQ IND 00 35 RCL 10 36 ST* T 37 ST* Z 38 * 39 ST+ 06 40 RDN 41 ST+ 07 42 X<>Y |
43 ST+ 08 44 RCL 01 45 RCL 09 46 - 47 XEQ IND 00 48 RCL 10 49 ST* T 50 ST* Z 51 * 52 ST- 06 53 RDN 54 ST- 07 55 X<>Y |
56 ST- 08 57 RTN 58 LBL 02 59 RCL 02 60 60 61 * 62 ST/ 06 63 ST/ 07 64 ST/ 08 65 RCL 08 66 RCL 07 67 RCL 06 68 END |
( 103 bytes / SIZE 011 )
STACK | INPUTS | OUTPUTS |
Z | / | z'(t) |
Y | h | y'(t) |
X | x | x'(t) |
01
LBL "T" 02 ENTER 03 ENTER 04 ST+ Z 05 X^2 06 ST* Z 07 3 08 * 09 1 10 + 11 X<>Y 12 2 13 - 14 END |
"T" ASTO 00
-And if we choose h = 0.04
0.04 ENTER^
2 XEQ "TLNP" >>>> x'(2) = 1 = R06 ---Execution time = 8s---
RDN y'(2) = 12 = R07
RDN z"(2) = 24 = R08
and R03 = x(2) = 1 R04 = y(2) = 13 R05 = z(2) = 16
-So, the equations of the tangent line are: x / 1 = ( y - 13 ) / 12 = ( z - 16 ) / 24
and the equation of the normal plane is: x + 12 ( y - 13 ) + 24 ( z - 16 ) = 0
b) F(X,Y,Z) = 0 & G(X,Y,Z)
= 0
Tangent Line: ( x - x0 ) / [ ( df/dy ) ( dg/dz ) - ( df/dz ) ( dg/dy ) ] = ( y - y0 ) / [ ( df/dz ) ( dg/dx ) - ( df/dx ) ( dg/dz ) ] = ( z - z0 ) / [ ( df/dx ) ( dg/dy ) - ( df/dy ) ( dg/dx ) ]
Normal Plane: ( x - x0 ) / [ ( df/dy ) ( dg/dz ) - ( df/dz ) ( dg/dy ) ] + ( y - y0 ) / [ ( df/dz ) ( dg/dx ) - ( df/dx ) ( dg/dz ) ] + ( z - z0 ) / [ ( df/dx ) ( dg/dy ) - ( df/dy ) ( dg/dx ) ] = 0
( in fact, d = partial derivative )
Data Registers: • R00 = f name ( Register R00 is to be initialized before executing "TLNP" )
R01 = x0 R04 = h R05 = df/dx R08 = dg/dx R11 = ( df/dy ) ( dg/dz ) - ( df/dz ) ( dg/dy ) = AR02 = y0 R06 = df/dy R09 = dg/dy R12 = ( df/dz ) ( dg/dx ) - ( df/dx ) ( dg/dz ) = B
R03 = z0 R07 = df/dz R10 = dg/dz R13 = ( df/dx ) ( dg/dy ) - ( df/dy ) ( dg/dx ) = C
Flags: /
Subroutine: A program that takes
x in X-register, y in Y-register a z in Z-register and returns f(x,y,z)
in X-register & g(x,y,z) in Y-register
01 LBL "TLNP" 02 STO 01 03 RDN 04 STO 02 05 RDN 06 STO 03 07 X<>Y 08 STO 04 09 4 10 * 11 STO 11 12 CLX 13 STO 05 14 STO 06 15 STO 07 16 STO 08 17 STO 09 18 STO 10 19 SIGN 20 XEQ 01 21 9 22 CHS 23 XEQ 01 24 45 25 XEQ 01 |
26 GTO 03 27 LBL 01 28 STO 12 29 RCL 04 30 ST- 11 31 RCL 03 32 RCL 02 33 RCL 01 34 RCL 11 35 + 36 XEQ 02 37 ST+ 05 38 X<>Y 39 ST+ 08 40 RCL 03 41 RCL 02 42 RCL 01 43 RCL 11 44 - 45 XEQ 02 46 ST- 05 47 X<>Y 48 ST- 08 49 RCL 03 50 RCL 02 |
51 RCL 11 52 + 53 RCL 01 54 XEQ 02 55 ST+ 06 56 X<>Y 57 ST+ 09 58 RCL 03 59 RCL 02 60 RCL 11 61 - 62 RCL 01 63 XEQ 02 64 ST- 06 65 X<>Y 66 ST- 09 67 RCL 03 68 RCL 11 69 + 70 RCL 02 71 RCL 01 72 XEQ 02 73 ST+ 07 74 X<>Y 75 ST+ 10 |
76 RCL 03 77 RCL 11 78 - 79 RCL 02 80 RCL 01 81 XEQ 02 82 ST- 07 83 X<>Y 84 ST- 10 85 RTN 86 LBL 02 87 XEQ IND 00 88 RCL 12 89 ST* Z 90 * 91 RTN 92 LBL 03 93 RCL 04 94 60 95 * 96 ST/ 05 97 ST/ 06 98 ST/ 07 99 ST/ 08 100 ST/ 09 101 ST/ 10 |
102 RCL 06 103 RCL 10 104 * 105 RCL 07 106 RCL 09 107 * 108 - 109 STO 11 110 RCL 05 111 RCL 09 112 * 113 RCL 06 114 RCL 08 115 * 116 - 117 STO 13 118 RCL 07 119 RCL 08 120 * 121 RCL 05 122 RCL 10 123 * 124 - 125 STO 12 126 RCL 11 127 END |
( 178 bytes / SIZE 013 )
STACK | INPUTS | OUTPUTS |
T |
h |
/ |
Z | z0 | C |
Y | y0 | B |
X | x0 | A |
Example: f(x,y,z) = x2 + 2 y2 + z4 - 28 = 0 g(x,y,z) = x y z - 8 = 0 (x0,y0,z0) = ( 2,2,2)
01
LBL "T" 02 STO T 03 X^2 04 X<>Y 05 ST* T 06 X^2 07 ST+ X 08 + 09 X<>Y 10 ST* Z 11 X^2 12 X^2 13 + 14 8 15 ST- Z 16 - 17 20 18 - 19 END |
"T" ASTO 00
-And if we choose h = 0.04
0.04 ENTER^
2 ENTER^ ENTER^ XEQ "TLNP" >>>> A = -96 ---Execution time = 23s---
RDN B = 112
RDN C = -16
-So, the equations of the tangent line are: ( x - 2 ) / (-96) = ( y - 2 ) / 112 = ( z - 2 ) / (-16)
and the equation of the normal plane is: -96 ( x - 2 ) + 112 ( y - 2 ) - 16 ( z - 2 ) = 0
2°) Tangent Plane & Normal Line of a Surface
Surface: F(x,y,z) = 0
Tangent Plane: ( x - x0 ) ( dF/dx ) + ( y - y0 ) ( dF/dy ) + ( z - z0 ) ( dF/dz ) = 0
Normal Line: ( x - x0 ) / ( dF/dx ) = ( y - y0 ) / ( dF/dy ) = ( z - z0 ) / ( dF/dz )
Data Registers: • R00 = f name ( Register R00 is to be initialized before executing "TPNL" )
R01 = x0 R04 = h R05 = df/dxR02 = y0 R06 = df/dy
R03 = z0 R07 = df/dz
Flags: /
Subroutine: A program that takes
x in X-register, y in Y-register a z in Z-register and returns f(x,y,z)
in X-register.
01 LBL "TPNL" 02 STO 01 03 RDN 04 STO 02 05 RDN 06 STO 03 07 X<>Y 08 STO 04 09 4 10 * 11 STO 08 12 CLX 13 STO 05 14 STO 06 15 STO 07 16 SIGN 17 XEQ 01 18 9 19 CHS |
20 XEQ 01 21 45 22 XEQ 01 23 GTO 02 24 LBL 01 25 STO 09 26 RCL 04 27 ST- 08 28 RCL 03 29 RCL 02 30 RCL 01 31 RCL 08 32 + 33 XEQ IND 00 34 RCL 09 35 * 36 ST+ 05 37 RCL 03 38 RCL 02 |
39 RCL 01 40 RCL 08 41 - 42 XEQ IND 00 43 RCL 09 44 * 45 ST- 05 46 RCL 03 47 RCL 02 48 RCL 08 49 + 50 RCL 01 51 XEQ IND 00 52 RCL 09 53 * 54 ST+ 06 55 RCL 03 56 RCL 02 57 RCL 08 |
58 - 59 RCL 01 60 XEQ IND 00 61 RCL 09 62 * 63 ST- 06 64 RCL 03 65 RCL 08 66 + 67 RCL 02 68 RCL 01 69 XEQ IND 00 70 RCL 09 71 * 72 ST+ 07 73 RCL 03 74 RCL 08 75 - |
76 RCL 02 77 RCL 01 78 XEQ IND 00 79 RCL 09 80 * 81 ST- 07 82 RTN 83 LBL 02 84 RCL 04 85 60 86 * 87 ST/ 05 88 ST/ 06 89 ST/ 07 90 RCL 07 91 RCL 06 92 RCL 05 93 END |
( 127 bytes / SIZE 010 )
STACK | INPUTS | OUTPUTS |
T |
h |
/ |
Z | z0 | df/dz |
Y | y0 | df/dy |
X | x0 | df/dx |
Example: f(x,y,z) = 3 x2 + 2 y2 - z - 11 = 0 (x0,y0,z0) = ( 2,1,3)
01
LBL "T" 02 X^2 03 3 04 * 05 X<>Y 06 X^2 07 ST+ X 08 + 09 X<>Y 10 - 11 11 12 - 13 END |
"T" ASTO 00
-And if we choose h = 0.04
0.04 ENTER^
3 ENTER^
1 ENTER^
2 XEQ "TPLN" >>>> 12 ---Execution time = 15s---
RDN 4
RDN -1
-So, the equations of the normal line are: ( x - 2 ) / 12 = ( y - 1 ) / 4 = ( z - 3 ) / (-1)
and the equation of the tangent plane is: 12 ( x - 2 ) + 4 ( y - 1 ) - ( z - 3 ) = 0
Reference:
1- Frank Ayres JR & Elliott Mendelson - "Theory & Problems of Differential & Integral Calculus" - Schaum