Error, invalid sum/difference
|
Description
|
|
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.
|
|
Examples
|
|
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.
>
|
|
>
|
|
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.
>
|
|
| (2.1) |
>
|
|
| (2.2) |
Example 2
In this example, + and - operators are added to increment and decrement the value x in Maple code. Maple does not have an increment or decrement operator as in C++ or other programming languages, so the expression is interpreted as a sum or difference with a missing operand.
>
|
|
>
|
|
Solution:
Assuming that has a value, the correct way to increment values in Maple is as follows.
>
|
|
>
|
|
| (2.3) |
|
|
Download Help Document
Was this information helpful?