"ArithmeticResult" (Comparison Method)
"ArithmeticResult" (Comparison Method)
Compare mathematical expressions in a way suitable for exercises about arithmetic, allowing rearrangement but not arithmetic computation.
Details
- The arithmetic comparison method considers two mathematical expressions to be equivalent if they match without doing any arithmetic operations, e.g. 1 + 1 2.
- Answers are considered correct when the only differences are ordering of terms inside orderless operations like addition and multiplication.
- The values of the key and answer can both be specified as held expressions Hold[expr] to prevent evaluation. Even when the values are held, reordering transformations are performed to determine equivalence during assessment. It is recommended to always hold the answer.
- To require the order of terms in orderless operations to match the order of the answer key, use the "OrderlessMatch" setting: AssessmentFunction[key,<|"ComparisonMethod""ArithmeticResult","OrderlessMatch"False|>].
- Values in "ArithmeticResult" answer keys are patterns and support Blank expressions.
- The following table shows a comparison of "ArithmeticResult" with other comparison methods for a typical answer key of 2x+8 and several possible submitted answers:

Examples
open all close allBasic Examples (1)
Create an AssessmentFunction for an arithmetic question:
Non-computed addition is considered inequivalent and incorrect:
Scope (3)
Properties & Relations (1)
Create an assessment function for an addition pattern with the order specified:
Answers must match the pattern, including the order of terms:
With the "HeldExpression" comparison method, this is not possible. Using Hold in the answer key does not support patterns:
Using HoldPattern supports pattern matching but allows reordering:
See Also
AssessmentFunction QuestionObject Hold
Question Interface Types: ShortAnswer MultipleShortAnswers
Comparison Methods: PolynomialResult CalculusResult AlgebraicValue HeldExpression