# Math Formula

## Description

The Math Formula question allows students to easily enter complex math as a response, with advanced validation capabilities using math specific scoring methods, in conjunction with our purpose built math engine.

Figure 1 - Math Formula question example.

## Create a Question

Enter the question stem in the **Compose Question** area. If you want to insert some math in the stimulus, you can use the Math Editor. *Note* that the student will not be able to interact with math entered this way. To access the Math Editor, click inside the Compose Question text area and select **Math Editor** from the **Rich Text Editor** panel (see *Figure 2*).

Figure 2 - Rich Text Editor panel with Math Editor button.

A new window with a keypad will pop up and you will be able to add a **LaTeX** or MathML expression. *Figure 3* shows an example.

Figure 3 - Question with math expression in the stimulus.

Student response boxes (and math expressions) are added in the **Template** area. This is a LaTeX *only* area, and math expressions and response boxes are entered using the LaTeX Keypad - as seen in *Figure 4* below.

It is important to remember that **everything** entered into the Template area must also be entered into the Value field in the validation area, or the question will not validate properly.

Figure 4 - Authoring a Math Question with the LaTeX keypad.

Follow these steps in order to configure validation:

- Insert a value in the
**Point(s)**box to set the score for the question. The default value is 1. - Underneath the Point(s) area, select a suitable math
**scoring method**from the dropdown menu. There are various scoring methods available in math question types. You can learn more about each of them and play with interactive examples on our**Formula page**. For this example we are going to choose**equivSymbolic**. This will accept any math that is symbolically equivalent to what the author enters in the Value field, and is the most flexible scoring method. - Now
**insert the correct response**into the**Value**field. In the case below, the correct response must be in the form x+y=z and the sum of two terms must be \(\frac{3}{4}\). You only need to enter one possible solution in the Value field in order to make it work.*Remember that everything that has been entered in the Template area must be copied to the Value field in validation.**Figure 5*shows validation settings for this example. EquivSymbolic also validates percentages and decimals as equivalent.Figure 5 - Setting a value. The entire equation entered into the LaTeX Template area must be entered into the Value area.

- Each scoring method has
**additional options**that allows authors to set more precise validation conditions. A breakdown of all options associated with certain scoring methods can also be found in our**Formula tutorials**. When you select a scoring method, all of its extra options will be displayed underneath the Value field. - Some more complex math questions will need a second scoring method applied. You can
**combine several scoring methods**to set more strict validation rules. For instance, you may want the system to accept a response that is not only symbolically equivalent but is also presented in a specific syntax. In this case, you would need to add another method called**equivSyntax**. Below the first scoring method you will see the**+Add**button. Click on it in order to add a new scoring method. Another module will appear below where you can select equivSyntax as the scoring type. In the Rule dropdown you can choose a specific Syntax, e.g. Fraction or Decimal, among others.

Figure 6 - Additional options.

Figure 7 - Combining scoring methods.

### More Options

Additional formatting options can be found under More Options:

#### Scoring

**Unscored/Practice usage** - Removes all scoring from the question.

**Penalty point(s)** - The value entered here will be deducted from the student for an incorrect answer.

**Minimum score if attempted** - Set attempt marks for the question.

**Check answer button** - Show or hide the Check answer button from the student.

**Check answer attempts** - The value entered here refers to how many times the student can use the Check answer button, before it is disabled.

#### Layout

**Transparent background** - If this is enabled, the background of the response area will match the colour of the rest of the background area.

**Response minimum width (px)** - Enter, in pixels, the minimum width of the response area.

**Template font scale** - Scales the font relative to the question's font size. The default value is 150%.

**Response container (global)** and **Edit invidiual response containers** - Configure the Width and the Height, in pixels, for either *all* response containers, or for *specified* response containers.

#### Keypad

**Type** - Select from a Floating keypad, a Block keypad, a Block on focus keypad, or no keypad.

**Show keypad hints** - Enable or disable hints on the keypad, such as keyboard shortcuts and symbol group titles that are shown on the top left corner of the keypad when hovering over a symbol group key.

**Number pad** - Customise the number pad in this section.

**Symbols** - Select what symbol groups will be shown to the student, or create custom symbol groups.

#### Text blocks

Use this option when you want to define a list of custom units (such as g, kg, cm, oz, etc.) that will not be rendered as LaTeX.

**Example 1 - Math Formula - Default response box.**

