Default Values and Tolerance for Symbolic Evaluation

Your students' responses to symbolic questions are evaluated by substituting numeric values for each variable in the answer key and in your students' responses. If the answer key and response are equivalent to within a specified tolerance for all three values, the answer is considered correct. You can change both the default values and the tolerance that are used when evaluating responses to your symbolic questions.

Understanding Default Values and Tolerance

By default, the following three numeric values are substituted for each variable in your answer key and in your students' responses:

  • 0.123456789012
  • 0.345678901234
  • 0.890123456789

For each of these values, your student's response is compared to the answer key. If the response and the key are within the specified tolerance — by default, 0.001 — for every value, the response is considered to be correct.

For example, if the correct answer to your question is x2 + 1 and your student submitted 2x2 + 1, the response and the answer key would be compared for three values of x, as illustrated in the following graph and table.

visual example of question described above

Value of x (rounded)

Value of Answer Key (x2 + 1)

Value of Response (2x2 + 1)

Difference

0.1235

1.0152

1.0305

0.0152

0.3457

1.1195

1.2390

0.1195

0.8901

1.7923

2.5846

0.7923

Although at the first comparison point, the difference between the answer and the student's response seems small — 0.0152 — this difference is much greater than the default tolerance of 0.001, so the response is marked incorrect. In this example, because the key and response contained only one variable, only three values were checked.

When the key or response contains multiple variables, each value is substituted for each variable so every combination of values is checked. This is illustrated in the following table.

Value of x (rounded)

Value of y (rounded)

Value of Answer Key 2(x2 + y2)

Value of Response (x2 + y2)

Difference

0.1235

0.1235

0.0610

0.0305

-0.0305

0.1235

0.3457

0.2695

0.1347

-0.1347

0.1235

0.8901

1.6151

0.8076

-0.8076

0.3457

0.1235

0.2695

0.1347

-0.1347

0.3457

0.3457

0.4780

0.2390

-0.2390

0.3457

0.8901

1.8236

0.9118

-0.9118

0.8901

0.1235

1.6151

0.8076

-0.8076

0.8901

0.3457

1.8236

0.9118

-0.9118

0.8901

0.8901

3.1693

1.5846

-1.5846

The number of comparisons that are performed between the answer key and response increases exponentially with the number of variables used in the key.

Best Practice Use four or fewer variables in your questions.

Although the default values used for evaluating symbolic questions might seem to be arbitrary, they work well for a wide variety of questions. How and why you might need to change the default values or tolerance — such as for absolute-value questions — are discussed in the following sections.

Changing the Default Values for Symbolic Evaluation

To change the values WebAssign substitutes for variables in your answer key and your students' responses, you set the array variable $DEFAULTVALS to the values you want to use. 

Best Practice Use four or fewer values for each variable in your questions.

To set values:

Prepend this to your answer key:

Notes

As a list

<EQN $DEFAULTVALS=[a, b, c];''>

For example:

<EQN $DEFAULTVALS=[1.23,-3.45];''>x:x^2+1

If you specify only one list, the values are substituted only for the first variable in your answer key and your students' responses. Additional variables use the default values.

As a range of integers

<EQN $DEFAULTVALS=[a..b];''>

For example:

<EQN $DEFAULTVALS=[3..6];''>x:x^2+1

If you specify only one range, the values are substituted only for the first variable in your answer key and your students' responses. Additional variables use the default values.

Differently for different variables

<EQN $DEFAULTVALS=[[a, b, c],[a, b, c]];''>

or

<EQN $DEFAULTVALS=[[a..b],[a..b]];''>

For example:

<EQN $DEFAULTVALS=[[-3,1],[-2,2]];''>x,y:x^2+y^2

or

<EQN $DEFAULTVALS=[[-3..1],[-2..2]];''>x,y:x^2+y^2

The first set of values is substituted for the first declared variable, the second set for the second variable, and so on.

You must explicitly declare the variables in your answer key. See Create Answer Keys for Questions Using Symbolic Mode.

Only for specific variables

<EQN $DEFAULTVALS=[[],[a, b, c]];''>

or

<EQN $DEFAULTVALS=[[],[a..b]];''>

For example:

<EQN $DEFAULTVALS=[[-3,1],[]];''>x,y:x^2+y^2

or

<EQN $DEFAULTVALS=[[],[-2..2]];''>x,y:x^2+y^2

Specify an empty list [] for any variable for which you would like to use the default values.

You must explicitly declare the variables in your answer key. See Create Answer Keys for Questions Using Symbolic Mode.

Changing the Tolerance for Symbolic Evaluation

To change the tolerance WebAssign uses when comparing your answer key and your students' responses, you set the variable $MAXERR to the tolerance you want to use.

To set the tolerance:

Add this to your answer key:

Notes

As a numeric value

<EQN $MAXERR=value;''>

For example:

<EQN $MAXERR=0.01;''>

As a percent of the evaluated answer key

<EQN $MAXERR='n%';''>

For example:

<EQN $MAXERR='0.1%';''>

Enclose the percent string in single quotation marks.

Specific situations requiring you to change either the default values or the tolerance are discussed in the following sections.

Changing the Default Values for Absolute-Value Questions

If the answer key for your symbolic question contains the absolute value of an expression containing a variable, you need to ensure that the expression evaluates to both positive and negative values to ensure that your students' responses also include the absolute value notation.

For example, if your answer key is

abs(x+1)

your students could respond with x+1 and still be marked correct, since x+1 evaluates to a positive number for all of the default values. To avoid this situation, you could change your answer key to the following:

<EQN $DEFAULTVALS=[-1.123, 0.345, 0.890]; ''>abs(x+1)

This causes your answer key and your students' responses to be compared not for the default values, but for the values you specified: -1.123, 0.345, and 0.890. With the new values, x+1 evaluates to -0.123, 1.345, and 1.890 and is marked as incorrect, while |x+1| is marked correct.

Changing the Default Values for Factorial Questions

If the answer key for your symbolic question contains the factorial of an expression containing a variable, you need to ensure that the expression evaluates only to natural numbers.

For example, if your answer key is

(x/2)!

x/2 must evaluate to a natural number to correctly compare your students' responses to the answer key. To ensure this, you could change your answer key to the following:

<EQN $DEFAULTVALS=[2, 4, 6]; ''>(x/2)!

This causes your answer key and your students' responses to be compared not for the default values, but for the values you specified: 2, 4, and 6. With the new values, (x/2)! evaluates to 1, 2, and 6.

Changing the Default Values or Tolerance for Questions with Fractions or Exponents

In some symbolic questions with fractions or exponents, the default values can evaluate too close to 0 to distinguish correct and incorrect responses. You must determine from the question itself whether changing the default values or the tolerance will resolve the problem.

For example, if your answer key is

1/(x+100)

Your students could enter 1/(x+110) and still be marked correct because the expression evaluates very close to 0 using the default values. In this case, you could use a couple different approaches.

You could change the default values as in the following answer key:

<EQN $DEFAULTVALS=[-101..-99]; ''>1/(x+100)

Or, you could decrease the tolerance, as in the following answer key:

<eqn $MAXERR=1e-5; ''>1/(x+100)

Consider a different example. If your answer key is

(x/2)^20

Your students could enter (x ÷ 3)20 and still be marked correct because the expression evaluates very close to 0 using the default values.

In this case, the best approach is probably to change the default values so the expression will not evaluate so close to 0. You could change your answer key to the following:

<EQN $DEFAULTVALS=[1.234, 2.346, 8.901]; ''>(x/2)^20