Important

 and y represent numerical values or variables.
 mn, and represent integer values or variables.
 and b represent boolean values or variables.
 and represent matrices of numerical values.
 and represent matrices of boolean values.


Arithmetic operators 

OperatorOperator nameSyntax
+Addition

x+y

U + V (U and V are m x n matrices)

-Subtraction

x-y

U + V (U and V are m x n matrices)

*Multiplication

x*y

U*V (U is an m x n matrix and V is an n x p matrix)

/Divisionx/y
%Modulus

m%n

U + V (U and V are m x n matrices of integer values).

This operator operates element-wise on matrices.

!Factorialm!
^Powerx^y
\Left division

x\y is equivalent to (1/x) * y

U \ V (U and V are m x n matrices) is equivalent to (1/U) * V

.*Element-wise multiplicationU .* V (U and V are m x n matrices)
./Element-wise divisionU ./ V (U and V are m x n matrices)
.\Element-wise left divisionU .\ V (U and V are m x n matrices) is equivalent to (1/U) .* V
.^Element-wise powerU .^ V (U and V are m x n matrices)

Note

An Element-wise operator performs an operation on each pair of Elements, which is in the same location, of the operand matrices. 

Assignment operators

Operator 

Operator name

Syntax

=

Assignment

x=y

a=b

U=V

Comparison operators

Operator Operator nameSyntax
>Greater x>y
U>V
<Less x<y
U<V
>=Greater or Equal x>=y
U>=V
<=Less of Equalx<=y
U<=V
==Equality

x==y

a==b

U==V

!=Inequality

x!=y

a!=b

U!=V 

All comparison operators operate Element-wise on matrices in the example as follows

A = [1; 2; 3]
B = [3; 2; 1]

Then
A>B is [false; false; true];

Boolean operators

Operator Operator NameSyntax

! 

NOT

not

NOT

!A

NOT A

not A

&

AND

and

AND

A&B

A AND B

A and B

|

OR

or

OR

A|B

A OR B

A or B

^

XOR

xor

XOR (exclusive OR)

A^B

A XOR B

A xor B

Important

All boolean operators operate element-wise on matrices in the example as follows

A = [true; true; false; false];
B = [true; false; true; false];

Then
A&B is [true; false; false; false];