Arithmetic Operators
+, -, *, /, ^, mod
Description
Thread Safety
Examples Using Arithmetic Operators
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 ArrayDims⁡a=ArrayDims⁡b), 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.
For more information on thread safety, see index/threadsafe.
These examples are shown in 1-D math so you can see the `*`, `/`, and `^` operators.
op( x+y-z+w );
x,y,−z,w
op( 2*x^2*y );
2,x2,y
op( (x+y)^z );
x+y,z
(1.5+2.5*I)^(3.5+4.5*I);
−0.2203847124+0.3457407884⁢I
(-8.)^(1/3);
1.000000000+1.732050807⁢I
-undefined; -Float(undefined) * I;
undefined
Float⁡undefined⁢I
Note the differences among the outputs of the ^, root, and surd commands.
(8)^(1/3); root(8, 3); surd(8, 3);
813
2
(8.0)^(1/3); root(8.0, 3); surd(8.0, 3);
2.000000000
(-8)^(1/3); root(-8, 3); surd(-8, 3);
−813
2⁢−113
−2
(-8.0)^(1/3); root(-8.0, 3); surd(-8.0, 3);
−2.000000000
<1,2,3> . <4,5,6>;
32
<a,b;c,d> . <1,2>;
a+2⁢bc+2⁢d
Array([[1,2],[3,4]]) * Array([[a,b],[c,d]]);
a2⁢b3⁢c4⁢d
See Also
Array
convert
dot
LinearAlgebra
ln
mod
op
operators for forming expressions
RealDomain
root
surd
type
type/+
type/.
type/*
type/^
type/algebraic
Download Help Document