# hp41programs

Ellipsoid Surface Area of an Ellipsoid for the HP-41

Overview

-The surface area of an ellipsoid of revolution may be computed by the following formulae ( a = semi-major axis ; b = semi-minor axis ):

Prolate ellipsoid:     S = 2 Pi a.b ( b/a + ( Arc sin µ )/µ )        with    µ = ( 1 - b2/a2 )1/2
Oblate ellipsoid:     S' = 2 Pi a.b ( a/b + ( Arc sinh µ' )/µ' )     with    µ' = ( a2/b2 - 1 )1/2

-For a scalene ellipsoid:   x2/a2 + y2/b2 +x2/c2 = 1  , the formula is more complex:

Area = 2.Pi ( c2 + b.c2/(a2-c2)1/2 F( µ | m ) + b.(a2-c2)1/2 E( µ | m ) )      ( c < b < a )

where  F and E are the Legendre elliptic integrals of the first and second kind respectively.

-But we can also use a Carlson elliptic integral of the second kind ( namely, RG ) and we have:

Area = 4.PI.RG( a2b2 , a2c2 , b2c2 )

1°) Ellipsoid of Revolution

Data Registers: /
Flags: /
Subroutines: /

 01  LBL "SAER" 02  RCL Y 03  RCL Y 04  * 05  PI 06  * 07  ST+ X 08  STO M        09  RDN 10  X>Y? 11  X<>Y 12  / 13  ENTER^ 14  ENTER^ 15  1/X 16  ACOS         17  TAN 18  ENTER^ 19  R^ 20  + 21  LN 22  X<>Y 23  X=0? 24  SIGN          25  / 26  X=0? 27  SIGN  28  + 29  X<>Y 30  1/X 31  ENTER^ 32  ASIN          33  COS 34  RAD 35  ASIN 36  DEG 37  LASTX  38  X=0? 39  SIGN 40  / 41  X=0? 42  SIGN 43  + 44  0 45  X<> M        46  ST* Z 47  * 48  END

( 62 bytes / SIZE 000 )

 STACK INPUTS OUTPUTS Y b S' X a S

where  S'  is  the area of the oblate ellipsoid
and    S  is  the area of the prolate ellipsoid

Example:

2  ENTER^
3  XEQ "SAER"    >>>>     S = 67.67287267
X<>Y    S' = 89.00073737

-Lines 23-24-26-27-38-39-41-42 are only useful if a = b ( sphere )
-This program doesn't work if a = 0 or b = 0 ( add  X=0?   RTN  after line 04 if you want to take this case into account )
-Synthetic register M may be replaced by any data register ( like R00 ... )

2°)  Scalene Ellipsoid

a) Program#1

Data Registers:  R00 to R09
Flags: /
Subroutine:    "ELI"  ( cf "Elliptic integrals for the HP-41" )

 01  LBL "SAE" 02  DEG 03  STO 01        04  X^2 05  X<>Y 06  STO 07 07  ENTER^ 08  * 09  ST/ Y 10  R^ 11  X^2 12  STO 08        13  - 14  * 15  RCL 01  16  X^2 17  RCL 08 18  - 19  X#0? 20  ST/ Y 21  SQRT 22  STO 09        23  RCL 01 24  / 25  ASIN 26  XEQ "ELI" 27  X<>Y 28  RCL 08 29  * 30  RCL 09        31  ST* Z 32  X#0? 33  / 34  + 35  RCL 07  36  * 37  X=0? 38  RCL 08        39  RCL 08  40  + 41  ST+ X 42  PI 43  * 44  END

( 60 bytes / SIZE 010 )

 STACK INPUTS OUTPUTS Z c / Y b / X a Area

with  c < b < a

Example:

2  ENTER^
4  ENTER^
9  XEQ "SAE"  >>>>   Area =  283.4273845    ( in 17 seconds )

-Lines 19-32-37-38 are only useful if  a = b = c
-This program doesn't work if a , b or c = 0 ( add   X=0?  RTN   after line 10 if you want to take this case into account )
but it works for an ellipsoid of revolution.
-Add   X<Y?   X<>Y   RDN   X<Y?   X<>Y   R^   X<Y?   X<>Y  after line 02 if you want to ENTER  a , b , c  in an arbitrary order.

b) Program#2

Data Registers:  R00 to R13
Flags: /
Subroutine:    "RG"  ( cf "Elliptic integrals for the HP-41" )

 01  LBL "SAE2"  02  X^2  03  X<>Y  04  X^2  05  X<> Z  06  ENTER^  07  *  08  ST* T  09  X<>Y  10  ST* Z  11  *  12  XEQ "RG"  13  4  14  *  15  PI   16  *  17  END

( 32 bytes / SIZE 014 )

 STACK INPUTS OUTPUTS Z c / Y b / X a Area

Example:

2  ENTER^
4  ENTER^
9  XEQ "SAE2"  >>>>   Area =  283.4273843    ( in 52 seconds )

Note:

-If you key in

9  ENTER^
4  ENTER^
2  XEQ "SAE2"  it yields  283.4273841  ( in 48 seconds )