The Museum of HP Calculators


Triangle Solutions for the HP-41

Updated 12/12/05. New functions and Improvements noted in red.

This program is Copyright © 2004-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 , the angles and the area of a plane 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 ... )

Formulas:     a/sinA = b/sinB = c/sinC  ;   a2 = b2 + c2 - 2 b.c.cosA  and 2 similar relations  ;  Area = b.c.(sinA)/2

                    A
                       *
                 c  *        *      b
                   *                 *
                 *                          *
           B  *    *    *    *    *    *    *  C
                               a

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

Program listing

001  LBL "ABC"
002  GTO IND T
003  LBL 11
004  ENTER^
005  X^2
006  R^
007  ST* Z
008  X^2
009  +
010  R^
011  X^2
012  -
013  X<>Y
014  ST+ X
015  /
016  ACOS
017  RTN
018  LBL 12
019  RCL 02
020  RCL 03
021  *
022  RCL 04
023  SIN
024  *
025  2
026  /
027  STO 00
028  RTN
029  LBL 04
030  STO 01
031  X<>Y
032  STO 02
033  /
034  X<>Y
035  STO 05
036  SIN
037  *
038  ASIN
039  LBL 13
040  STO 04
041  RCL 05
042  +
043  1
044  CHS
045  ACOS
046  X<>Y
047  -
048  STO 06
049  SIN
050  RCL 05
051  SIN
052  /
053  RCL 02
054  *
055  STO 03
056  XEQ 12
057  RCL 06
058  RCL 03
059  RCL 04
060  RTN
061  1
062  CHS
063  ACOS
064  RCL 04
065  -
066  GTO 13
067  LBL 01
068  STO 01
069  X<> Z
070  STO 06
071  X<>Y
072  STO 05
073  +
074  1
075  CHS
076  ACOS
077  X<>Y
078  -
079  STO 04
080  SIN
081  /
082  STO 02
083  RCL 06
084  SIN
085  *
086  STO 03
087  RCL 05
088  SIN
089  ST* 02
090  XEQ 12
091  RCL 03
092  RCL 02
093  RCL 04
094  RTN
095  LBL 02
096  STO 01
097  X^2
098  X<>Y
099  STO 02
100  X^2
101  +
102  X<>Y
103  STO 06
104  COS
105  RCL 01
106  *
107  RCL 02
108  *
109  ST+ X
110  -
111  SQRT
112  STO 03
113  XEQ 14
114  R^
115  RCL 03
116  RCL 05
117  RCL 04
118  RTN
119  LBL 03
120  STO 01
121  X<> Z
122  STO 03
123  X<>Y
124  STO 02
125  XEQ 11
126  STO 06
127  LBL 14
128  RCL 03
129  RCL 02
130  RCL 01
131  XEQ 11
132  STO 05
133  RCL 02
134  RCL 01
135  RCL 03
136  XEQ 11
137  STO 04
138  XEQ 12
139  RCL 06
140  RCL 05
141  RCL 04
142  END

( 172 bytes / SIZE 007 )

-Execution time = 4 seconds

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

Example:      a = 7    B = 50°  C = 24°

     1  ENTER^
    24  ENTER^
    50  ENTER^
     7   XEQ "ABC"  >>>>   A = 106°   RDN   b = 5.5784   RDN   c = 2.9619   RDN   Area = 7.9413

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

Example:   a = 7   b = 5   C = 20°

    2   ENTER^
   20  ENTER^
    5   ENTER^
    7   XEQ "ABC"  >>>>  A = 123.3867°   RDN   B = 36.6133°   RDN   c = 2.8673   RDN   Area = 5.9854
 

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

Example:      a = 7  b = 6  c = 5

    3   ENTER^
    5   ENTER^
    6   ENTER^
    7   XEQ "ABC"  >>>>   A = 78.4630°   RDN   B = 57.1217   RDN   C = 44.4153°   RDN   Area = 14.6969
 

4°) Fourth case: 2 sides and one adjacent angle known
 
 
      STACK        INPUTS    OUTPUTS1   OUTPUTS2
           T             4           area         area'
           Z             B             C           C'
           Y             b             c           c'
           X             a             A           A'

Example:       a = 7   b = 5   B = 37°

    4   ENTER^
   37  ENTER^
    5   ENTER^
    7   XEQ "ABC" >>>>   A =   57.4094°   RDN    b = 8.2836   RDN   C = 85.5906°    RDN   Area = 17.4482
            R/S            >>>>  A' = 122.5906°   RDN   b' = 2.8973   RDN   C' = 20.4094°   RDN   Area' =  6.1027

Notes:   -In cases 1-2-3 ,  T-register input = the number of known sides.
            -In the 4th case , there are 2 solutions if  B<90° and b < a  ( Otherwise, the second solution contains negative numbers which are meaningless ).
          -This program may be called as a subroutine but in the 4th case , add   FC?C 01   after line 59
      and  XEQ "ABC" with flag F01 clear to obtain the first solution  and another time with flag F01 set to obtain the second solution.
 
 
 

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