Difference between revisions of "Answer Checker Options (MathObjects)"
m |
|||
(7 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | The action of a MathObjects answer checker can be modified by passing options to the <code>cmp()</code> method. For example: |
+ | The action of a [[Answer Checkers (MathObjects)| MathObjects answer checker]] can be modified by passing options to the <code>cmp()</code> method. For example: |
ANS(Real(pi)->cmp(showTypeWarnings => 0)); |
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). |
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 === |
=== Options common to all answer checkers === |
||
Line 11: | Line 12: | ||
{| class="wikitable" |
{| class="wikitable" |
||
! Option !! Description !! style="padding:5px" | Default |
! Option !! Description !! style="padding:5px" | Default |
||
− | |- style="vertical-align: top" |
||
+ | |||
+ | |- style="vertical-align: top" id="showTypeWarnings" |
||
| style="white-space: nowrap; padding: 5px" | <code>showTypeWarnings => 1</code> or <code>0</code> |
| style="white-space: nowrap; padding: 5px" | <code>showTypeWarnings => 1</code> or <code>0</code> |
||
| style="padding: 5px" | Show/don't show messages about student answers not being of the right type. |
| style="padding: 5px" | Show/don't show messages about student answers not being of the right type. |
||
− | | style="text-align:center" | 1 |
+ | | style="text-align:center" | <code>1</code> |
− | + | ||
+ | |- style="vertical-align: top" id="showEqualErrors" |
||
| style="white-space: nowrap; padding: 5px" | <code>showEqualErrors => 1</code> or <code>0</code> |
| style="white-space: nowrap; padding: 5px" | <code>showEqualErrors => 1</code> or <code>0</code> |
||
| style="padding: 5px" | Show/don't show messages produced by trying to compare the professor and student values for equality, e.g., conversion errors between types. |
| style="padding: 5px" | Show/don't show messages produced by trying to compare the professor and student values for equality, e.g., conversion errors between types. |
||
− | | style="text-align:center" | 1 |
+ | | style="text-align:center" | <code>1</code> |
− | + | ||
+ | |- style="vertical-align: top" id="ignoreStrings" |
||
| style="white-space: nowrap; padding: 5px" | <code>ignoreStrings => 1</code> or <code>0</code> |
| style="white-space: nowrap; padding: 5px" | <code>ignoreStrings => 1</code> or <code>0</code> |
||
| style="padding: 5px" | Show/don't show type mismatch errors produced by strings (so that <code>NONE</code> will not cause a type mismatch in a checker looking for a list of numbers, for example). |
| style="padding: 5px" | Show/don't show type mismatch errors produced by strings (so that <code>NONE</code> will not cause a type mismatch in a checker looking for a list of numbers, for example). |
||
− | | style="text-align:center" | 1 |
+ | | style="text-align:center" | <code>1</code> |
− | + | ||
+ | |- style="vertical-align: top" id="studentsMustReduceUnions" |
||
| style="white-space: nowrap; padding: 5px" | <code>studentsMustReduceUnions => 1</code> or <code>0</code> |
| style="white-space: nowrap; padding: 5px" | <code>studentsMustReduceUnions => 1</code> or <code>0</code> |
||
| style="padding: 5px" | Controls whether or not students answers are allowed to include overlapping, redundant, or uncombined intervals. |
| style="padding: 5px" | Controls whether or not students answers are allowed to include overlapping, redundant, or uncombined intervals. |
||
− | | style="text-align:center" | 1 |
+ | | style="text-align:center" | <code>1</code> |
− | + | ||
+ | |- style="vertical-align: top" id="showUnionReduceWarnings" |
||
| style="white-space: nowrap; padding: 5px" | <code>showUnionReduceWarnings => 1</code> or <code>0</code> |
| style="white-space: nowrap; padding: 5px" | <code>showUnionReduceWarnings => 1</code> or <code>0</code> |
||
| style="padding: 5px" | Do/don't show warnings for unreduced unions. This includes warnings about overlapping sets, uncombined intervals (like <code>(0,1] U [1,infinity]</code>), and repeated elements in sets. |
| style="padding: 5px" | Do/don't show warnings for unreduced unions. This includes warnings about overlapping sets, uncombined intervals (like <code>(0,1] U [1,infinity]</code>), and repeated elements in sets. |
||
− | | style="text-align:center" | 1 |
+ | | style="text-align:center" | <code>1</code> |
+ | |||
+ | |- style="vertical-align: top" id="cmp_class" |
||
+ | | style="white-space: nowrap; padding: 5px" | <code>cmp_class => "a thing"</code> |
||
+ | | style="padding: 5px" | Specifies the name to use in error messages (like type warnings) to identify the type of object the student is expected to enter. |
||
+ | | style="text-align:center" | the object's class name |
||
+ | |||
|} |
|} |
||
+ | |||
=== Options for Individual MathObject Classes === |
=== Options for Individual MathObject Classes === |
||
Line 37: | Line 40: | ||
In addition to these, the individual MathObject types have their own options. These are documented in the individual pages for the various [[:Category:MathObject_Classes| MathObject classes]], linked below: |
In addition to these, the individual MathObject types have their own options. These are documented in the individual pages for the various [[:Category:MathObject_Classes| MathObject classes]], linked below: |
||
− | * '''[[Real_(MathObject_Class)| Real]]''' class |
+ | * '''[[Real_(MathObject_Class)#Answer_Checker| Real]]''' class |
− | * '''[[Infinity_(MathObject_Class)| Infinity]]''' class |
+ | * '''[[Infinity_(MathObject_Class)#Answer_Checker| Infinity]]''' class |
− | * '''[[Complex_(MathObject_Class)| Complex]]''' class |
+ | * '''[[Complex_(MathObject_Class)#Answer_Checker| Complex]]''' class |
− | * '''[[Point_(MathObject_Class)| Point]]''' class |
+ | * '''[[Point_(MathObject_Class)#Answer_Checker| Point]]''' class |
− | * '''[[Vector_(MathObject_Class)| Vector]]''' class |
+ | * '''[[Vector_(MathObject_Class)#Answer_Checker| Vector]]''' class |
− | * '''[[Matrix_(MathObject_Class)| Matrix]]''' class |
+ | * '''[[Matrix_(MathObject_Class)#Answer_Checker| Matrix]]''' class |
− | * '''[[List_(MathObject_Class)| List]]''' class |
+ | * '''[[List_(MathObject_Class)#Answer_Checker| List]]''' class |
− | * '''[[Interval_(MathObject_Class)| Interval]]''' class |
+ | * '''[[Interval_(MathObject_Class)#Answer_Checker| Interval]]''' class |
− | * '''[[Set_(MathObject_Class)| Set]]''' |
+ | * '''[[Set_(MathObject_Class)#Answer_Checker| Set]]''' class |
− | * '''[[Union_(MathObject_Class)| Union]]''' class |
+ | * '''[[Union_(MathObject_Class)#Answer_Checker| Union]]''' class |
− | * '''[[String_(MathObject_Class)| String]]''' class |
+ | * '''[[String_(MathObject_Class)#Answer_Checker| String]]''' class |
− | * '''[[Formula_(MathObject_Class)| Formula]]''' class |
+ | * '''[[Formula_(MathObject_Class)#Answer_Checker| Formula]]''' class |
+ | |||
+ | === Changing the Default Options === |
||
+ | |||
+ | You can set the default options for each MathObject class using the <code>cmpDefaults</code> 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 <code>ignoreStrings</code> and <code>ignoreInfinity</code> 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 <code>cmp()</code> call. |
||
<br> |
<br> |
||
[[Category:MathObjects]] |
[[Category:MathObjects]] |
||
+ | [[Category:Reference Tables]] |
Latest revision as of 22:04, 19 January 2014
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:
- Real class
- Infinity class
- Complex class
- Point class
- Vector class
- Matrix class
- List class
- Interval class
- Set class
- Union class
- String class
- Formula class
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.