"AlgebraicForm" (Comparison Method)
Details
- The algebraic form comparison method considers two mathematical expressions to be equivalent if they do not differ by any algebraic operations, e.g. x+2x3x
- Answers are considered correct when their representation of variables is identical to those in the answer key.
- Answers differing only by ordering of terms or numeric computations like simple arithmetic and distribution of coefficients are considered equivalent.
- The values of the key and answer can both be specified as held expressions Hold[expr] to maintain the values exactly as they were given. Even when the values are held, evaluation of numeric parts is performed within the held values during assessment. It is recommended to always hold the answer.
- By default, any representation of numeric coefficients in a polynomial is considered equivalent. Use the "DistributedCoeffients" setting to control this behavior:
- AssessmentFunction[key,<|"ComparisonMethod""AlgebraicForm","DistributedCoefficients"dist|>]
- Supported values for dist include:
-
All (default) allow any distribution of numeric coefficients None require coefficients to exactly match the key patt allow any distribution of coefficients matching the pattern patt - The following tables show comparisons of "AlgebraicForm" with other comparison methods for typical answer keys and several possible submitted answers:


Examples
open all close allBasic Examples (1)
Create an AssessmentFunction for a question about adding variables:
Use it to assess answers. This is marked correct because the only difference from the answer key is numeric arithmetic:
This is incorrect because the algebraic computation is not completed:
Scope (2)
Create an assessment function for factoring x^2-1:
The original question is not accepted as an answer:
Mathematical expressions differing only in ordering of terms are considered equivalent:
Create a QuestionObject for a square root problem:
Generalizations & Extensions (1)
By default, equivalent distributions of numeric coefficients including square roots are marked correct:
Use "DistributedCoefficients" to disallow all distribution:
Prevent distribution of square roots but allow other numerics:
Factoring a Sqrt[5] is marked incorrect:
See Also
AssessmentFunction ▪ QuestionObject
Question Interface Types: ShortAnswer MultipleShortAnswers TextCompletion
Comparison Methods: ArithmeticResult AlgebraicValue