hp41programs

Hyperbolic Tetrahedron

Hyperbolic Tetrahedron for the HP-41


Overview
 

 1°)  Volume of Hyperbolic Orthotetrahedra
 2°)  General Case

  a)  Volume of a Hyperbolic Tetrahedron
  b)  Dihedral Angles >>> Edge Lengths
  c)  Edge Lengths >>> Dihedral Angles
 
 

1°)  Volume of Hyperbolic Orthotetrahedra
 

-An hyperbolic Orthotetraedron may be defined by 3 dihedral angles A , B , C   ( the 3 other dihedral angles = 90° )

    provided  A , B , C < 90°  ;  A+B , B+C >= 90°  ;  (Sin A) (Sin C) < Cos B

-The volume is calculated by the formula:

   V = (1/4) [ L(A+d) - L(A-d) + L(C+d) - L(C-d) - L(90°-B+d) + L(90°-B+d) + 2.L(90°-d) ]

   where  d = Arc Tan [ sqrt( cos2 B - sin2 A  sin2 C ) / cos A / cos C ]    and L = Lobachevsky function
 

Data Registers:  R00: temp  R01 = V ,  R02 = A , R03 = B , R04 = C , R05 = d
Flags: /
Subroutine:   "LOB"  ( cf "Lobachevsky Function for the HP-41" )
 
 

 01  LBL "VHOT"
 02  DEG
 03  STO 04
 04  SIN
 05  RCL Z
 06  STO 02        
 07  SIN
 08  *
 09  X^2
 10  CHS
 11  X<>Y
 12  STO 03
 13  COS
 14  X^2
 15  +
 16  SQRT
 17  RCL 02
 18  COS
 19  RCL 04        
 20  COS
 21  *
 22  /
 23  ATAN
 24  STO 05
 25  RCL 02
 26  +
 27  XEQ "LOB"
 28  STO 01
 29  RCL 02
 30  RCL 05
 31  -
 32  XEQ "LOB"
 33  ST- 01
 34  RCL 04 
 35  RCL 05        
 36  +
 37  XEQ "LOB"
 38  ST+ 01
 39  RCL 04
 40  RCL 05
 41  -
 42  XEQ "LOB"
 43  ST- 01
 44  90
 45  RCL 03
 46  -
 47  RCL 05        
 48  +
 49  XEQ "LOB"
 50  ST- 01
 51  90
 52  RCL 03
 53  -
 54  RCL 05
 55  -
 56  XEQ "LOB"
 57  ST+ 01
 58  90
 59  RCL 05        
 60  -
 61  XEQ "LOB"
 62  ST+ X
 63  RCL 01
 64  +
 65  4
 66  /
 67  STO 01
 68  END

 
    ( 115 bytes / SIZE 006 )
 
 

      STACK        INPUTS      OUTPUTS
           Z             A             /
           Y             B             /
           X             C       Volume

   Where  A , B , C   are expressed in degrees                     ---Execution time = 46s---

Example1:     A = C = 36°  ,   B = 60°

   36  ENTER^
   60  ENTER^
   36  XEQ "VHOT"  >>>>   0.09332553955

-The Seifert-Weber space is obtained by 120 such orthotetrahedra, so multiplying the result by 120 yields.

    V = 11.19906475   ( the last decimal should be a 4 )

Example2:     A = 41°  ,   B = 67°  ,  C = 28°

  41  ENTER^
  67  ENTER^
  28     R/S      >>>>   Volume = 0.03420659993

Note:

-This routine does not check that  A , B , C < 90°  &  A+B , B+C >= 90°
 

2°)  General Case
 

     a)  Volume of a Hyperbolic Tetrahedron
 
 

                           *
                         * *  *
               A    *       *     *    C
                  *          B  *         *
             *                        *            *                                       Here,  A B C D E ( invisible ) F are the 6 dihedral angles ( not the edges lengths )
       *                                  *                   *
                            F     *           *        * D
                                                      *
 

-In the general case, the volume of a hyperbolic tetrahedron is more complicated ( see reference [2] ).
-It is the sum of 16 Lobachevsky functions.

-We assume that the 6 dihedral angles A , B , C , D , E , F are known and expressed in degrees.
-They must be stored in registers R01 to R06.
 

Data Registers:              R00: temp                             ( Registers R01 thru R06 are to be initialized before executing "HTHV" )

                                      •  R01 = A      •  R04 = D         R07 = Volume        R08 to R10: temp
                                      •  R02 = B      •  R05 = E
                                      •  R03 = C      •  R06 = F
