What I'm looking for is the ability to evaluate the trig functions at these angles, and spit out an exact value answer to display as the correct answer to students.
If I do
$ans = Compute("-sin($theta1)*x + cos($theta2)*y");
then the correct answer displayed to students looks like
-sin(pi/4)*x + cos(pi/4)*y
Adding
$ans->reduce;
replaces the trig functions with decimal values.
Does anyone have a slick way to replace, for example, sin(pi/3) with sqrt(3)/2 in an algorithmic way (i.e. handle pi/6, pi/4, pi/3, etc. systematically)? So far the only thing I've come up with is creating a hash for each of sin and cos with all of the possibilities.
Thanks,
Danny