WeBWorK Problems

Implicit Planes in nonstandard form

Implicit Planes in nonstandard form

by Alex Jordan -
Number of replies: 1
Is it possible to make ImplicitPlane objects display literally as they were input? I would expect
$ans = Compute("x+1=2");

to leave $ans as an ImplicitPlane object that will display as "x+1=2", and not as "x=1". And indeed it does in the body of a problem. However if I proceed this way, then in the answer checking, $ans->cmp gives errors. Specifically, errors like:
ERRORS from evaluating PG file:
 No such package 'Value::Equality' at line 72 of (eval 15141)
I can resolve this error by declaring $ans to be ImplicitPlane("x+1=2"), instead of using Compute, but then the object is altered to display as "x=1". I would settle for using two different objects, with one created using Compute and the other using ImplicitPlane, except that the one that goes in to the answer checker is the one used to create the string for the Correct Answer field of the results table. And we'd like that to remain "x+1=2" (even if "x=1" is an acceptable student answer.)

In reply to Alex Jordan

Re: Implicit Planes in nonstandard form

by Alex Jordan -
I think I have solved this issue. If say $mo->{correct_ans} is something like the string x+1=2/3, then I think I can use contextTypeset.pl to create Formula($mo->{correct_ans}), which in this case should output as the string x+1=\frac{2}{3}, and I will use this as the correct_ans_latex_string in the answer checker.

I'm not sure that this workaround should be necessary if everything is working as intended. Generally Compute("xyz") crates an object where something very close to the literal xyz will show up as the correct answer. But in the case of ImplicitPlanes, while correct_ans seems to follow this principle, correct_ans_latex_string does not.