Answer Checker Options (MathObjects)

From WeBWorK
Jump to: navigation, search

The action of a MathObjects answer checker can be modified by passing options to the cmp() method. For example:

   ANS(Real(pi)->cmp(showTypeWarnings => 0));

will prevent the answer checker from reporting errors due to the student entering the wrong type of answer (say a vector rather than a number).


Options common to all answer checkers

There are a number of options common to all the checkers:

Option Description Default
showTypeWarnings => 1 or 0 Show/don't show messages about student answers not being of the right type. 1
showEqualErrors => 1 or 0 Show/don't show messages produced by trying to compare the professor and student values for equality, e.g., conversion errors between types. 1
ignoreStrings => 1 or 0 Show/don't show type mismatch errors produced by strings (so that NONE will not cause a type mismatch in a checker looking for a list of numbers, for example). 1
studentsMustReduceUnions => 1 or 0 Controls whether or not students answers are allowed to include overlapping, redundant, or uncombined intervals. 1
showUnionReduceWarnings => 1 or 0 Do/don't show warnings for unreduced unions. This includes warnings about overlapping sets, uncombined intervals (like (0,1] U [1,infinity]), and repeated elements in sets. 1
cmp_class => "a thing" Specifies the name to use in error messages (like type warnings) to identify the type of object the student is expected to enter. the object's class name


Options for Individual MathObject Classes

In addition to these, the individual MathObject types have their own options. These are documented in the individual pages for the various MathObject classes, linked below:

Changing the Default Options

You can set the default options for each MathObject class using the cmpDefaults field of the Content. To set the options for the Real class, for example, use

   Context()->{cmpDefaults}{Real} = {ignoreStrings => 0, ignoreInfinity => 0};

This will force the ignoreStrings and ignoreInfinity values to be set to 0 automatically for all answer checkers formed from Real MathObjects. These values can still be overridden by explicitly setting the option on the cmp() call.


follow us