http://webwork.maa.org/wiki/SampleProblem2
where does Part 1 get its correct answer that's fed into the ANS function for this part?
The initialization for Part 1 is:
Context()->variables->add(t=>'Real'); $a = random(2,9,1); $func = Formula("cos($a t)"); $funcDeriv = $func->D('t'); $m = $funcDeriv->eval(t=>2); $y0 = $func->eval(t=>2); $line = Formula("$m (t - 2) + $y0");The question asks :
Find the equation of the line tangent to \(f(t) = $func\) at \(t=2\). \(y = \) \{ ans_rule(35) \}In the answer section, what's used is:
ANS( $funcDeriv->cmp() );As I understand it, the correct answer here with which the student's answer is compared turns out to be the derivative at t = 2 and NOT the right-hand side of the equation y = ... for the tangent line there. Shouldn't the answer be checked, instead, by the following?
ANS( $line->cmp() );What don't I understand here?
(WeBWorK newbie trying to grok all this!)