Context flags

From WeBWorK
(Difference between revisions)
Jump to: navigation, search
(Context Flags List)
(Context Flags List)
Line 39: Line 39:
 
;checkUndefinedPoints
 
;checkUndefinedPoints
 
:default: 0
 
:default: 0
: Usage: $context->flags->set(checkUndefinedPoints=>1);
+
: Usage: <code>$context-&gt;flags-&gt;set(checkUndefinedPoints=&gt;1);</code>
 
: Description: If the answer to a question is a formula, then checkUndefinedPoints allows possible test points at which to compare the student answer with the correct answer to be points where the correct answer is undefined. For example, a student answer of ln(|x|) when the correct answer is ln(x) may be accepted as correct if checkUndefinedPoints=&gt;0 since all test points would be positive numbers and may not if checkUndefinedPoints=&gt;1 since some test points may not be positive.
 
: Description: If the answer to a question is a formula, then checkUndefinedPoints allows possible test points at which to compare the student answer with the correct answer to be points where the correct answer is undefined. For example, a student answer of ln(|x|) when the correct answer is ln(x) may be accepted as correct if checkUndefinedPoints=&gt;0 since all test points would be positive numbers and may not if checkUndefinedPoints=&gt;1 since some test points may not be positive.
 
: See also: limits, max_undefined
 
: See also: limits, max_undefined
Line 46: Line 46:
 
;granularity
 
;granularity
 
:default: 1000
 
:default: 1000
:Usage: $context-&gt;flags-&gt;set(granularity=&gt;5000);
+
: Usage: <code>$context-&gt;flags-&gt;set(granularity=&gt;5000);</code>
 
:Description: If the answer to a question is a formula, then granularity sets the minimum distance between possible test points at which to compare the student answer with the correct answer. The distance is determined by dividing the length of the interval specified by limits by granularity. In our example, with the default limits, the check points would be no closer than 4/5000.  
 
:Description: If the answer to a question is a formula, then granularity sets the minimum distance between possible test points at which to compare the student answer with the correct answer. The distance is determined by dividing the length of the interval specified by limits by granularity. In our example, with the default limits, the check points would be no closer than 4/5000.  
 
:See also: limits, num_points, resolution
 
:See also: limits, num_points, resolution
 
;ignoreEndpointTypes
 
;ignoreEndpointTypes
 
:default: 0
 
:default: 0
:Usage: $context-&gt;flags-&gt;set(ignoreEndpointTypes=&gt;1);
+
: Usage: <code>$context-&gt;flags-&gt;set(ignoreEndpointTypes=&gt;1);</code>
 
:Description: If the answer to a question is an interval, the default value of ignoreEndpointTypes is set so that the inclusion or exclusion of endpoints in the students answer needs to match the correct answer to be correct. In our example, if we set ignoreEndpointTypes=&gt;1, a student answer will be correct provided the interval is correct regardless of endpoints.  
 
:Description: If the answer to a question is an interval, the default value of ignoreEndpointTypes is set so that the inclusion or exclusion of endpoints in the students answer needs to match the correct answer to be correct. In our example, if we set ignoreEndpointTypes=&gt;1, a student answer will be correct provided the interval is correct regardless of endpoints.  
 
:See also:
 
:See also:
 
;ijk
 
;ijk
 
:default: 0
 
:default: 0
:Usage: $context-&gt;flags-&gt;set(ijk=&gt;1);
+
: Usage: <code>$context-&gt;flags-&gt;set(ijk=&gt;1);</code>
 
:Description: ijk=&gt;1 will cause the output of all vectors to be written in ijk format rather than &lt;...&gt; format. The default setting will output vectors in &lt;...&gt; format.
 
:Description: ijk=&gt;1 will cause the output of all vectors to be written in ijk format rather than &lt;...&gt; format. The default setting will output vectors in &lt;...&gt; format.
 
;infiniteWord
 
;infiniteWord
Line 62: Line 62:
 
;limits
 
;limits
 
:default: [-2 , 2]
 
:default: [-2 , 2]
:Usage: $context-&gt;flags-&gt;set(x=&gt;{limits=&gt;[-1,1]});
+
: Usage: <code>$context-&gt;flags-&gt;set(x=&gt;{limits=&gt;[-1,1]});</code>
 
