Formula Answers - PGML

From WeBWorK_wiki
Revision as of 10:49, 12 May 2015 by Dpvc (talk | contribs) (Initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Formula Answer Checkers

To use a formula as an answer, put the formula in quotation marks inside braces after the answer blank:

 BEGIN_PGML
 The square root of [:x:] is written [__________]{"sqrt(x)"}
 END_PGML

Note that the quotation marks are required, so don't forget them.

The formula can be stored in a variable:

 $a = 3; $b = 5;
 $answer = "$a + $b x";
 
 BEGIN_PGML
 The formula is [______]{$answer}
 END_PGML

The formula can be a MathObject Formula as well

 $a = 3; $b = 5;
 $answer = Compute("$a + $b x");
 
 BEGIN_PGML
 The formula is [______]{$answer}
 END_PGML

See the section on MathObject Answers for details on how to provide additional control over the MathObject answer checkers.