Numerical Variables

Last modified by Carina Enke on 13.02.2024

For integer or fractional variable values, select the type  Integer or  Floating point .

Editor - Ganzzahlvariable Typauswahl_de.png

To alter the value for the numerical variable, different options are available, which will be explained in the following sections, just as the possibility to define the display accuracy of floating-point numbers. If a numerical variable is not assigned a value, the variable will be initialised with 0.

Editor - Ganzzahlvariable Wertsetzung_de.png

Range

For numerical variables, a value range can be defined. The variable value will be randomly determined within the defined value range. Please note that the specified limits are included in the selection. For variables of the type Integer , the step size (setting steps) can be determined in addition to the limits (setting minimum and maximum).

Possible entries are for example:

  • Range: Minimum=2, maximum=11, steps=3: The following values are possible {2, 5, 8, 11}. When the variable is used, a value will be randomly selected, for example 2.

    Editor - Bildvariable Wertsetzung Wertebereich_de.png

The following examples for the use of numerical variables to generate random values show typical application scenarios:

Value (direct value assignment)

You can directly assign a value to all types of variables in order to initialise them. Later on, the value can be changed depending on other variables (cf. conditions).

Possible entries are for example:

  • Value: 5: The variable is assigned the value 5.
  • Value: -2.25: The variable is assigned the value -2.25.

Random

Define a value list from which a value is randomly selected. The alternative values are separated by a line break or semicolon.

Possible entries are for example:

  • Random selection: -5; -3; 3; 5: One of the specified values will be randomly selected, for example 5.
  • Random selection: 0; 12.25; 13.5: One of the specified values will be randomly selected, for example 12.25.

Calculation (MAXIMA)

The ONYX Testsuite is connected with the computer algebra system MAXIMA, which allows you to calculate variable values on the basis of other variables. To do this, you need to indicate the calculation rule in MAXIMA notation. 

For further information on the MAXIMA notation, please refer to the MAXIMA manual. A valuable compilation of examples can be found in the form of a wiki under MAXIMA good practice examples.

Possible entries are for example:

  • Calculation (MAXIMA): 5+{a}: The sum of 5 and the variable value {a} is calculated. Please note that the variable {a} must have been previously defined.
  • Calculation (MAXIMA): sqrt({a})/(5+sqrt({b})): MAXIMA supports mathematical expressions such as sqrt() for square root.
  • Calculation (MAXIMA): 2*sin({a})+log({b}): Further, it is possible to use trigonometric functions or the logarithm function.

    Editor - Bildvariable Wertsetzung Berechnung Maxima_de.png

How to deal with invalid MAXIMA terms

In some cases, invalid MAXIMA data is automatically supplemented with valid entries. The section Using MAXIMA and ONYX lists these cases and how to deal with them.

The following examples for the use of numerical variables to generate random values show typical application scenarios:

Setting: Format display

For variables of the type floating point, the number of decimal places can be configured for the display. Please note that this setting only affects the display, not the computational accuracy and the solution comparison. This means: If the variable is used for the calculation of additional variables, the complete unrounded value will be used for the calculation. If the variable is stored as a solution for a gap (calculation interaction), the configured number of decimal places will be used for the solution display, but not for the solution comparison.

Editor - Formatierung der Dezimalstellenanzeige_de.png

If you want the participant to solve calculation tasks with a certain precision, use the setting for defining a tolerance range in the edit window of the gap.