The Museum of HP Calculators


Spherical Triangles for the HP-41

This program is Copyright © 2005 by Jean-Marc Baillard and is used here by permission.

This program is supplied without representation or warranty of any kind. Jean-Marc Baillard and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

-This program finds the sides and the angles of a spherical triangle.
-It works in all angular modes but angles must be entered as decimals.
-It conforms to the standard triangle notation ( A opposite a ... etc ... )
 

Formulae:     sin a / sin A = sin b / sin B = sin c / sin C
                      cos a = cos b cos c + sin b sin c cos A
                      cos A = -cos B cos C + sin B sin C cos a
                             c = arctan ( cos A tan b ) + arctan ( cos B tan a )    ( modulo 180° )

-This last formula is used in cases n°5 and n°6.
-Other formulae can be used, for example:            tan c/2 = ( tan (a-b)/2 ).( sin (A+B)/2 ) / ( sin (A-B)/2 )              ( F1 )
                                                                      or  tan c/2 = ( tan (a+b)/2 ).( cos (A+B)/2 ) / ( cos (A-B)/2 )           ( F2 )

  but ( F1 ) cannot be applied if  a = b & A = B and  ( F2 ) doesn't work if  a + b = A + B = 180°

                            A
                              *
                       *               *      b
             c    *                         *                                with  A + B + C > 180°
                *                               *
          B  *    *    *    *    *    *    *  C
                               a
 

Program Listing
 

Data Registers:      When the program stops:  R01 = a          R04 =  A                        (  R00:  temp )
                                                                         R02 = b          R05 =  B
                                                                         R03 = c          R06 =  C
Flags: /
Subroutines: /
 

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

( 233 bytes / SIZE 007 )
 

-Execution time ~ 8 seconds
 

1°) First case:  the 3 angles are known
 
 
      STACK        INPUTS      OUTPUTS
           T             0             /
           Z             C             c
           Y             B             b
           X             A             a

Example:    A = 50° , B = 70° , C = 100°

   0   ENTER^
 100 ENTER^
  70  ENTER^
  50  XEQ "SABC"  >>>>   a = 50.9193°   RDN   b = 72.2173°   RDN   c = 86.3204°
 

2°) Second case: 1 side and the 2 adjacent angles are known
 
 
      STACK        INPUTS      OUTPUTS
           T             1             /
           Z             C             c
           Y             B             b
           X             a             A

Example:    a = 30° , B = 50° , C = 100°

    1   ENTER^
  100 ENTER^
   50  ENTER^
   30  XEQ "SABC"  >>>>  A = 40.0971°  RDN  b =  36.4896°   RDN  c =  49.8627°
 

3°) Third case: 2 sides and the included angle are known
 
 
      STACK        INPUTS      OUTPUTS
           T             2             /
           Z             C             c
           Y             b             B
           X             a             A

Example:     a = 30°   b = 40°   C = 80°

    2   ENTER^
   80  ENTER^
   40  ENTER^
   30  XEQ "SABC"  >>>>  A = 45.1309°   RDN   B = 65.6596°   RDN   c = 44.0096°
 

4°) Fourth case: 3 known sides
 
 
      STACK        INPUTS      OUTPUTS
           T             3             /
           Z             c             C
           Y             b             B
           X             a             A

Example:        a = 30°   b = 40°  c = 50°

     3    ENTER^
    50   ENTER^
    40   ENTER^
    30   XEQ "SABC"  >>>>   A = 40.6441°   RDN   B = 56.8634°   RDN   C = 93.6796°
 

5°) Fifth case: 1 side , the opposite angle and another angle are known
 
 
      STACK        INPUTS    OUTPUTS1   OUTPUTS2
           T             4             /            /
           Z             B             C           C'
           Y             A             c           c'
           X             a             b           b'

Example:      a = 30°    A = 40°   B = 60°

    4    ENTER^
   60   ENTER^
   40   ENTER^
   30   XEQ "SABC"  >>>>   b  =  42.3493°   RDN    c =  51.0269°   RDN   C =  91.8854°
               R/S             >>>>   b' = 137.6507°  RDN    c' = 161.1774°  RDN  C' = 155.4947°

-Here, we have 2 solutions.
-If one of the solutions must be rejected, the stack is cleared  ( X = Y = Z = T = 0 )

-For instance   a = 30°  b = 110°  B = 40°

     4    ENTER^
    40   ENTER^
   110  ENTER^
    30   XEQ "SABC"  >>>>  b = 20.0000°   RDN   c = 16.7627°   RDN   C = 32.8220°
                 R/S            >>>>  0  RDN  0  RDN  0

-Thus , there is only one solution.
 

6°) Sixth case: 2 sides and one adjacent angle known
 
 
      STACK        INPUTS    OUTPUTS1   OUTPUTS2
           T             5             /            /
           Z             B             C           C'
           Y             b             c           c'
           X             a             A           A'

Example:    a = 100°   b = 110°   B = 120°

      5     ENTER^
    120   ENTER^
    110   ENTER^
    100   XEQ "SABC"  >>>>   A =  65.1763°   RDN   c =  21.4983°    RDN    C =  19.7395°
                 R/S             >>>>   A' = 114.8237°  RDN   c' = 119.6509°   RDN   C' = 126.7814°

-In this example, there are also 2 solutions.
-If one of the solutions must be rejected, the stack is cleared  ( X = Y = Z = T = 0 )

-In cases 1-2-3-4 ,  T-register input = the number of known sides.
-In cases 5-6 , the results are not very accurate if all angles are near 90°
 
 
 

Go back to the HP-41 software library
Go back to the general software library
Go back to the main exhibit hall