MathObject Answers - PGML

From WeBWorK_wiki
Revision as of 08:39, 13 May 2015 by Dpvc (talk | contribs) (Initial section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Answers from MathObejcts

When you specify an answer following an answer blank and provide a number or a swing containing a formula, PGML turns your answer into a MathObject (essentially by passing it to Compute()). So you can provide any sort of MathObject-based answer by enclosing it in quotation marks. For example,

 The interval from 0 to 1 excluding 0 but
 including 1 is written: [___________]{"(0,1]"}

provides an answer that is an interval. The answer is parsed in the current context, which is the Interval context in this example. This means that you are giving the answer exactly as the student will.

Instead of using quotation marks, you can use a MathObject creator function, like Real() or Matrix() if you prefer.

 As a complex number, [: sqrt(-1) :] is written [__________]{Complex(0,1)}

If the determination of the answer involves computations, however, it may be more convenient to produce a MathObject earlier in the problem and pass that to PGML. You can do that by putting the variable that holds the math object into the braces following the answer blank.

 $p = Point(0,2), $q = Point(1,-1);
 $v = Vector($q-$p);
 A vector from [`[$p]`] to [`[$q]`] is [______________]{$v}

Passing Options to Answer Checkers

Answer Arrays

MultiAnswer Checkers

Custom Checkers