# hp41programs

Alea Hügelschäffer Egg for the HP-41

Overview

1°) Volume
2°) Surface Area

-Hügelschäffer egg is defined by:

2 w x y2 + b2 x2 + ( a2 + w2 ) y2 - a2 b2 = 0

1°)  Volume

-Volume = ( Pi b2 / ( 4 w3 )) [ ( a2 + w2 )2 Ln [ ( a - w ) / ( a + w ) ] + 2 a w ( a2 + w2 ) ]

Data Registers:   R00: temp  R01 = a  R02 = b  R03 = w
Flags: /
Subroutines: /

 01 LBL "EGGV"  02 STO 03  03 X^2  04 STO 00            05 X<>Y  06 STO 02  07 X<> Z 08 STO 01            09 X^2  10 ST- 00  11 +  12 RCL 01  13 ST* Y  14 RCL 03 15 ST* Z  16 ST- Y  17 RCL 01            18 +  19 /  20 SQRT  21 LN 22 RCL 00  23 X^2      24 *  25 +  26 RCL 02            27 RCL 03  28 ST/ Z 29 /  30 X^2                31 *  32 PI  33 *  34 2  35 /  36 END

( 51 bytes / SIZE 004 )

 STACK INPUTS OUTPUTS Z a / Y b / X w V

a > b > w > 0

Example:     a = 7     b = 5     w = 2

7   ENTER^
5   ENTER^
2    XEQ "EGGV"   >>>>   V = 720.9268000

Note:

-If w > a  add  ABS after line 19

2°)  Surface Area

Area = §-a+a  2 Pi y sqrt [ 1 + ( dy / dx )2 ] dx

= 2 Pi  b  §-a+a  sqrt [ ( a2 - x2 ) ( a2 + w2 + 2 w x )3 + b2 ( w x2 + ( a2 + w2 ) x + a2 w )2 ] / ( a2 + w2 + 2 w x )2  dx

-This program calls "GL3" = the 3-point Gauss-Legendre formula  ( cf "Numerical Integration for the HP41" §1°)a) )

-The first result calls "GL3" with n = 4 ( line 12 )
-The second result with n = 8 ( line 22 )
-The third result with n = 16 ( line 22 )   ...

Data Registers:     R11 = a  R12 = b  R13 = w
Flags: /
Subroutine: "GL3" ( cf "Numerical Integration for the HP41" §1°)a) )

 01 LBL "EGGS"  02 STO 13  03 RDN  04 STO 12  05 X<>Y  06 STO 11  07 STO 02            08 CHS  09 STO 01  10 "T"  11 ASTO 00  12 4  13 STO 03 14 LBL 00  15 XEQ "GL3"  16 RCL 12            17 *  18 PI  19 *  20 ST+ X  21 RTN  22 2  23 ST* 03  24 GTO 00  25 LBL "T"  26 STO 10 27 X^2  28 RCL 11  29 X^2  30 STO 14            31 X<>Y  32 -  33 RCL 10  34 ST+ X  35 RCL 13  36 ST* Y  37 X^2  38 RCL 14  39 + 40 STO T  41 +  42 ST* Y  43 X^2  44 STO 15            45 *  46 RCL 10  47 RCL 13  48 ST* 14  49 *  50 R^  51 +  52 RCL 10 53 *  54 RCL 14  55 +  56 RCL 12            57 *  58 X^2  59 +  60 SQRT  61 RCL 15  62 /  63 RTN  64 END

( 91 bytes / SIZE 016 )

 STACK INPUTS OUTPUTS Z a / Y b / X w A

Example1:

a = 7     b = 5     w = 2

7   ENTER^
5   ENTER^
2   XEQ "EGGS"   >>>>   A = 399.6311024                ---Execution time = 21s ---
R/S     A = 399.6263120
R/S     A = 399.6262484

Example2:     a = 2.854     b = 2.2155     w = 0.9138298

2.854       ENTER^
2.2155      ENTER^
0.9138298   XEQ "EGGS"   >>>>   A = 73.61211724
R/S     A = 73.61189370
R/S     A = 73.61192002

Reference:

[1] HUGELSCHAFFER EGG CURVE AND SURFACE - Maja Petrovic and Branko Malesevic