:Description: If the answer to a question is a formula in the variable x, this sets the interval over which the values of x are selected to compare the student's entered formula to the correct formula.
 
:Description: If the answer to a question is a formula in the variable x, this sets the interval over which the values of x are selected to compare the student's entered formula to the correct formula.
 
:See also: resolution, granularity, num_points
 
:See also: resolution, granularity, num_points
Line 69: Line 69:
 
;max_undefined
 
;max_undefined
 
:default:
 
:default:
:>Usage: $context-&gt;flags-&gt;set(max_undefined=&gt;1);
+
: Usage: <code>$context-&gt;flags-&gt;set(max_undefined=&gt;1);</code>
 
:Description: If the answer to a question is a formula, and we have allowed undefined test points at which to compare the student answer with the correct answer, max_undefined specifies the maximum number of possible test points where the correct answer is undefined. In our example, max_undefined=&gt;1 means that at most one test can be taken as a point where the correct answer is undefined.
 
:Description: If the answer to a question is a formula, and we have allowed undefined test points at which to compare the student answer with the correct answer, max_undefined specifies the maximum number of possible test points where the correct answer is undefined. In our example, max_undefined=&gt;1 means that at most one test can be taken as a point where the correct answer is undefined.
 
:See also: checkUndefinedPoints
 
:See also: checkUndefinedPoints
 
;num_points
 
;num_points
 
:default: 5
 
:default: 5
:Usage: $context-&gt;flags-&gt;set(num_points=&gt;5);
+
: Usage: <code>$context-&gt;flags-&gt;set(num_points=&gt;5);</code>
 
:Description: If the answer to a question is a formula in the variable x, this sets the number of values of x are selected to compare the student's entered formula to the correct formula.
 
:Description: If the answer to a question is a formula in the variable x, this sets the number of values of x are selected to compare the student's entered formula to the correct formula.
 
:See also: limits, granularity, resolution
 
:See also: limits, granularity, resolution
Line 91: Line 91:
 
;resolution  
 
;resolution  
 
:default:  
 
:default:  
:Usage: $context-&gt;flags-&gt;set(resolution=&gt;1/2);
+
: Usage: <code>$context-&gt;flags-&gt;set(resolution=&gt;1/2);</code>
 
:Description: If the answer to a question is a formula, then beginning at the left endpoint of the limits, this sets the spacing between possible test points at which to compare the student answer with the correct answer. In our example, with the default limits, the only possible check points will be -2,-1.5,-1,-.5,0,.5,1,1.5,2.  
 
:Description: If the answer to a question is a formula, then beginning at the left endpoint of the limits, this sets the spacing between possible test points at which to compare the student answer with the correct answer. In our example, with the default limits, the only possible check points will be -2,-1.5,-1,-.5,0,.5,1,1.5,2.  
 
:See also: limits, granularity, num_points
 
:See also: limits, granularity, num_points
Line 98: Line 98:
 
;tolType=
 
;tolType=
 
:default: relative
 
:default: relative
:Usage: $context-&gt;flags-&gt;set(tolType=&gt;'relative');
+
: Usage: <code>$context-&gt;flags-&gt;set(tolType=&gt;'relative');</code>
 
:Description: Sets tolerance type as relative or absolute for student answers. The actual result of this depends on the value of tolerance. If tolType is relative, with the default value for tolerance our example would set the answer tolerance to 0.1% of the correct answer. If tolType is absolute, with the default value for tolerance our example would set the answer tolerance to within 0.001 of the absolute value of the correct answer.
 
:Description: Sets tolerance type as relative or absolute for student answers. The actual result of this depends on the value of tolerance. If tolType is relative, with the default value for tolerance our example would set the answer tolerance to 0.1% of the correct answer. If tolType is absolute, with the default value for tolerance our example would set the answer tolerance to within 0.001 of the absolute value of the correct answer.
 
:See also: tolerance
 
:See also: tolerance
 
;tolerance
 
;tolerance
 
:default: 0.001
 
:default: 0.001
:Usage: $context-&gt;flags-&gt;set(tolerance=&gt;.00001);
+
: Usage: <code>$context-&gt;flags-&gt;set(tolerance=&gt;.00001);</code>
 