```
{
"instant_feedback": true,
"is_math": true,
"stimulus": "Enter the equation \\(x + 1\\)",
"type": "formulaV2",
"ui_style": {
"type": "block-keyboard"
},
"validation": {
"scoring_type": "exactMatch",
"valid_response": {
"score": 1,
"value": [
{
"method": "equivLiteral",
"value": "x+1",
"options": {
"ignoreOrder": false,
"inverseResult": false
}
}
]
}
}
}
```

**Example 2 - Math Formula question with 1 response box.**

```
{
"instant_feedback": true,
"is_math": true,
"stimulus": "Enter any value that is equal to \\(5m\\). You may use \\(km\\), \\(cm\\), \\(ft\\), \\(in\\) or other units (rounded to two decimal places).",
"symbols": [
"units_us",
"units_si"
],
"template": "{{response}}",
"text_blocks": [],
"type": "formulaV2",
"ui_style": {
"type": "block-keyboard"
},
"validation": {
"scoring_type": "exactMatch",
"valid_response": {
"score": 1,
"value": [
{
"method": "equivValue",
"value": "5m",
"options": {
"decimalPlaces": 2,
"inverseResult": false
}
}
]
}
}
}
```

**Example 3 - Math Formula - Default response box with Matrices keyboard.**

```
{
"instant_feedback": true,
"is_math": true,
"stimulus": "<p>Complete the matrix addition:<\/p>\n\n<p>\\(\\begin{bmatrix}3&1\\\\-2&4\\end{bmatrix}+\\begin{bmatrix}-1&5\\\\-3&1\\end{bmatrix}=\\)<\/p>\n",
"symbols": [
"matrices"
],
"text_blocks": [],
"type": "formulaV2",
"ui_style": {
"response_font_scale": "normal",
"type": "block-keyboard"
},
"validation": {
"scoring_type": "exactMatch",
"valid_response": {
"score": 1,
"value": [
{
"method": "equivSymbolic",
"value": "\\begin{bmatrix}2&6\\\\-5&5\\end{bmatrix}",
"options": {
"allowDecimal": false,
"inverseResult": false
}
}
]
}
}
}
```

```
{
"instant_feedback": true,
"is_math": true,
"response_containers": [
{
"width": "60px",
"height": "40px"
}
],
"stimulus": "<p>\n<p>Complete the formula to calculate mass of an electron.<\/p>\n",
"symbols": [
"basic",
"qwerty",
"units_si"
],
"template": "m_e=9.109\\times{{response}}{ }kg",
"text_blocks": [],
"type": "formulaV2",
"ui_style": {
"type": "block-keyboard"
},
"validation": {
"scoring_type": "exactMatch",
"valid_response": {
"score": 1,
"value": [
{
"method": "equivLiteral",
"options": {
"allowDecimal": false,
"inverseResult": false,
"ignoreOrder": false
},
"value": "m_e=9.109\\times10^{-31}kg"
}
]
}
}
}
```

**Example 5 - Math Formula with 2 response boxes.**

```
{
"instant_feedback": true,
"is_math": true,
"stimulus": "Complete the equation so that the two sides are equal.",
"symbols": [],
"template": "{{response}} + {{response}} = 10",
"text_blocks": [],
"type": "formulaV2",
"ui_style": {
"type": "block-keyboard"
},
"validation": {
"scoring_type": "exactMatch",
"valid_response": {
"score": 1,
"value": [
{
"method": "equivValue",
"options": {
"decimalPlaces": 10,
"inverseResult": false,
"ignoreOrder": false
},
"value": "1+9=10"
}
]
}
}
}
```

**Example 6 - Math Formula - With Fraction and exponent responses.**

Hint Correct answer is *V= ^{4}⁄_{3}π r^{3}*

```
{
"instant_feedback": true,
"is_math": true,
"stimulus": "\n<p>Complete a formula to find volume of a sphere.<\/p>\n\n<p><img alt=\"\" height=\"200\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/a\/a3\/Linalg_great_circle.png\" width=\"200\" \/><\/p>\n\n<p> <\/p>\n",
"template": "V=\\frac{ }{ }\\pi r^{ }",
"text_blocks": [],
"type": "formulaV2",
"ui_style": {
"type": "block-keyboard"
},
"validation": {
"scoring_type": "exactMatch",
"valid_response": {
"score": 1,
"value": [
{
"method": "equivLiteral",
"options": {
"allowDecimal": false,
"inverseResult": false,
"ignoreOrder": false
},
"value": "V=\\frac{4}{3}\\pi r^3"
}
]
}
}
}
```