Flags: /
Subroutine:  "LOB"  ( cf "Lobachevsky Function for the HP-41" )
 
 

  01  LBL "HTHV"
  02  DEG
  03  RCL 01
  04  RCL 04
  05  +
  06  STO 07
  07  1
  08  P-R
  09  RCL 02         
  10  RCL 05
  11  +
  12  ST+ 07
  13  1
  14  P-R
  15  X<>Y
  16  ST+ T
  17  RDN
  18  +
  19  RCL 03
  20  RCL 06
  21  +
  22  ST+ 07
  23  1
  24  P-R
  25  X<>Y
  26  ST+ T
  27  RDN
  28  +
  29  RCL 04
  30  RCL 05
  31  +
  32  RCL 06
  33  +
  34  1
  35  P-R
  36  X<>Y
  37  ST+ T
  38  RDN
  39  +
  40  RCL 02         
  41  RCL 03
  42  +
  43  RCL 04
  44  +
  45  1
  46  P-R
  47  X<>Y
  48  ST+ T
  49  RDN
  50  +
  51  RCL 01
  52  RCL 03
  53  +
  54  RCL 05
  55  +
  56  1
  57  P-R
  58  X<>Y
  59  ST+ T
  60  RDN
  61  +
  62  RCL 01
  63  RCL 02
  64  +
  65  RCL 06
  66  +
  67  1
  68  P-R
  69  X<>Y
  70  ST+ T
  71  RDN
  72  +
  73  RCL 07         
  74  1
  75  P-R
  76  X<>Y
  77  ST+ T
  78  RDN
  79  +
  80  CHS
  81  X<>Y
  82  R-P
  83  X^2
  84  STO 07
  85  X<>Y
  86  STO 08
  87  RCL 01
  88  SIN
  89  RCL 04
  90  SIN
  91  *
  92  RCL 02
  93  SIN
  94  RCL 05
  95  SIN
  96  *
  97  +
  98  RCL 03
  99  SIN
100  RCL 06
101  SIN
102  *
103  +
104  ST+ X
105  RCL 07         
106  RCL Y
107  X^2
108  -
109  SQRT
110  R-P
111  X<>Y
112  ENTER^
113  CHS
114  RCL 08
115  ST- Z
116  -
117  PI
118  R-D
119  +
120  STO 09
121  X<>Y
122  STO 08
123  CLST
124  STO 07
125  XEQ 01
126  RCL 01
127  RCL 02
128  RCL 04
129  RCL 05
130  XEQ 01
131  RCL 01
132  RCL 03
133  RCL 04
134  RCL 06
135  XEQ 01
136  RCL 02         
137  RCL 03
138  RCL 05
139  RCL 06
140  XEQ 01
141  RCL 08
142  X<> 09
143  STO 08
144  GTO 00
145  LBL 01
146  +
147  +
148  +
149  STO 10
150  RCL 08
151  +
152  2
153  /
154  XEQ "LOB"
155  ST+ 07
156  RCL 09
157  RCL 10
158  +
159  2
160  /
161  XEQ "LOB"
162  ST- 07
163  RTN
164  LBL 00
165  PI
166  R-D
167  RCL 01         
168  RCL 02
169  RCL 03
170  XEQ 01
171  PI
172  R-D
173  RCL 01
174  RCL 05
175  RCL 06
176  XEQ 01
177  PI
178  R-D
179  RCL 02
180  RCL 04
181  RCL 06
182  XEQ 01
183  PI
184  R-D
185  RCL 03
186  RCL 04
187  RCL 05
188  XEQ 01
189  2
190  ST/ 07
191  RCL 07
192  END

 
     ( 242 bytes / SIZE 011 )
 
 

      STACK        INPUT      OUTPUT
           X             /       Volume

   Provided  R01 = A , R02 = B , R03 = C , R04 = D , R05 = E , R06 = F , all expressed in degrees

Example1:     A = 71° , B = 59° , C = 61° , D = 37° , E = 84° , F = 87°

   71  STO 01     37  STO 04
   59  STO 02     84  STO 05
   61  STO 03     87  STO 06

   XEQ "HTHV"  >>>>  V = 0.308555268                                               ---Execution time = 115s---

Example2:     A = 72° , B = 60° , C = 60° , D = 36° , E = 90° , F = 90°

   72  STO 01                    36  STO 04
   60  STO 02  STO 03      90  STO 05  STO 06

       R/S     >>>>  V = 0.1866510793

 multiplying by 60 gives again the volume of the Seifert-Weber space:   11.19906476   ( the last decimal should be a 4 )
 

     b)  Dihedral Angles >>> Edge Lengths
 

-Assuming the 6 dihedral angles ( A , B , C , D , E , F )  are known,
 "DA-EL" computes the 6 corresponding edges lengths  ( a , b , c , d , e , f )  and store them into R11 to R16.

