ONYX and MAXIMA
Calculating with signed variables
If an ONYX variable is used in MAXIMA calculations, it is always recommended to enclose it with parentheses (⋅).
Example: Variable {a} squared:
If {a}=-5 then {a}^2=-5^2=-25, whereas ({a})^2=(-5)^2=25.
The comparison of the two variants – with and without parentheses – can be seen in the example image below.
ONYX connects the CAS MAXIMA as an external application. MAXIMA requests are sent to MAXIMA in a form defined by the user without being interpreted or modified. If you choose a numeric data type as the variable and thus as the result data type, only the float expression will be added.
If it is intended that {var1} can assume any value of the user, then "3+4" or any other expression is also conceivable. If {var1} is now used in a MAXIMA request, e. g. {var1}^2, this is inserted corresponding to a placeholder without further intervention and transmitted to MAXIMA for calculation. Therefore, to preserve the intended overall context, additional parentheses around ONYX variables are necessary.
Analysing user responses with the help of variables
By using maxima queries in the Variables tab, you can access the answer selected by the user and the correct task solution. More details can be found here Expert assessment.
Auto-completion of invalid MAXIMA terms
If during the creation or editing process of a variable the user enters a non-valid MAXIMA expression in the field for determining the value, ONYX converts the expression into a valid expression before transferring it to MAXIMA.
Value of a numerical variable
When determining a numerical (variable) value, the "invalid" calculation defined by the author is completed with a float command: float(...);.
Example
- The calculation "1+2" is changed to the MAXIMA command "float(1+2);".
- The data type of the variable is taken into account for the result regardless of the MAXIMA calculation performed.
- If the value of a variable type "Integer" is set by the calculation "1+2", the result value of the MAXIMA calculation is "3.0", the variable value is set accordingly to "3" as an integer value.
- Consider possible limits of the value range in the selected data type. If you wish to use the extended data range of integer values, the MAXIMA calculation should be formulated accordingly with a valid expression, for example "2^53+1;".
- Exception: Should the "invalid" calculation begin with a float command already, then only the addition of a semicolon is required to complete "invalid" calculations of text-based values.
Entry in the text field
IMS QTI source code view
Preview display with output of the maxima calculation
Value of a text variable
When determining a text-based (variable) value, the "invalid" calculation defined by the author is completed with a semicolon.
Example
- The entry "a" is changed to the MAXIMA command "a;".
- The data type of the variable is taken into account for the result regardless of the MAXIMA calculation performed.
- If the value of the variable is set to the type "Text", the result value of the MAXIMA calculation is "a" and the variable value is accordingly set to "a".
Entry in the text field
IMS QTI source code view
Preview display with output of the maxima calculation
- If you require the output of a term instead of the calculation value, the entry must be enclosed by an apostrophe. For example, if the value of the variable is specified as "1+2", the result value of the MAXIMA calculation is "1+2" and the variable value is set to "1+2" accordingly.
Entry in the text field
IMS QTI source code view
Preview display with output of the maxima calculation