Calculating with signed variables

Last modified by Carina Enke on 10.01.2024

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.

MAXIMA - Zusätzliche Klammer_de.png

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.