hp41programs

Hypersphere Hyperspheres for the HP-41
 

Overview
 

-"HS" calculates the hypervolume ( Vn ) and the hypersurface area ( Sn ) of an n-dimensional unit hypersphere  ( 1 < n < 188 )
-If the radius of the hypersphere equals R, multiply Vn by Rn  and Sn by Rn-1

Formula:    Vn = pin/2/(n/2)!   ;   Sn = n.Vn
 

Program listing
 

Data Registers: /
Flags: /
Subroutines: /
 
 

 01  LBL "HS"
 02  ENTER^
 03  STO Z
 04  2
 05  ST/ Z
 06  MOD
 07  1
 08  +
 09  X<>Y
 10  INT
 11  STO Z
 12  LBL 01
 13  CLX
 14  PI
 15  ST* Y
 16  X<> L
 17  ST/ Y
 18  SIGN
 19  ST- L
 20  DSE Z
 21  GTO 01
 22  R^
 23  *
 24  X<>Y
 25  ST* Y
 26  END

 
( 43 bytes / SIZE 000 )
 
 

      STACK        INPUTS      OUTPUTS
           Y             /            Sn
           X             n            Vn
           L             /             n

Examples:

    3  XEQ "HS"  >>>>      V3 =  4.1888             X<>Y      S3 =  12.5664
    4      R/S        >>>>      V4 =  4.9348             X<>Y      S4 =  19.7392
  187    R/S        >>>>   V187 =  2.7182 10-99    X<>Y   S187 =  5.0830 10-97   ( in 31seconds )

-Vn is maximum for n = 5 and  Sn is maximum for n = 7.
-For n > 187 this program returns zero.