Previous page Next page Navigation bar

Programs

Physics Programs

Right Triangle Solution

Summary Description

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:

Is compatible CFX-9850G

Compatible with CFX-9850G

Is compatible FX-7400G

Compatible with FX-7400G

Detailed Description

The RTTRI program computes all measurements of a right triangle, given any two sides or any one side and any one acute angle.

Parts of the triangle, labeled 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.

Usage

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.

Screen shot 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.

Screen shot 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.

Screen shot 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.

Usage Variations

Entering Angles In Other Angular Units

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).

Entering Angles In Degrees, Minutes, and Seconds

Screen shot 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”.

Displaying Degrees, Minutes, and Seconds

Screen shot 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.

Program

Source Code

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.0End of line operator
"Angles in"End of line operator
If 1°=1End of line operator
Then "degrees"End of line operator
Else If 1r=1End of line operator
Then "radians"End of line operator
Else "grads"End of line operator
IfEndEnd of line operator
IfEndEnd of line operator
0→A~EEnd of line operator
DoEnd of line operator
"0:Done"End of line operator
"1:Leg1 3:Ang12:Leg2 4:Ang25:Hypot"?→FEnd of line operator
If F=1End of line operator
Then DoEnd of line operator
"Leg 1"?→AEnd of line operator
LpWhile A<0End of line operator
IfEndEnd of line operator
If F=2End of line operator
Then DoEnd of line operator
"Leg 2"?→BEnd of line operator
LpWhile B<0End of line operator
IfEndEnd of line operator
If F=3End of line operator
Then DoEnd of line operator
"Angle 1"?→DEnd of line operator
LpWhile (D<0)+(D≥90°)End of line operator
IfEndEnd of line operator
If F=4End of line operator
Then DoEnd of line operator
"Angle 2"?→EEnd of line operator
LpWhile (E<0)+(E≥90°)End of line operator
IfEndEnd of line operator
If F=5End of line operator
Then DoEnd of line operator
"Hypot"?→CEnd of line operator
LpWhile C<0End of line operator
IfEndEnd of line operator
LpWhile F≠0End of line operator
(A≠0)+(B≠0)+(C≠0)→FEnd of line operator
(D≠0)+(E≠0)→GEnd of line operator
If ((F=0)+(F+G<2))=0End of line operator
Then If A=0End of line operator
Then If B=0End of line operator
Then If D=0End of line operator
Then Csin E→AEnd of line operator
Else Ccos D→AEnd of line operator
IfEndEnd of line operator
Else If C=0End of line operator
Then If D=0End of line operator
Then Btan E→AEnd of line operator
Else B÷tan D→AEnd of line operator
IfEndEnd of line operator
Else √(C2-B2)→AEnd of line operator
IfEndEnd of line operator
IfEndEnd of line operator
IfEndEnd of line operator
If B=0End of line operator
Then If C=0End of line operator
Then If D=0End of line operator
Then A÷tan E→BEnd of line operator
Else Atan D→BEnd of line operator
IfEndEnd of line operator
Else √(C2-A2)→BEnd of line operator
IfEndEnd of line operator
IfEndEnd of line operator
If C=0End of line operator
Then √(A2+B2)→CEnd of line operator
IfEndEnd of line operator
If D=0End of line operator
Then sin-1 (B÷C)→DEnd of line operator
IfEndEnd of line operator
If E=0End of line operator
Then sin-1 (A÷C)→EEnd of line operator
IfEndEnd of line operator
"Leg 1"End of line operator
ADisplay operator
"Leg 2"End of line operator
BDisplay operator
"Angle 1"End of line operator
DDisplay operator
"Angle 2"End of line operator
EDisplay operator
"Hypot"End of line operator
CEnd of line operator
Else "Not enough information"End of line operator
IfEnd

Programming Notes

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 ]

Previous page Top of page Next page Navigation bar

Copyright © 2006 Brian Hetrick
Page last updated 22 January 2006.

Brian’s Casio Calculator Corner

Home

Programs

Index

Linkage Conventions

Mathematics

Finance

Physics

Index

Vector Sum

Right Triangle

Newton’s Law

Uniform Acceleration

Ohm’s Laws

Utility

Tutorial

Puzzles

Site Information

Your Privacy

Site Map

E-mail

Site Technical Data