Give correct answers symbolically |
topic started 10/1/2001; 8:53:49 PM last post 10/1/2001; 8:53:49 PM |

Arnold K. Pizer - Give correct answers symbolically 10/1/2001; 8:53:49 PM (reads: 801, responses: 0) |

When we have a FAQ, this should be included. Q. How can I get WeBWorK to give correct numerical answers symbolically when a student selects Show Correct Answer? For example if the question is "Find the derivative of sin(2x) at x=3", how can I get WeBWorK to display the answer as cos(2*3)*2 or 2*cos(6)?
A. Suppose the real question is to find the derivative of
sin(${a1}x) at x= $b1 where for this particular student $a1 = 2 and $b1 = 3. Then writing $ans = cos($a1*$b1)*$a1;WeBWorK will display 1.92034057330073 as the correct answer. Writing $ans = "cos($a1*$b1)*$a1";WeBWorK will display cos(2*3)*2 as the correct answer. Writing $c1 =$a1*$b1;WeBWorK will display 2*cos(6) as the correct answer. Precisely how WeBWorK displays the correct answer is determined by the answer evaluator being called. All of WeBWorK's answer evaluators for numerical data call NUM_CMP which functions as above. Note that the above only effects how WeBWorK displays the correct answer. In all cases, the student could enter their answer in any form they wish, e.g. 1.92, 2cos(6), etc. |