:Description: Sets tolerance for student answers. The actual result of this depends on the value of tolType. The default value of tolType is relative and under this setting our example would set the answer tolerance to 0.001% of the correct answer.
 
:Description: Sets tolerance for student answers. The actual result of this depends on the value of tolType. The default value of tolType is relative and under this setting our example would set the answer tolerance to 0.001% of the correct answer.
 
:See also: tolType
 
:See also: tolType
Line 111: Line 111:
 
:default: 1
 
:default: 1
 
;zeroLevel:default: 1e-14
 
;zeroLevel:default: 1e-14
:Usage: $context-&gt;flags-&gt;set(zeroLevel=&gt;.00001);
+
: Usage: <code>$context-&gt;flags-&gt;set(zeroLevel=&gt;.00001);</code>
 
:Description: If the value of an answer is less in absolute value than the zeroLevel, then zeroLevelTol is the absolute tolerance used for student answers. Under this example, any answer whose absolute value is smaller than the 0.00001 is considered correct if it is within the value of zeroLevelTol of the correct answer.
 
:Description: If the value of an answer is less in absolute value than the zeroLevel, then zeroLevelTol is the absolute tolerance used for student answers. Under this example, any answer whose absolute value is smaller than the 0.00001 is considered correct if it is within the value of zeroLevelTol of the correct answer.
 
:See also: zeroLevelTol, tolerance, tolType
 
:See also: zeroLevelTol, tolerance, tolType
 
;zeroLevelTol
 
;zeroLevelTol
 
:default: 1e-12
 
:default: 1e-12
:Usage: $context-&gt;flags-&gt;set(zeroLevelTol=&gt;.00001);
+
: Usage: <code>$context-&gt;flags-&gt;set(zeroLevelTol=&gt;.00001);</code>
 
:Description: If an answer is smaller in absolute value than zeroLevel, then this sets the absolute tolerance for the student answer. Under this example, any answer whose absolute value is smaller than zeroLevel is considered correct if it is within 0.00001 of the correct answer. Note that this is overridden by the absolute tolerance if the tolType is set to absolute.
 
:Description: If an answer is smaller in absolute value than zeroLevel, then this sets the absolute tolerance for the student answer. Under this example, any answer whose absolute value is smaller than zeroLevel is considered correct if it is within 0.00001 of the correct answer. Note that this is overridden by the absolute tolerance if the tolType is set to absolute.
 
:See also: zeroLevel, tolerance, tolType
 
:See also: zeroLevel, tolerance, tolType

Revision as of 19:48, 16 June 2008

Contents

Context Flags

There are a number of values stored in the context that control things
like the tolerance used when comparing numbers, and so on.

Some Available Contexts

  • Numeric (variable x, no Complex, Point, etc.)
  • Complex (variable z, i = ![math]\sqrt{-1}![/math], no points, etc.)
  • Point (another name for Vector context)
    * Vector (variables x, y, z, angle brakets form vectors,
    i, j, k are unit coordinate vectors, etc.)
  • Vector2D (same as Vector, but with i and j in 2D)
  • Matrix (square brakets form matrices)
    * Interval (parens and brakets form intervals)

Context Flags

You control the value of these flags with commands such as:

$context->flags->set(tolerance=>.00001);

For example,

$context->flags->set(ijk=>1);

will cause the output of all vectors to be written in ijk formatrather than <...> format.

Context Flags List

The following list gives each standard context flag along with a description of its use. There are not currently any context specific flags, but this may change. To find out exactly which flags can be set in a specific context and their current value go to HowToListContextFlags

