Spherical Triangle Solver: Programmed on a TI84+ C Silver Edition
This could easily be ported to other programming calculators given how basic the TI84+ programming is.
Variables:
"Sides" (Subtending Angles): X, Y, Z
Corresponding Angles: A, B, C
I try to capture all possible traps. No guarantees by I try. This program is rather large, about 1,500 bytes. Ending quotes and parenthesis can be left out on the TI84+ but I present them in the text for completeness.
PROGRAM: SPHTRI
: Lbl 0
: ClrHome
: Output(1,1,"ANGLE (θ),SIDE")
: Output(2,1,"A, X")
: Output(3,1,"B, Y")
: Output(4,1,"C, Z")
: Output(6,1,"PRESS ENTER TO GO ON")
: Pause
: ClrHome
: Menu("KNOWN:","3 SIDES",1,
"2 S,INT θ (X,Y,C)",2,
"2 S,EXT θ (Y,Z,B)",3,
"1 S,2 ADJ θ (Z,A,B)",4,
"2 θS, ADJ SIDE (X,A,B)",5,
"3 ANGLES", 6
"EXIT",7)
: Lbl 1
: Input "SIDE X:", X
: Input "SIDE Y:", Y
: Input "SIDE Z:", Z
: If X+Y+Z>360°
: Then
: Disp "NO SOLN"
: Pause
: Goto 0
: End
: cos^1 (( cos(X)  cos(Y) cos(Z) )/( sin(Y) sin(Z) )→ A
: cos^1 (( cos(Y)  cos(X) cos(Z) )/( sin(X) sin(Z) )→ B
: cos^1 (( cos(Z)  cos(X) cos(Y) )/( sin(X) sin (Y) )→ C
: Disp "A,B,C:",A,B,C
: Pause
: Goto 0
: Lbl 2
: Input "SIDE X:", X
: Input "SIDE Y:", Y
: Input "θ BETWEEN C:", C
: cos^1 ( cos(X) cos(Y) + sin(X) sin(Y) cos(C) ) → Z
: sin^1 ( sin(C) sin(X) / sin(Z) ) → A
: sin^1 ( sin(C) sin(Y) / sin(Z) ) → B
: Disp "Z,A,B:",Z,A,B
: Pause
: Goto 0
: Lbl 3
: Input "SIDE Y:", Y
: Input "CORR. θ B:", B
: Input "ADJ. SIDE Z:", Z
: If Y < sin^1 (sin(Z) sin(B) )
: Then
: Disp "NO SOLN."
: Pause
: Goto 0
: End
: sin^1 ( sin(Z) sin(B) / sin(Y) ) → C
: 2 tan^1 ( tan(.5Y  .5Z) sin(.5B + .5C) / sin(.5B  .5C) ) → X
: 2 tan^1 ( sin(.5Y  .5Z) / tan(.5B  .5C) / sin(.5Y + .5Z) ) → A
: Disp "C,X,A:",C,X,A
: Pause
: If Y
: 180°  C → S
: 2 tan^1 (tan(.5Y  .5Z) sin(.5B + .5C) / sin(.5B  .5C) ) → T
: 2 tan^1 (sin(.5Y  .5Z) / tan(.5B  .5S) / sin(.5Y + .5Z) ) → U
: Disp "ALT C,X,A:",S,T,U
: Pause
: End
: Goto 0
: Lbl 4
: Input "θ A:", A
: Input "θ B:", B
: Input "SIDE BETWEEN Z:", Z
: cos^1 ( sin(A) sin(B) cos(Z)  cos(A) cos(B) ) → C
: cos^1 ( (cos(A) + cos(B) cos(C)) / (sin(B) sin(C)) → X
: cos^1 ( (cos(B) + cos(A) cos(C)) / (sin(A) sin(C)) → Y
: Disp "C,X,Y:",C,X,Y
: Pause
: Goto 0
: Lbl 5
: Input "θ A:", A
: Input "CORR. SIDE X:", X
: Input "ADJ θ B:", B
: sin^1 (sin(X) sin(B) / sin(A) ) → Y
: 2 tan^1 (tan(.5X.5Y) sin(.5A+.5B) / sin(.5A.5B)) → Z
: 2 tan^1 (sin(.5X.5Y) / tan(.5A.5B) / sin(.5X+.5Y)) → C
: Disp "Y,C,Z:", Y,C,Z
: Pause
: Goto 0
: Lbl 6
: Input "θ A:", A
: Input "θ B:", B
: Input "θ C:", C
: If A+B+C<180° or A+B+C>540°
: Then
: Disp "NO SOLN."
: Goto 0
: Pause
: End
: Prompt A,B,C
: cos^1 ((cos(A) + cos(B) cos(C))/(sin(B) sin(C)) → X
: cos^1 ((cos(B) + cos(A) cos(C))/(sin(A) sin(C))→ Y
: cos^1 ((cos(C) + cos(A) cos(B))/(sin(A) sin(B)) → Z
: Disp "X,Y,Z:",X,Y,Z
: Pause
: Goto 0
: Lbl 7
Sources:
Wikipedia: Solutions of Triangles
http://en.wikipedia.org/wiki/Solution_of_triangles#Solving_spherical_triangles
Had To Know: Spherical Trigonometry Calculator
http://www.had2know.com/academics/sphericaltrigonometrycalculator.html
Examples  in Degrees Mode:
1. Given 3 Sides:
X: 34.49°
Y: 28.11°
Z: 29.00°
Solutions:
A: 76.64274255°
B: 54.05239674°
C: 56.40782913°
2. Given 2 Side with Interior Angle
X: 5.58°
Y: 7.24°
C: 164°
Solutions:
Z: 12.69684035°
A: 7.004143971°
B: 9.093527785°
3. Given 2 Sides with Exterior (Adjacent) Angle:
Y: 14.41°
B: 77.97°
Z: 18.00°
No Solution
Y: 7.09°
B: 44.8°
Z: 6.36°
Solutions:
C: 39.22735167°
X: 10.02551866°
A: 96.36477875°
4. Given 1 side and 2 adjacent angles
A: 75°
B: 88°
Z: 4.53°
Solutions:
C: 17.58132838°
X: 14.62939892°
Y: 15.14817154°
5. Given 2 Angles and 1 adjacent side
A: 103°
X: 2.66°
B: 71°
Solutions:
Y: 2.581182188°
C: 6.006268443°
Z: .2855550692°
6. Given 3 interior angles
A: 89°
B: 66°
C: 70°
Solutions:
X: 79.49157643°
Y: 63.94337829°
Z: 67.52897419°
This blog is property of Edward Shore. 2013
A blog is that is all about mathematics and calculators, two of my passions in life.
Friday, July 5, 2013
Spherical Triangle Solver  TI84+
Subscribe to:
Post Comments (Atom)
Fun with the FX603P Emulator
Fun with the FX603P Emulator Author for the Emulator: Martin Krischik Link to Emulator (Android): https://play.goo...

Casio fx991EX Classwiz Review Casio FX991EX The next incarnation of the fx991 line of Casio calculators is the fx991 EX. ...

One of the missing features of the TI82/83/84 family is the ability to convert between bases. Here are two programs in TIBasic to help...

HP Prime: Basic CAS Commands for Polynomials and Rational Expressions Define the following variables: poly: a polynomial o...
No comments:
Post a Comment