Programs: |
RTTRI |
||||
Version: |
2.0, 20 January 2006 |
||||
Description: |
The RTTRI program computes all measurements of a right triangle, given any two sides or any one side and any acute angle. |
||||
Compatibility: |
|
The RTTRI program computes all measurements of a right triangle, given any two sides or any one side and any one acute angle.
Triangles have three sides and three angles; right triangles are
by definition triangles with one angle being a right angle.
The side that is not one of the sides forming the right angle is
called the hypotenuse.
The other two sides are here called side 1 and side
2.
The acute angles formed by side 1 and the hypotenuse is here
called angle 1; similarly with side 2 and angle
2.
This arrangement is shown in the diagram to the right.
The length of any two sides determines all other aspects of the right triangle. Also, the length of any one side and the measure of either Angle 1 or Angle 2 determines all other aspects of the right triangle. The program uses the appropriate trigonometric relations to compute the unknown factors of the right triangle from the known factors.
Enter the RTTRI program into the calculator, using either the calculator data cable or entering the program directly.
Choose a unit of linear measure, and convert all known distances (Hypotenuse, Side 1, and Side 2) into this unit. The distances in the solution will be expressed in this unit.
Choose a unit of angular measure (degrees, grads, or radians), and convert all known angles (Angle 1 and Angle 2) into this unit. Use the calculator’s SET UP menu to set the calculator to use this unit. The angles in the solution will be expressed in this unit.
Run the program.
The program will report the unit of angular measurement in use, by displaying a message such as “Angles in degrees” or “Angles in radians.” If the unit is incorrect, halt the program execution and return to choosing a unit of angular measure.
The program will display the prompt “0:Done 1:Leg1 2:Leg2
3:Ang1 4:Ang2 5:Hypot,” and pause for you to input a code.
Enter the known factors of the triangle by first entering the
appropriate code (1 for Leg 1, 2 for Leg 2, 3 for Angle 1, 4 for
Angle 2, and 5 for the Hypotenuse), then entering the
factor’s value.
The program displays one of the prompts “Leg 1,”
“Leg 2,” “Angle 1,” “Angle 2,”
or “Hypot” after you enter the code for the value
and before you enter the value itself.
This two-step process of identifying the data to be entered,
then entering the data, is indicated in the screen shot to the
right.
The program applies range checking to individual values: angles must be between 0 (inclusive) and a right angle (exclusive), and lengths must be non-negative. If you enter a value outside of the range for the factor you are entering, the program will repeat the prompt for the factor and you must enter the correct value. The program will accept 0 for any factor value; this indicates the factor is unknown. However, the program does not check for consistency among the factors entered: if you describe an impossible triangle (with the hypotenuse shorter than one of the sides, for example), the program will produce incorrect results.
If you enter an incorrect value for a factor, you can enter the factor again with the correct value. The most recently entered factor value is the value that is used. If you enter an incorrect factor code, you must correct the value corresponding to the value code you used; the value 0 for a factor indicates the value is unknown.
When you have entered all the known factor values, use the code
0 to indicate that entry of the factor values is complete.
The program will then compute and display the various factor
values.
The program will display the factors as Side 1, Side 2, Leg 1,
Leg 2, and Hypot (for Hypotenuse).
The display of values is shown in the screen shot to the right.
If you have not entered enough information for the program to
determine the unknown factors of the triangle, the program will
display the message “Not enough information.”
This message is shown in the screen shot to the left.
As with any time an angle is entered, you can enter the angle in any of degrees, grads, or radians, regardless of the angular measurement unit in use by the calculator. On the FX-7400G, press OPTN, the right arrowhead key, and F2 (ANGL) to choose the angle menu. Enter the angle in degrees followed by F1 (°), or in radians followed by F2 (r), or in grads followed by F3 (g). On the CFX-9950G, press OPTN, F6 (the right arrowhead), and F5 (ANGL) to choose the angle menu. Enter the angle in degrees followed by F1 (°), or in radians followed by F2 (r), or in grads followed by F3 (g).
As with any time an angle in degrees is entered, you can enter
the angle in degrees, minutes, and seconds.
On the FX-7400G, press OPTN, the right arrowhead key, and F2
(ANGL) to choose the angle menu, and the right arrowhead key.
This displays the degree, minutes, and seconds menu.
Enter the degrees part of the angle, followed by F1
(°’”), followed by the minutes part of the
angle, followed by F1 (°’”), followed by the
seconds part of the angle, followed by F1 (°’”).
On the CFX-9850G, press OPTN, F6 (the right arrowhead), and F5
(ANGL) to choose the angle menu.
Enter the degrees part of the angle, followed by F4
(°’”), followed by the minutes part of the
angle, followed by F4 (°’”), followed by the
seconds part of the angle, followed by F4 (°’”).
The use of this technique is indicated in the display by a
superscript square, similar to the superscript degree sign.
Note that you can combine this technique with the previous
technique to enter an angle in degrees, minutes, and seconds,
even when the unit of angular measurement is not degrees:
follow the last press of the °’” key with the
° key (you may need to press the arrowhead key to get to
the appropriate part of the menu).
The screen shot to the right shows the entry of the angle
15°07’22.03”.
As with any time a value in degrees is displayed, you can
convert the value into degrees, minutes, and seconds.
On the FX-7400G, press OPTN, the right arrowhead key, F2
(ANGL) to choose the angle menu, the right arrowhead key, and
F2 (°’” with a bar over it) to choose the
inverse degrees, minutes, and seconds operation.
On the CFX-9850G, press OPTN, F6 (the right arrowhead), and
F5 (ANGL) to choose the angle menu, and F5
(°’” with a bar over it) to choose the
inverse degrees, minutes, and seconds operation.
This converts the fractional degrees into minutes and
seconds.
This is shown in the screen shot to the right.
The programs are available in a ZIP file, or may be entered as shown below. Remember that this program is copyrighted; see the copyright issues page for limitations on redistribution.
Program RTTRI (699 bytes):
'RTTRI 2.0![]()
"Angles in"![]()
If 1°=1![]()
Then "degrees"![]()
Else If 1r=1![]()
Then "radians"![]()
Else "grads"![]()
IfEnd![]()
IfEnd![]()
0→A~E![]()
Do![]()
"0:Done"![]()
"1:Leg1 3:Ang12:Leg2 4:Ang25:Hypot"?→F![]()
If F=1![]()
Then Do![]()
"Leg 1"?→A![]()
LpWhile A<0![]()
IfEnd![]()
If F=2![]()
Then Do![]()
"Leg 2"?→B![]()
LpWhile B<0![]()
IfEnd![]()
If F=3![]()
Then Do![]()
"Angle 1"?→D![]()
LpWhile (D<0)+(D≥90°)![]()
IfEnd![]()
If F=4![]()
Then Do![]()
"Angle 2"?→E![]()
LpWhile (E<0)+(E≥90°)![]()
IfEnd![]()
If F=5![]()
Then Do![]()
"Hypot"?→C![]()
LpWhile C<0![]()
IfEnd![]()
LpWhile F≠0![]()
(A≠0)+(B≠0)+(C≠0)→F![]()
(D≠0)+(E≠0)→G![]()
If ((F=0)+(F+G<2))=0![]()
Then If A=0![]()
Then If B=0![]()
Then If D=0![]()
Then Csin E→A![]()
Else Ccos D→A![]()
IfEnd![]()
Else If C=0![]()
Then If D=0![]()
Then Btan E→A![]()
Else B÷tan D→A![]()
IfEnd![]()
Else √(C2-B2)→A![]()
IfEnd![]()
IfEnd![]()
IfEnd![]()
If B=0![]()
Then If C=0![]()
Then If D=0![]()
Then A÷tan E→B![]()
Else Atan D→B![]()
IfEnd![]()
Else √(C2-A2)→B![]()
IfEnd![]()
IfEnd![]()
If C=0![]()
Then √(A2+B2)→C![]()
IfEnd![]()
If D=0![]()
Then sin-1 (B÷C)→D![]()
IfEnd![]()
If E=0![]()
Then sin-1 (A÷C)→E![]()
IfEnd![]()
"Leg 1"![]()
A![]()
"Leg 2"![]()
B![]()
"Angle 1"![]()
D![]()
"Angle 2"![]()
E![]()
"Hypot"![]()
C![]()
Else "Not enough information"![]()
IfEnd
The program detects the angular units in use by the calculator by checking the results of an angular measurement conversion. The ° operator converts a value in degrees into the angular measure in use by the calculator. Thus, if 1° has the value 1, the calculator is set to use degrees; and similarly for the r operator, 1r, and radians.
The program produces a full-width multi-line prompt by writing an overlength string to the screen. The calculator wraps the string after each line has been filled. On a calculator with wider screens (such as the FX-9750G or CFX-9850G), the program must be changed to explicitly break lines in the multi-line prompt.
The program tests for multi-variable conditions by using arithmetic on the results of comparison operations. The comparison operators return 0 for false conditions, and 1 for true conditions; the various control constructs regard zero as false and non-zero as true. This permits multiplication to be used as an equivalent to logical and, and addition to be used as an equivalent to logical or.
[ Previous page | Top of page | Next page ]
Copyright © 2006 Brian Hetrick
Page last updated 22 January 2006.