Arithmetic Operators - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Information : arithop

Arithmetic Operators

+, -, *, /, ^, mod

 

Description

Thread Safety

Examples Using Arithmetic Operators

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 ArrayDimsa=ArrayDimsb), 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.

Thread Safety

• 

The arithmetic operators are thread safe as of Maple 15.

• 

For more information on thread safety, see index/threadsafe.

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,x2,y

(2)

op( (x+y)^z );

x+y,z

(3)

(1.5+2.5*I)^(3.5+4.5*I);

0.2203847124+0.3457407884I

(4)

(-8.)^(1/3);

1.000000000+1.732050807I

(5)

-undefined; -Float(undefined) * I;

undefined

FloatundefinedI

(6)
  

Note the differences among the outputs of the ^, root, and surd commands.

(8)^(1/3); root(8, 3); surd(8, 3);

81/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);

81/3

211/3

2

(9)

(-8.0)^(1/3); root(-8.0, 3); surd(-8.0, 3);

1.000000000+1.732050807I

1.000000000+1.732050807I

2.000000000

(10)

<1,2,3> . <4,5,6>;

32

(11)

<a,b;c,d> . <1,2>;

a&plus;2bc&plus;2d

(12)

Array([[1,2],[3,4]]) * Array([[a,b],[c,d]]);

a2b3c4d

(13)

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

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam