- Code: Select all
SineRule[a_, A_, b_, B_] := N[Solve[a/Sin[A] == b/Sin[B], x][[1, 1, 2]]]
The students just enter in the unknown side or angle as x.
But, with this code the angle results are in radians which my students aren't familiar with. So I wrote this code to convert the radians to degrees if it's an angle they're looking for:
- Code: Select all
SineRule[a_, A_, b_, B_] := If[a == x || b == x, N[Solve[a/Sin[A] == b/Sin[B], x]][[1, 1, 2]], N[Solve[a/Sin[A] == b/Sin[B], x][[1, 1, 2]] 180/\[Pi]]]
Now when I use this to solve a missing side it's fine.
But when I use it for an unknown angle it just splits the code back at me:
- Code: Select all
If[24.5==x\[Or]16==x,N[Solve[24.5/sin(80 \[Degree])==16/sin(x),x]][[1,1,2]],N[(180 Solve[24.5/sin(80 \[Degree])==16/sin(x),x][[1,1,2]])/\[Pi]]]
Love some input on what I'm doing wrong here.
