# "AlgebraicValue"(Comparison Method)

Compare mathematical expressions in a way suitable for exercises demanding algebraic solutions, allowing computation that does not include operations of algebra.

# Details

• The algebra solution comparison method considers two expressions to be equivalent if they are mathematically equal without performing any solving operations, e.g. Solve, SolveValues, Fit, Reduce, etc.
• The values of the key and answer can both be specified as held expressions with Hold[expr] to maintain the values exactly as provided. However, even when the values are held, evaluation of non-algebra functions (i.e. excluding Solve and similar functions) is performed during assessment. It is recommended to always hold the answer.
• "AlgebraicValue" assessments accept the setting "OptionalResultName" for specifying the variable of interest in a question: AssessmentFunction[key,<|"ComparisonMethod""AlgebraicValue","OptionalResultName"var|>]
• When "OptionalResultName"var is included, any of the following forms are accepted as correct for an answer ans:
•  ans Hold[var=ans] Hold[var==ans] varans
• The supported options values of var include:
•  var accept the variable var in the submitted result False (default) only match answers provided as ans True attempt to infer var from the key

# Examples

open allclose all

## Basic Examples(1)

Create an AssessmentFunction for an algebra question:

Use it to assess an equivalent form of the answer:

## Scope(4)

Create an assessment function to find where a line intersects a circle:

Define code that finds a solution:

The code is not marked as correct because it contains algebraic solving code:

Allowing the code to evaluate to a correct answer before assessment gives a correct marking:

Calculate a solution to an equation:

Create an assessment that accepts alternate forms of answers containing the variable x as the result name:

The regular answer does not need to include the variable name that is searched for:

The alternate forms accepted are:

The use of any other variable name results in a false assessment:

The variable name can be inferred from the answer key if it uses any of the allowed alternate forms:

The variable name needs not to figure in the answer:

Compute the solution to an equation reduction problem:

Define an assessment function:

Multiple forms of the correct answer are accepted:

The original question is not accepted as an answer:

## Applications(3)

Create a QuestionObject for an algebra problem with multiple correct answers:

Create a QuestionObject for a geometry question:

Create a polynomial solving problem including a plot to help find values. Setting "OptionalResultName" allows flexibility in the accepted answer forms:

## Properties & Relations(3)

Evaluation for operations not considered to be algebra occurs even when the answer is held:

When values are held, global definitions are ignored during assessment:

Global definitions may also conflict with the name specified for the "OptionalResultName", if the variable is not held:

Wrap the variable into Hold or HoldPattern to ignore the global definition:

"AlgebraicValue" method allows functions, like Plus, that do not solve algebraic problems to evaluate:

Functions that do solve algebraic problems do not evaluate and are marked incorrect:

"CalculusResult" allows the algebraic solving functions to evaluate:

## Possible Issues(1)

Create an answer key using Solve for multiple variables:

Creating an AssessmentFunction with the default "ListAssessment" setting treats each list in the key as a single answer:

Only answers identical to the keys are considered as correct:

Even with the setting "OptionalResultName"True, values without variable names are marked as incorrect:

Instead, use "AllElementsOrderless" or "AllElementsOrdered" as the "ListAssessment" setting to assess each subvalue independently:

Each individual element of the key and answer is matched separately, and the "OptionalResultName" setting works as expected:

Mathematically equivalent results that differ only by arithmetic are accepted:

To provide answers using an equal sign, use Hold to prevent setting values: