Operators



The assignment operator is <-

The binary operators +, -, *, /, and ^ implement addition, subtraction, multiplication, division and exponentiation.

%% indicates `x mod y' and `%/%' indicates integer division.

The logical operators are == (equality), != (inequality), || (or), and && (and).

When applied to vectors and matrices, the binary operators are applied on an element by element basis. If two vectors in a binary operation are not of the same size, then the shorter values are "recycled".

%*% is used for matrix multiplication and matrix vector multiplication. Solution of matrix equations (e.g. matrix "division") is accomplished using the solve( ) command.

The standard mathematical functions

abs, sign, sqrt, floor, ceiling, trunc, round, signif
exp, log, log(x, base), log10, log2,cos, sin, tan, acos, 
asin, atan, atan2(y, x), cosh, sinh, tanh, 
acosh, asinh, atanh

are available. When applied to vectors, they operate on each element individually. See pages linked to Math for more details.

Original Documentation : Arithmetic, matrix , matmult, solve, Math

Samples


UCLA Mathematics Department ©2000