allowBadFunctionInputs
default: 0
allowBadOperands
default: 0
allowEmptyStrings
default: 1
allowMissingFunctionInputs
default: 0
allowMissingOperands
default: 0
allowWrongArgCount
default: 0
checkUndefinedPoints
default: 0
Usage: $context->flags->set(checkUndefinedPoints=>1);
Description: If the answer to a question is a formula, then checkUndefinedPoints allows possible test points at which to compare the student answer with the correct answer to be points where the correct answer is undefined. For example, a student answer of ln(|x|) when the correct answer is ln(x) may be accepted as correct if checkUndefinedPoints=>0 since all test points would be positive numbers and may not if checkUndefinedPoints=>1 since some test points may not be positive.
See also: limits, max_undefined
formatStudentAnswer
default: evaluated
granularity
default: 1000
Usage: $context->flags->set(granularity=>5000);
Description: If the answer to a question is a formula, then granularity sets the minimum distance between possible test points at which to compare the student answer with the correct answer. The distance is determined by dividing the length of the interval specified by limits by granularity. In our example, with the default limits, the check points would be no closer than 4/5000.
See also: limits, num_points, resolution
ignoreEndpointTypes
default: 0
Usage: $context->flags->set(ignoreEndpointTypes=>1);
Description: If the answer to a question is an interval, the default value of ignoreEndpointTypes is set so that the inclusion or exclusion of endpoints in the students answer needs to match the correct answer to be correct. In our example, if we set ignoreEndpointTypes=>1, a student answer will be correct provided the interval is correct regardless of endpoints.
See also:
ijk
default: 0
Usage: $context->flags->set(ijk=>1);
Description: ijk=>1 will cause the output of all vectors to be written in ijk format rather than <...> format. The default setting will output vectors in <...> format.
infiniteWord
default: infinity
limits
default: [-2 , 2]
Usage: $context->flags->set(x=>{limits=>[-1,1]});
Description: If the answer to a question is a formula in the variable x, this sets the interval over which the values of x are selected to compare the student's entered formula to the correct formula.
See also: resolution, granularity, num_points
max_adapt
default: 100000000
max_undefined
default:
Usage: $context->flags->set(max_undefined=>1);
Description: If the answer to a question is a formula, and we have allowed undefined test points at which to compare the student answer with the correct answer, max_undefined specifies the maximum number of possible test points where the correct answer is undefined. In our example, max_undefined=>1 means that at most one test can be taken as a point where the correct answer is undefined.
See also: checkUndefinedPoints
num_points
default: 5
Usage: $context->flags->set(num_points=>5);
Description: If the answer to a question is a formula in the variable x, this sets the number of values of x are selected to compare the student's entered formula to the correct formula.
See also: limits, granularity, resolution
reduceConstantFunctions
default: 1
reduceConstants
default: 1
reduceSets
default: 1
reduceSetsForComparison
default: 1
reduceUnions
default: 1
reduceUnionsForComparison
default: 1
resolution
default:
Usage: $context->flags->set(resolution=>1/2);
Description: If the answer to a question is a formula, then beginning at the left endpoint of the limits, this sets the spacing between possible test points at which to compare the student answer with the correct answer. In our example, with the default limits, the only possible check points will be -2,-1.5,-1,-.5,0,.5,1,1.5,2.
See also: limits, granularity, num_points
showExtraParens
default: 1
tolType=
default: relative
Usage: $context->flags->set(tolType=>'relative');
Description: Sets tolerance type as relative or absolute for student answers. The actual result of this depends on the value of tolerance. If tolType is relative, with the default value for tolerance our example would set the answer tolerance to 0.1% of the correct answer. If tolType is absolute, with the default value for tolerance our example would set the answer tolerance to within 0.001 of the absolute value of the correct answer.
See also: tolerance
tolerance
default: 0.001
Usage: $context->flags->set(tolerance=>.00001);
Description: Sets tolerance for student answers. The actual result of this depends on the value of tolType. The default value of tolType is relative and under this setting our example would set the answer tolerance to 0.001% of the correct answer.
See also: tolType
useBaseTenLog
default: 0
useFuzzyReals
default: 1
zeroLevel
default: 1e-14
Usage: $context->flags->set(zeroLevel=>.00001);
Description: If the value of an answer is less in absolute value than the zeroLevel, then zeroLevelTol is the absolute tolerance used for student answers. Under this example, any answer whose absolute value is smaller than the 0.00001 is considered correct if it is within the value of zeroLevelTol of the correct answer.
See also: zeroLevelTol, tolerance, tolType
zeroLevelTol
default: 1e-12
Usage: $context->flags->set(zeroLevelTol=>.00001);
Description: If an answer is smaller in absolute value than zeroLevel, then this sets the absolute tolerance for the student answer. Under this example, any answer whose absolute value is smaller than zeroLevel is considered correct if it is within 0.00001 of the correct answer. Note that this is overridden by the absolute tolerance if the tolType is set to absolute.
See also: zeroLevel, tolerance, tolType
follow us