Wednesday, April 6, 2016

Simple Right Triangle Solver: Casio Classpad, TI-84 Plus

Simple Right Triangle Solver:  Casio Classpad, TI-84 Plus



Variables: 
x = length of the base (run)
y = length of the height (rise)
d = length of the diagonal
θ = angle (opposite of side y)

Casio Classpad (fx-CP400):  TRIANGLE

‘Setup

‘Set Decimal answers
SetDecimal

‘Set Degrees
SetDegree

‘Local \\ I use the x and y from the keyboard in combined variable names
Local sx,sy,sd,sθ \\ set up strings to join
Local ch,x,y,d,θ
Local st1,st2,st3,st4,st
ClrText
“x= “ ⇒ sx
“y= “ ⇒ sy
“d= “ ⇒ sd
“θ= “ ⇒ sθ

‘Menu \\ set up output screen text
Print “Triangle Solver”, ColorBlue  \\ color only applies for fx-CP400
Print “ “  \\ to create a blank line
Print “Known Variables”, ColorBlue
Print “θ is opposite of y”
Print “1. x, y”
Print “2. x, d”
Print “3. y, d”
Print “4. θ, x”
Print “5. θ, y”
Print “6. θ, d”
Input ch, “1. x, y 2. x, d  3. y, d 4. θ, x 5. θ, y 6. θ, d”,”Known Variables”

‘Choice 1
If ch=1
Then
Input x, “x=”
Input y, “y=”
√(x^2 + y^2)⇒d
tan^-1(y/x)⇒θ
ExpToStr d,st1  \\ expr to string
ExpToStr θ,st2
StrJoin sd,st1,st3  \\ join strings
StrJoin sθ,st2,st4
IfEnd

‘Choice 2
If ch=2
Then
Input x, “x=”
Input d, “d=”
√(d^2 – x^2)⇒y
tan^-1(y/x)⇒θ
ExpToStr y,st1 
ExpToStr θ,st2
StrJoin sy,st1,st3 
StrJoin sθ,st2,st4
IfEnd

‘Choice 3
If ch=3
Then
Input y, “y=”
Input d, “d=”
√(d^2 – y^2)⇒x
tan^-1(y/x)⇒θ
ExpToStr x,st1 
ExpToStr θ,st2
StrJoin sx,st1,st3 
StrJoin sθ,st2,st4
IfEnd

‘Choice 4
If ch=4
Then
Input θ, “θ=”
Input x, “x=”
x/cos(θ)⇒d
x*tan(θ)⇒y
ExpToStr d,st1 
ExpToStr y,st2
StrJoin sd,st1,st3 
StrJoin sy,st2,st4
IfEnd

‘Choice 5
If ch=5
Then
Input θ, “θ=”
Input y, “y=”
y/sin(θ)⇒d
y/tan(θ)⇒x
ExpToStr d,st1 
ExpToStr x,st2
StrJoin sd,st1,st3 
StrJoin sx,st2,st4
IfEnd

‘Choice 6
If ch=6
Then
Input θ, “θ=”
Input d, “d=”
d*cos(θ)⇒x
d*sin(θ)⇒y
ExpToStr x,st1 
ExpToStr y,st2
StrJoin sx,st1,st3 
StrJoin sy,st2,st4
IfEnd

‘Ending
StrJoin st3,”; “,st
StrJoin st,st4,st
Message st,”Results:”
SetStandard

TI-84 Plus (TI-84 Plus CE):  TRIANGLE

Degree
Menu("2 KNOWN VAR","X,Y",1,"X,D",2,"Y,D",3,"θ,X",4,"θ,Y",5,"θ,D",6)
Lbl 1
Prompt X,Y
√(X²+Y²)→D
tan^-1(Y/X)→θ
Disp "D=",D
Disp "θ=",θ
Stop
Lbl 2
Prompt X,D
√(D²-X²)→Y
tan^-1(Y/X)→θ
Disp "Y=",Y
Disp "θ=",θ
Stop
Lbl 3
Prompt Y,D
√(D²-Y²)→X
tan^-1(Y/X)→θ
Disp "X=",X
Disp "θ=",θ
Stop
Lbl 4
Prompt θ,X
X/cos(θ)→D
X*tan(θ)→Y
Disp "D=",D
Disp "Y=",Y
Stop
Lbl 5
Prompt θ,Y
Y/sin(θ)→D
Y/tan(θ)→X
Disp "D=",D
Disp "X=",X
Stop
Lbl 6
Prompt D,θ
D*cos(θ)→X
D*sin(θ)→Y
Disp "X=",X
Disp "Y=",Y
Stop

Examples:

Case 1:  x = 3.6, y = 4.8; results d = 6, θ ≈ 53.13010°

Case 2: x = 5, d = 10; result y ≈ 8.66025, θ = 60°

Case 3: y = 4, d = 10; result x ≈ 9.16515, θ ≈ 23.57818°

Case 4: θ = 30°, x = 8; result d ≈ 9.23760, y ≈ 4.61880

Case 5: θ = 42°, y = 6; result d ≈ 8.96686, x ≈ 6.66368

Case 6: θ = 37.6°, d = 8.88; result x ≈ 7.03553, y ≈ 5.41809

This blog is property of Edward Shore, 2016




Fun with the HP 30b

Fun with the HP 30 b Introduction The following programs are for the HP 30b Business Professional. Did you know that the 30b...