arithmetic operators - Maple Help

Home : Support : Online Help : Mathematics : General Information : arithmetic operators

Arithmetic Operators

+, -, *, /, ^, mod

Description

 • An expression can be composed by using the arithmetic operators + (addition), - (subtraction), * (multiplication), . (non-commutative multiplication), / (division), ^ (exponentiation), and mod (modular arithmetic).
 • Such expressions can be one of four types: type +, type *, type ., or type ^. That is, the expression a - b is of type + with operands a and -b. Similarly, a/b is of type * with operands a and b^(-1).  a . b is of type . with operands a and b.  Finally, a^b is of type ^' with operands a and b.
 • The representation used for these algebraic expressions is often referred to as sum-of-products form.
 • An expression of type ^ has exactly two operands. (It is a syntax error to express a^b^c without parentheses). An expression of type +, type *, or type . can have two or more operands.
 For non-integer (complex) numeric powers y and (complex) numeric x, the expression x^y is generally evaluated as exp(y*ln(x)), where ln(x) is evaluated using the principal branch of the logarithm.  The function surd can be used to compute real odd roots of negative real numbers.  See surd for more information.
 • The non-commutative multiplication operator, ., also called the "dot" operator, is used for linear algebra operations such as vector dot product, vector-vector products, matrix-vector products and matrix-matrix products.  Due to the multiple possible interpretations of the . character in a Maple expression, it may be necessary to use extra spaces around it to ensure correct processing.  See dot for details.
 If a and b are Arrays of the same dimensions (so $\mathrm{ArrayDims}\left(a\right)=\mathrm{ArrayDims}\left(b\right)$), then a . b and a * b both evaluate to the elementwise product of the Arrays.  That is, the elements of the results are just the products of the corresponding elements of a and b.  The element products are formed using the original operator, . or *.
 • The -x operation returns x with its sign reversed. No multiplication is performed on x.
 If -undefined is used, it is simplified to undefined. Similarly, if -Float(undefined) is used, it is simplified to Float(undefined). Otherwise, if a symbol is used, it is returned with its sign reversed.
 • For details on and example usage of the mod operator, see mod.

 • The arithmetic operators are thread safe as of Maple 15.

Examples Using Arithmetic Operators

 These examples are shown in 1-D math so you can see the *, /, and ^ operators.
 > op( x+y-z+w );
 ${x}{,}{y}{,}{-}{z}{,}{w}$ (1)
 > op( 2*x^2*y );
 ${2}{,}{{x}}^{{2}}{,}{y}$ (2)
 > op( (x+y)^z );
 ${x}{+}{y}{,}{z}$ (3)
 > (1.5+2.5*I)^(3.5+4.5*I);
 ${-0.2203847124}{+}{0.3457407884}{}{I}$ (4)
 > (-8.)^(1/3);
 ${1.000000000}{+}{1.732050807}{}{I}$ (5)
 > -undefined; -Float(undefined) * I;
 ${\mathrm{undefined}}$
 ${Float}{}\left({\mathrm{undefined}}\right){}{I}$ (6)
 Note the differences among the outputs of the ^, root, and surd commands.
 > (8)^(1/3); root(8, 3); surd(8, 3);
 ${{8}}^{{1}}{{3}}}$
 ${2}$
 ${2}$ (7)
 > (8.0)^(1/3); root(8.0, 3); surd(8.0, 3);
 ${2.000000000}$
 ${2.000000000}$
 ${2.000000000}$ (8)
 > (-8)^(1/3); root(-8, 3); surd(-8, 3);
 ${\left({-8}\right)}^{{1}}{{3}}}$
 ${2}{}{\left({-1}\right)}^{{1}}{{3}}}$
 ${-2}$ (9)
 > (-8.0)^(1/3); root(-8.0, 3); surd(-8.0, 3);
 ${1.000000000}{+}{1.732050807}{}{I}$
 ${1.000000000}{+}{1.732050807}{}{I}$
 ${-2.000000000}$ (10)
 > <1,2,3> . <4,5,6>;
 ${32}$ (11)
 > . <1,2>;
 $\left[\begin{array}{c}{a}{+}{2}{}{b}\\ {c}{+}{2}{}{d}\end{array}\right]$ (12)
 > Array([[1,2],[3,4]]) * Array([[a,b],[c,d]]);
 $\left[\begin{array}{cc}{a}& {2}{}{b}\\ {3}{}{c}& {4}{}{d}\end{array}\right]$ (13)