Skip to content
Classroom

Math Entry Settings

Math entry settings control how a student's typed or palette-entered math expression is evaluated against the correct answer. These settings are configured per answer part.

Answer Comparison Methods

Method When to use
Numerical Evaluate both expressions to a number and compare within tolerance
Algebraic Check symbolic equivalence (e.g., x+1 = 1+x)
Exact Require the student's expression to match character-for-character (for string questions)

For most numeric and calculated questions, Numerical is the default.

Tolerance

For numerical comparison, set a tolerance to allow small rounding differences:

  • Absolute tolerance — e.g., ±0.001 means the student's answer must be within 0.001 of the correct value
  • Relative tolerance — e.g., ±0.1% means within 0.1% of the correct value
// In the answer settings panel, or in code:
$tolerance = 0.001;    // absolute
$tolerance = "0.1%";   // relative

Choose relative tolerance for large numbers (where absolute differences are meaninglessly small) and absolute tolerance for answers near zero.

Allowed Answer Forms

Control which equivalent forms are accepted:

Setting Effect
Accept decimal 0.5 accepted for 1/2
Accept fraction 1/2 accepted for 0.5
Require simplified 2/4 rejected, only 1/2 accepted
Accept mixed number 1 1/2 accepted for 3/2

Units (Physics/Chemistry Questions)

For questions that require units, you can: - Accept the numeric value and check units separately (two answer parts) - Use the ifansunit() feedback macro to give specific feedback when units are missing

Implicit Multiplication

By default, 2x is interpreted as 2*x. To require explicit multiplication signs, disable implicit multiplication in the question settings.

Answer Previews

Students see a formatted preview of their answer as they type. You can configure what the preview shows:

  • MathJax (default) — fully formatted math
  • Plain text — the raw AsciiMath string (useful for debugging question setup)

Common Configuration Examples

Rounding to 2 decimal places:

$ans = round($a / $b, 2);
// Set tolerance to 0.005 (half a unit in the last place)

Accepting equivalent fractions:

$num = 3;
$den = 4;
// Enable "accept equivalent fractions" in settings
// Students can enter 3/4, 6/8, 0.75, etc.

Exact integer:

$ans = $a * $b;
// Set tolerance to 0 for an exact integer answer

Algebraic expression:

$ans = "$a*x^2 + $b*x + $c";
// Use algebraic comparison mode
// 2x^2+3x+1 == x^2*2+x*3+1 (commutative/associative equivalence)