Create Answer Keys for Questions Using Algebraic Mode with Mathematica

To write answer keys and grading expressions for questions that use Algebraic mode with Mathematica®, you must know how to write Mathematica expressions. In addition, you should be aware of the following WebAssign-specific considerations. 

Specifying Math Variables in Answer Keys

Although not always required, you can declare your math variables at the beginning of the answer key in a comma-delimited list ending with a colon, as in the following example.

x_1, y_1, x_2, y_2: sqrt((x_1-x_2)^2 + (y_1-y_2)^2) 
Best Practice Declare your variables to ensure that WebAssign interprets your answer key exactly as you intend.

Variable names in answer keys must observe the following conventions:

  • Variable names must start with a letter.
  • Variable names must include only letters, numbers, and underscores; underscores in variable names indicate subscripting.
  • Variable names are case-sensitive; X is different from x.
  • Variable names should not duplicate the names of functions or of the numeric value pi.
  • Variables having the names of Greek letters are displayed in mathPad and calcPad as the corresponding Greek letters. Greek letters except for π are treated as variables. The letter π is treated as a constant.
  • The variable e can be used, but it will be treated as both Euler's number and as a variable name, so either response is marked correct.

The following table lists some examples.

Math Notation

Answer Key Notation


Be sure that your question identifies any variables that the student should use in the answer.

Specifying Perl Variables in Answer Keys

If you have defined a Perl variable for use in your answer key — for example, to randomize numeric values in your question — always enclose it with the <EQN> tag as in the following example:

<EQN $d>x + <EQN $e>

To avoid confusion, use different names for Perl variables and math variables in your question.

Creating Mathematica Expressions

Most, but not all, Mathematica expressions are valid in WebAssign. Any expression that works in the WebAssign Mathematica tool will work in your question.