## Step by step

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

### Step 1: Design the task

As an example, a calculation interaction is to be created with a given function. The task of the learner is to calculate the area under this function at a given interval. The factors of the function equation and the interval boundaries serve as parameters. All parameters are supposed to be determined as random, integer values in a given interval.

### Step 2: Parameter definition

Switch to the tab "Variables" and create four new variables. Assign the identifiers "a", "b", "c", and "d" as variable names. All variables are of the type "integer". To determine values for the variables, use the function "Random" and define a value range.

In the case of constants, use "Random" and enter only the individual value for the constant.

A detailed description of how to create and insert variables can be found in the help section Using variables.

Fig.: Define variable

### Step 3: Create the question

Switch to the tab "Question & Answer" and enter the question in the text field. Formulas can be directly inserted into the task text with LaTeX (Integrating formulas). To use the defined variables as parameters in the function, simply enter the variable name in braces (e.g. {a}). ONYX automatically recognises the defined variable and replaces it accordingly when the test is performed. The specification of variable names is possible within LaTeX and in normal text.

Fig.: Create question

### Step 4: Creation of the calculation rule

Click on the gap symbol or create a new gap via the button "Add gap". The edit window for the selected gap opens. Select the option "Define new variable". You will then be automatically directed to the tab "Variables", and a new variable with the identifier "solution" of the type "integer" (or "floating-point") will be created. For the value determination, the option "Calculation" is already selected.

Since we expect a floating-point number as a solution, the variable type should be changed to "floating-point". Enter then the calculation rule in the appropriate input field below. Parameters are used by specifying the variable name in braces (e.g. {a}). The calculation rule is specified in MAXIMA notation.

In the tab "Question and Answer", the new variable "solution" was automatically selected as the solution.

Fig.: Calculation rule

### Step 5 (optional): Definition of a tolerance range

To retrieve a solution that is, for example, accurate to two decimal places regardless of the accuracy of the result value, we define an absolute deviation of "0.01", without including the tolerance limits.

A more detailed description on the option "Precision" is provided in the help section Numerical input interaction.

Fig.: Set tolerance range

### Step 6: Task verification

Select the option "Preview" to display a randomly generated example task of your calculation rule. The task is regenerated each time you preview it. The preview also provides you with the possibility to check the solution input.

Fig.: Task verification

## Example floating-point numbers

**Goal: **In a task, an integer is to be multiplied by a floating-point number.

Creating a calculation interaction and defining variables:

Formulation of the question concerning the multiplication of the displayed values:

The user input is by default evaluated with "exact" precision:

The user cannot enter a correct solution. The variable with the floating-point number is displayed with 4 decimal places in this case. The exact calculation, however, is performed with the exact random value of the variable.

**Solution: **Via the setting "Precision: Absolute", a tolerance range can be defined for the calculation of the gap.

By selecting a suitable interval, the result will be properly assessed.