Page tree
Skip to end of metadata
Go to start of metadata

 The task type Formula comparison is a special text entry interaction, which allows for the insertion of formulas as well as for the subsequent automatic formula comparison, including assessment and feedback.

As the learner is expected to enter a formula, you can optionally enable the Check formula function. The learner would then be able to validate whether the entered syntax is correct. In addition, you can also activate a formula preview.

For this task type, advanced assessment options (MAXIMA expert mode) are possible.

A licence is required to use this question type.

Example task - Formula comparison

Define questions and answers

Enter your question in the input field. The gaps for the solution input can be defined within the text. Any number of gaps can be created. A more detailed description of how to create gaps within a text can be found in the help section Text entry interaction.

Step by step

In the following, the creation of a calculation interaction is explained by means of an example.

Step 1: Design the task

The properties of a circle should be calculated. The learner is expected to specify the formulas for the calculation of the circumference, the surface area, and the diameter.

Task in the user view

Step 2: Create the question

In the tab Question & Answer, enter the question in the text field. Just click on the gap symbol  or create a new gap using the button Add gap.

Edit task in the editor

Step 3: Specify the correct solution

Enter your formula in MAXIMA notation in the field Solution under Edit gap. In the example, the solution is the formula for the calculation of the circumference of a circle: u=2*%pi*r.

Edit gap in the editor

Further MAXIMA notation examples:

  • E=m*c^2: Insert operators between any two variables (e.g. "m*c" instead of "mc").
  • %e^%i*%pi=cos(alpha)+%i*sin(alpha): Mathematical constants are entered with a preceding % (e. g. %e, %pi). Logarithmic functions can be written as usual (e. g. sin(1), cos(1)).

Step 4: Enable formula check (optional)

With the function Check formula, the participant can check the validity of their input. The entered formula is validated with MAXIMA. Select Show syntax errors to allow the participant to verify whether their entered formula is syntactically correct.

You can also allow the participant to preview the formula. The formula will be displayed via MathJax (LaTeX).

Task assessment in the expert mode

For the assessment of a task of the type formula comparison, extended options are available in the expert mode.

The expert mode allows for the manipulation of the MAXIMA comparison operators: 

Example: For a given function, the derivative should be calculated. The solution is not obvious!

Task in the expert mode

Possible answers:

Example: Both the given and the correct answer are not directly compared, but their derivatives.

Editor view

Each parent function is accepted as correct solution.

Sample solutions to the task in the expert mode

ONYX provides two different comparison options:

  1. True/false comparison with the standard expression
  2. Points-based comparison with the standard expression if is(equal(ev(LEARNERRESPONSE),ev(CORRECTRESPONSE))) then MAXSCORE else MINSCORE;

Select comparison option:

Configuration of the comparison options in the editor

In the text field Assessment (MAXIMA), you can adjust the MAXIMA command. To do so, you can use the following variables:

  • LEARNERRESPONSE (the participant's answer for this gap)
  • CORRECTRESPONSE (solution for this gap)
  • MAXSCORE (maximum points for this gap)
  • MINSCORE (minimum points for this gap, usually 0)
  • Access to other gaps is possible via the attachment of their ID, e. g. LEARNERRESPONSE_GAP_1. The gap's ID can be found in the edit window of the gap, in the lower right corner.


The true/false comparison only works when MAXIMA returns a Boolean value.

A numerical value, i. e. the score that is bounded by the given minimum and maximum points, can be returned if the points-based option is used.