# Formula Comparison (Text Entry Interaction)

The question 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 question type, advanced assessment options (MAXIMA expert mode) are possible.

A licence is required to use this question type.

Content

Further information

Best practice

## Defining 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: Designing 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.

### Step 2: Creating 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**.

### Step 3: Specifying 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.

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: Enabling the formula check (optional)

The formula comparison question type provides different formula validation levels as well as a formula preview and can be activated by the author in the formula gap settings under **Check formula**.

The following options are available:

**Check automatically (MAXIMA validation):**Entries made by the participant are validated as soon as they leave the input field. Should there be a syntax error, the field is coloured red and a general note is displayed indicating that the input is syntactically incorrect.**Show syntax errors:**In addition to the validation and colouring, the specific syntax error is displayed. The output is realised by MAXIMA.**Allow preview (LaTeX rendering):**This option can be activated in addition to the validation. The button converts the formula to LaTeX and displays it accordingly. The formula display in the browser is based on the LaTeX rendering of the entered one. Technically, the formula input and evaluation is based on CAS MAXIMA. The participant's formula input (MAXIMA format) is converted to LaTeX via the MAXIMA function ‘tex(formula)’ and can thus be displayed in the browser (cf. https://maxima.sourceforge.io/docs/manual/maxima_76.html). Simplification does not appear to be possible.- If no option is selected, then there will be no validation.

The following image shows how the various options are displayed for a user when entering a formula with correct or incorrect syntax during the test run.

## Question assessment in the Expert Mode

For the assessment of questions of the formula comparison type, extended options are available in the expert mode. For example, you can use individual MAXIMA instructions to assess the question. They can be returned as a Boolean value (true/false) or a numerical value (score). Additional customisations are possible by using placeholders (LEARNERRESPONSE, CORRECTRESPONSE, MAXSCORE ...). Several application examples can be found on the page Expert Mode for the Assessment of Formula Comparison Questions. Another one can be found here Example Text subset.

The Expert Mode provides two different comparison options:

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

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.