Formulae:

  Cosh a = c34 / sqrt ( c33.c44 )   with

    c33 = 1 - 2 Cos A Cos E Cos F - Cos2 A - Cos2 E - Cos2 F
    c44 = 1 - 2 Cos A Cos B Cos C - Cos2 A - Cos2 B - Cos2 C

    c34 = Cos D + Cos A Cos B Cos E + Cos A Cos C Cos F + Cos B Cos F - Cos2 A Cos D + Cos C Cos E

-Similar formulae might be used for the other edges but the order of the dihedral angles is changed in R01 to R06
  in order to use always the formulas above.
 

Data Registers:              R00 & R07 to R10: temp                        ( Registers R01 thru R06 are to be initialized before executing "DA-EL" )

                                      •  R01 = A      •  R04 = D                          R11 = a         R14 = d
                                      •  R02 = B      •  R05 = E         give            R12 = b        R15 = e
                                      •  R03 = C      •  R06 = F                           R13 = c        R16 = f
Flags: /
Subroutines:  /

-Line 121  ACOSH  is an M-code routine ( inverse hyperbolic cosine )
 which may be replaced by  XEQ "ACH"   ( cf "Hyperbolic functions for the HP-41" )
 
 

  01  LBL "DA-EL"
  02  XEQ 01
  03  STO 11
  04  RCL 01
  05  X<> 02
  06  STO 01
  07  RCL 04
  08  X<> 05
  09  STO 04         
  10  XEQ 01
  11  STO 12
  12  RCL 01
  13  X<> 03
  14  STO 01
  15  RCL 04
  16  X<> 06
  17  STO 04
  18  XEQ 01
  19  STO 13
  20  RCL 01
  21  X<> 05
  22  STO 01
  23  RCL 02
  24  X<> 04
  25  STO 02
  26  XEQ 01
  27  STO 14
  28  RCL 01
  29  X<> 06
  30  STO 01
  31  RCL 03
  32  X<> 04
  33  STO 03
  34  XEQ 01
  35  STO 15         
  36  RCL 01
  37  X<> 02
  38  STO 01
  39  RCL 04
  40  X<> 05
  41  STO 04
  42  XEQ 01
  43  STO 16
  44  RCL 01
  45  X<> 06
  46  X<> 04
  47  X<> 03
  48  STO 01
  49  RCL 02
  50  X<> 05
  51  STO 02
  52  GTO 02
  53  LBL 01
  54  RCL 01
  55  1
  56  P-R
  57  STO 00
  58  X<>Y
  59  X^2
  60  STO 07
  61  RCL 05         
  62  COS
  63  STO 08
  64  ST* Z
  65  X^2
  66  - 
  67  RCL 06
  68  COS
  69  STO 09
  70  ST* Z
  71  X^2
  72  -
  73  X<>Y
  74  ST+ X
  75  -
  76  RCL 00
  77  RCL 07
  78  RCL 02
  79  COS
  80  STO 07
  81  ST* Z
  82  X^2
  83  -
  84  RCL 03
  85  COS
  86  STO 10         
  87  ST* Z
  88  X^2
  89  -
  90  X<>Y
  91  ST+ X
  92  -
  93  *
  94  RCL 07
  95  RCL 08
  96  *
  97  RCL 09
  98  ST* 07
  99  RCL 10
100  *
101  +
102  RCL 00
103  RCL 04
104  COS
105  STO 09
106  *
107  -
108  RCL 00
109  *
110  RCL 09         
111  +
112  RCL 07
113  +
114  RCL 08
115  RCL 10
116  *
117  +
118  X<>Y
119  SQRT
120  /
121  ACOSH
122  RTN
123  LBL 02
124  RCL 14
125  RCL 13
126  RCL 12
127  RCL 11
128  END

 
   ( 174 bytes / SIZE 017 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /            d
           Z             /            c
           Y             /            b
           X             /            a

 
Example:      A = 71° , B = 59° , C = 61° , D = 37° , E = 84° , F = 87°

   71  STO 01     37  STO 04
   59  STO 02     84  STO 05
   61  STO 03     87  STO 06

   XEQ "DA-EL"  >>>>   a = 1.203427992  = R11                            ---Execution time = 36s---
                            RDN    b = 2.439545899 = R12
                            RDN    c = 2.642741752 = R13
                            RDN    d = 3.020541806 = R14

    and   R15 = e = 2.114152483  ,   R16 = f = 1.938907707

Notes:

-Registers R01 to R06 are modified during the calculations, but their original content is restore at the end ( lines 44 to 51 )
-This program works in all angular modes.
 

     c)  Edge Lengths >>> Dihedral Angles
 

-Assuming now that the 6 edge lengths  ( a , b , c , d , e , f )  are known,
 "EL-DA" computes the 6 corresponding dihedral angles ( A , B , C , D , E , F )  and store them into R11 to R16.

