Category:PGML Answers

From WeBWorK
Jump to: navigation, search

Answer Checking in PGML

Answer blanks in PGML are indicated by [___________] where the number of underscores determines the width of the answer blank on screen. Usually, the answer is tied to the blank by enclosing it in braces following the answer blank. (If not, you will need to use ANS() outside the PGML code to provide an answer checker for the blank.) For example:

 $f = Formula("sin(x)+x^2");
 $Df = $f->D;
 If [:f(x) = [$f]:], then [:f'(x) = :] [______________________]{$Df}

produces a problem that displays a formula and asks for its derivative.

The answer you provide can be given in a variety of formats. It can be a number or a variable containing a number, a string that represents a MathObject to be used as the answer or a variable holding a MathObject, or a number of other possible values. These are described below.


follow us