Error, invalid sum/difference
Description
Examples
Arithmetic expressions are formed using arithmetic operators. The + type expression is formed using the + operator along with two operands, resulting in an arithmetic expression of the form operand+operand or operand−operand. This error message occurs when an arithmetic expression of this form includes fewer than the expected two operands.
Tip: If an expression is executed accidentally, it can lead to error messages (if it is not valid Maple syntax). If this happens, toggling the expression to nonexecutable math removes the error message and changes the math to nonexecutable. To change an expression to nonexecutable math use the shortcut key Shift + F5. For more information, see Executable and Nonexecutable Math.
Example 1
The following example illustrates that the + and − operators must precede expressions to indicate positive or negative values. The + and − operators cannot be used as the last element to the right of an expression; otherwise, the expression is interpreted as a sum or difference with a missing operand.
x+
x−
Solution:
In this example, assume that the intent is to indicate positive and negative values. Moving the operators in front of the operands corrects the errors.
+x
x
−x
Example 2: For users of Maple 2018 and earlier versions
In earlier versions of Maple, the following was not valid. In this example, + and - operators are added to increment and decrement the value x in Maple code. However, Maple did not have an increment or decrement operator as in C++ or other programming languages, so in 2-D math the expression is interpreted as a sum or difference with a missing operand. (The following is valid Maple language in Maple 2019.)
x≔1
x≔1
x++
x−−
Assuming that x has a value, you can increment values Maple is as follows.
x≔x+1
x≔2
For information on the increment, decrement and assignment operators in Maple, see updates/Maple2019/Language and assignment.
See Also
arithop
Executable and Nonexecutable Math
loops
Download Help Document