Calculator Functions

The Calculator component supports a comprehensive set of functions. You can apply functions to scalar or array values, unless otherwise noted. For array values, the result is an array of the same size as the argument(s). Isight applies the function to each array element individually.

Arithmetic Functions

The Calculator component supports the following arithmetic functions:

abs(x) absolute value
angle(x, y) converts rectangular coordinates (y, x) to polar
ceil(x) smallest integer greater than or equal to x
exp(x) E to the power
fact(i) factorial
floor(x) largest integer less than or equal to x
int(x) truncate to integer
ln(x) natural logarithm
log10(x) log base 10
mod(x, y) remainder of x / y
power(x, y) power
rand() random number 0..1
round(x) round to integer
sqrt(x) square root

Array Functions

The array functions take an array as the argument and returns the scalar result of applying the operation to all elements of the array. The Calculator component supports the following array functions:

absMax(arr) maximum absolute value
absMin(arr) minimum absolute value
absMaxIdx(arr) index of the largest absolute value
absMinIdx(arr) index of the smallest absolute value
absSum(arr) sum of absolute values
dim(arr, dim) size of one dimension of an array
max(arr) maximum
maxIdx(arr) index of the largest value
mean(arr) arithmetic mean
min(arr) minimum
minIdx(arr) index of the smallest value
size(arr) number of elements in an array
stdDev(arr) standard deviation
sum(arr) sum

Note: The Idx functions return the index of the array element that meets the rest of the function name. For example, a{maxIdx(a)} == max(a). If there are multiple array elements with the same value, Isight chooses the first function.

Constants Functions

The Calculator component supports the following constants functions:

e() Base of natural logarithms
inf() IEEE floating point extended value infinity
nan() IEEE floating point extended value (not a number)
pi() Ratio of diameter of a circle to circumference

Logical Functions

The Calculator component supports the following logical functions:

if(b, x, y) conditional (if b then x else y)
true() logical true
false() logical false

Hyperbolic Functions

The Calculator component supports the following hyperbolic functions:

acosh(x) hyperbolic arc cosine
acoth(x) hyperbolic arc cotangent
acsch(x) hyperbolic arc cosecant
asech(x) hyperbolic arc secant
asinh(x) hyperbolic arc sine
atanh(x) hyperbolic arc tangent
cosh(x) hyperbolic cosine
coth(x) hyperbolic cotangent
csch(x) hyperbolic cosecant
sech(x) hyperbolic secant
sinh(x) hyperbolic sine
tanh(x) hyperbolic tangent

Statistical Functions

The statistical functions take an arbitrary number of scalar arguments and return a single scalar value. If there is only one array argument, the function behaves as the array function. If there are multiple arguments and at least one argument is an array, the operation is performed separately on each element of the array and returns an array. The Calculator component supports the following statistical functions:

sum(x, y,...) sum
max(x, y,...) maximum
min(x, y,...) minimum
absSum(x, y,...) sum of absolute values
absMax(x, y,...) maximum absolute value
absMin(x, y,...) minimum absolute value
mean(x, y,...) mean
stdDev(x, y,...) standard deviation

Trigonometry Functions

Trigonometry functions are in radians. Use the expression degrees / 180 * pi() to convert degrees to radians. The Calculator component supports the following trigonometry functions:

acos(x) arc cosine
acot(x) arc cotangent
acsc(x) arc cosecant
asec(x) arc secant
asin(x) arc sine
atan(x) arc tangent
atan2(x, y) arc tangent of x/y
cos(x) cosine
cot(x) cotangent
csc(x) cosecant
sec(x) secant
sin(x) sine
tan(x) tangent

Vector and Matrix Functions

The Calculator component supports the following vector and matrix functions:

dot(a,b)

Takes two vectors and computes the dot product. The a and b vectors must be the same size. Takes two 1D arrays as arguments and returns a scalar real value.

cross(a,b)

Takes two vectors with three elements each and computes the cross product (also a vector with three elements). Takes two 1D arrays as arguments and returns a 1D array. Cross product is available only for 1D arrays with exactly three elements.

prod(A,B)

Takes two matrices and returns the product (also a matrix). Takes two 2D arrays as arguments and returns a 2D array.

transpose(A)

Computes the transpose of a matrix/vector. Takes a 2D array as an argument and returns a 2D array.

inv(A)

Computes the inverse of the square matrix A. Takes a square 2D array as an argument and returns a 2D array.

powerm(A,n)

Computes the power of a matrix A using eigen value decomposition. Takes a 2D array and a scalar as arguments and returns a 2D array.

det(A)

Computes the determinant of a matrix. Takes a square 2D array as an argument and returns a scalar real value.

rank(A)

Computes the rank of a matrix A (i.e., the number of linearly independent rows).

norminf(A)

Calculates the L-infinity norm (or maximum row sum norm) of a matrix A. Takes a 1D or 2D array as an argument and returns a scalar real value.

A=maxij|aij|

norm1(A)

Calculates the L1 norm (or maximum column sum norm) of the matrix or vector A. Takes a 1D or 2D array as an argument and returns a scalar real value.

A1=maxji|aij|

norm2(A)

Calculates the L2 norm (or spectral norm) of the matrix or vector A. Takes a 1D or 2D array as an argument and returns a scalar real value

A2=maxλ,(ATA)x=λIx

(i.e., λ is an eigen value of ATA).

trace(A)

Computes the trace (i.e., the sum of values along the main diagonal). Takes a 2D array as an argument and returns a scalar real value.

eig(A)

Computes the set of real eigen values of a square matrix. Takes a square 2D array as an argument and returns a 1D array.

Decompositions

 

chol(A)

Computes the Cholesky decomposition (i.e., LLT = A) of a positive definite matrix. Takes a square 2D array as an argument and returns a 2D array.

lu(A)

Computes the LU decomposition of A. Takes a 2D array as an argument and returns an aggregate containing two 2D arrays (L&U) and an integer array (pivot).

singularValues(A)

Computes the singular value and returns the S matrix. Takes a 2D array as an argument and returns a 2D array.

Matrix Assignments

 

A=ones(m,n)

Creates a matrix with 1 at all locations. Takes two integers as arguments and returns a 2D array.

A=zeros(m,n)

Creates an m by n zero matrix. Takes two integers as arguments and returns a 2D array.

A=identity(n)

Creates an n by n identity matrix. Takes an integer as an argument and returns a 2D array.