Triangle Solutions for the HP-41
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
Program listing
Data Registers: R00 = Area
R01 = a R04 =
A
R02 = b R05 =
B
R03 = c R06 =
C
Flags: /
Subroutines: /
01 LBL "ABC"
02 GTO IND T 03 LBL 11 04 ENTER^ 05 X^2 06 R^ 07 ST* Z 08 X^2 09 + 10 R^ 11 X^2 12 - 13 X<>Y 14 ST+ X 15 / 16 ACOS 17 RTN 18 LBL 12 19 RCL 02 20 RCL 03 21 * 22 RCL 04 23 SIN 24 * 25 2 26 / 27 STO 00 28 RTN 29 LBL 04 |
30 STO 01
31 X<>Y 32 STO 02 33 / 34 X<>Y 35 STO 05 36 SIN 37 * 38 ASIN 39 LBL 13 40 STO 04 41 RCL 05 42 + 43 1 44 CHS 45 ACOS 46 X<>Y 47 - 48 STO 06 49 SIN 50 RCL 05 51 SIN 52 / 53 RCL 02 54 * 55 STO 03 56 XEQ 12 57 RCL 06 58 RCL 03 |
59 RCL 04
60 RTN 61 1 62 CHS 63 ACOS 64 RCL 04 65 - 66 GTO 13 67 LBL 01 68 STO 01 69 X<> Z 70 STO 06 71 X<>Y 72 STO 05 73 + 74 1 75 CHS 76 ACOS 77 X<>Y 78 - 79 STO 04 80 SIN 81 / 82 STO 02 83 RCL 06 84 SIN 85 * 86 STO 03 87 RCL 05 |
88 SIN
89 ST* 02 90 XEQ 12 91 RCL 03 92 RCL 02 93 RCL 04 94 RTN 95 LBL 02 96 STO 01 97 X^2 98 X<>Y 99 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.