Formulae:

  Cos A = c'12 / sqrt ( c'11.c'22 )   with

    c'11 = -1 - 2 Cosh a Cosh b Cosh f + Cosh2 a + Cos2 b + Cos2 f
    c'22 = -1 - 2 Cosh a Cosh c Cosh e + Cosh2 A + Cosh2 c + Cosh2 e

    c'12 = Cosh d + Cosh a Cosh c Cosh f + Cosh a Cosh b Cosh e - Cosh b Cosh c - Cosh2 a Cosh d - Cosh e Cosh f

-Similar formulae might be used for the other angles but the order of the edge lengths is changed in R01 to R06
  in order to use always the formulas above.
 

Data Registers:              R00 & R07 to R10: temp                       ( Registers R01 thru R06 are to be initialized before executing "EL-DA" )

                                      •  R01 = a      •  R04 = d                           R11 = A         R14 = D
                                      •  R02 = b      •  R05 = e         give            R12 = B         R15 = E
                                      •  R03 = c      •  R06 = f                            R13 = C         R16 = F
Flags: /
Subroutines:  /

-2 M-Code routines SINH & COSH are used but you can also:

  -add  LBL 00  E^X  1/X  ST+ L  CLX  2  ST/ L  X<> L  RTN   after line 122
  -replace all the  COSH  by  XEQ 00
  -and replace lines 57-58 by  RCL 01  E^X-1  LASTX  CHS  E^X-1  -  2  /
 
 
 

  01  LBL "EL-DA"
  02  XEQ 01
  03  STO 11
  04  RCL 01
  05  X<> 02
  06  STO 01
  07  RCL 04
  08  X<> 05
  09  STO 04
  10  XEQ 01
  11  STO 12         
  12  RCL 01
  13  X<> 03
  14  STO 01
  15  RCL 04
  16  X<> 06
  17  STO 04
  18  XEQ 01
  19  STO 13
  20  RCL 01
  21  X<> 05
  22  STO 01
  23  RCL 02
  24  X<> 04
  25  STO 02
  26  XEQ 01
  27  STO 14
  28  RCL 01
  29  X<> 06
  30  STO 01
  31  RCL 03
  32  X<> 04
  33  STO 03
  34  XEQ 01
  35  STO 15
  36  RCL 01         
  37  X<> 02
  38  STO 01
  39  RCL 04
  40  X<> 05
  41  STO 04
  42  XEQ 01
  43  STO 16
  44  RCL 01
  45  X<> 06
  46  X<> 04
  47  X<> 03
  48  STO 01
  49  RCL 02
  50  X<> 05
  51  STO 02
  52  GTO 02
  53  LBL 01
  54  RCL 01
  55  COSH
  56  STO 00
  57  LASTX
  58  SINH
  59  X^2
  60  STO 07
  61  RCL 02         
  62  COSH
  63  STO 08
  64  ST* Z
  65  X^2
  66  +
  67  RCL 06
  68  COSH
  69  STO 09
  70  ST* Z
  71  X^2
  72  +
  73  X<>Y 
  74  ST+ X
  75  -
  76  RCL 00
  77  RCL 07
  78  RCL 03
  79  COSH
  80  STO 07
  81  ST* Z
  82  X^2
  83  +
  84  RCL 05
  85  COSH
  86  STO 10         
  87  ST* Z
  88  X^2
  89  +
  90  X<>Y
  91  ST+ X
  92  -
  93  *
  94  RCL 07
  95  RCL 09
  96  *
  97  RCL 08
  98  ST* 07
  99  RCL 10
100  *
101  +
102  RCL 00
103  RCL 04
104  COSH
105  STO 08
106  *
107  -
108  RCL 00
109  *
110  RCL 07         
111  -
112  RCL 08
113  +
114  RCL 09
115  RCL 10
116  *
117  -
118  X<>Y
119  SQRT
120  /
121  ACOS
122  RTN
123  LBL 02
124  RCL 14
125  RCL 13
126  RCL 12
127  RCL 11
128  END

 
   ( 180 bytes / SIZE 017 )
 
 

      STACK        INPUTS      OUTPUTS
           T             /            d
           Z             /            c
           Y             /            b
           X             /            a

         ---Execution time = 39s---

Example:

-With the 6 edges lengths found in the previous paragraph, we find the original dihedral angles:

    A = 71° , B = 59° , C = 61° , D = 37° , E = 84° , F = 87°

 with small roundoff-errors in the last decimals.

Notes:

-Registers R01 to R06 are modified during the calculations, but their original content is restore at the end ( lines 44 to 51 )
-This program works in all angular modes.
 

References:

[1]  John G. Ratcliffe - "Foundations of Hyperbolic Manifolds" -  which may be dowloaded freely  here
[2]  D. Derevnin & A. Mednykh - "Volume of Hyperbolic Tetrahedron"
[3]  J. Murakami & A. Ushijima - " A Volume Formula for Hyperbolic Tetrahedra in Terms of Edge Lengths"