WeBWorK Problems

Error Message Based on Inputs

Re: Error Message Based on Inputs

by Alex Jordan -
Number of replies: 0

I'm not sure what would explain the errors before, but once you are using PGML, you can declare answers using the [_]{$answer}{width} method that is in the code that I posted, and you don't need to use the ANS() routine. In that code, each answer was the same $multians object, but you can add more things.

The "$answer" in what I wrote above can be a MathObject or some string that can be passed to Compute() thereby creating a MathObject. But it can also be a MathObject's cmp, except that to avoid syntax issues I usually store that as something before the statement part of the question.

You should be able to add the following to the setup portion from before:

$Frxcmp = $FRx->cmp->withPostFilter(AnswerHints(-$FRx => ["Check the sign of your answer",score=>.25]));

$Frycmp = $FRy->cmp->withPostFilter(AnswerHints(-$FRy => ["Check the sign of your answer",score=>.25]));

$Frzcmp = $FRz->cmp->withPostFilter(AnswerHints(-$FRz => ["Check the sign of your answer",score=>.25]));

And then within the PGML, have things like:

[_]{$Frxcmp}{10}