Tutorial:  Setting Margin of Tolerance in Non-numeric Questions

Note: Use the Question Bank Editor on-screen dialog boxes for setting the margin of error in numeric and numeric-with-unit questions.

 

For an introduction to the concept of margin of error, see Controlling Answer Tolerance.

 

For basic information on the system plus or minus operator, "?", see Setting a Margin of Error in Non-numeric Questions.

Absolute Errors

 

You can specify an absolute error using the ? operator.

x ? y represents x +/- y.

 

Example 1

2.12 ? 0.01

specifies a margin of error of +/- 0.01 in the answer. The answer matches any response between 2.11 and 2.13 (inclusive). For example, the system grades 2.114 or 2.123456789, as well as 2.11 and 2.13, correct.

 

Example 2

2.1J ? 0.25J

specifies a margin of error of +/- 0.25J. The system grades correct any response between 1.85J and 2.35J. The error must have the same dimension as the correct answer.

 

Example 3

cos(pi/6) ? 1000

specifies a margin of error of +/- 1000. The system grades correct any response between cos(pi/6)-1000 and cos(pi/6)+1000, approximately between -999.1339746 and 1000.866025.

Percentage Errors

 

You can also specify a percentage error using the ? operator.

x (1 ? y) represents x +/- x*y.

 

Example 4

1.52 (1 ? 0.025)

specifies a margin of error of 2.5%. The system grades correct any response between 1.444 and 1.596.

 

Example 5

50 (1 ? 1.1)

specifies a margin of error of 110%. The system grades correct any response between -5 and 105.

 

Algorithmic Variables

 

You can use a margin of error with answers that are algorithmic variables. Consider a question in which the correct answer is assigned to $answer.

 

Note: The ? operator cannot be used in an algorithmic variable definition (or other algorithmic statement).

 

Example 6

To specify an absolute margin of error of 0.1, use:

$answer ? 0.1

 

Example 7

To specify a percentage margin of error of 3%, use:

$answer (1 ? 0.03)

 

Using the ? Operator in Complex Expressions

 

You can use the ? operator in complex expressions. It is an arithmetic operator.

 

Example 8

2.12?0.01

matches any response between 2.11 and 2.13 and

2*(2.12?0.01)

matches any response between 4.22 and 4.26.

 

Example 9

The ordinary rules of arithmetic (for example, the distributive rule) apply.

2*(2.12?0.01)

is equivalent to:

(2*2.12)?(2*0.01)

 

Example 10

You can specify very complicated ranges of numbers.

((2.17 ? 0.01) + e^(1.07?2.03))/(1? 0.5)

 

Important: If the exact answer is an expression, not a simple formula, number, or variable, ensure that you use parentheses to generate the correct answer.

Example 11

2 + 2 * (1 ? 0.05)

which defines a tolerance of 5% of 2, is different from:

(2 + 2) * (1 ? 0.05)

which defines a tolerance of 5% of the sum 4.

 

See Also:

Answer Tolerance Example Script

Controlling Answer Tolerance