Function
iMath has built-in functions and user-defined functions. User-defined functions are created with FUNCTION and FUNCDEF. Function arguments for multi-valued functions are separated by semicolon ;
.
Most functions will try to immediately evaluate themselves. If this is not possible, then the function will remain in the expression where it has been used. In that case it can be evaluated later with the simplification expand.
Built-in trigonometric functions
The following trigonometric functions are known to iMath. They all take exactly one argument.
cos cosh arcsin arccos
sin sinh arsinh arcosh
tan tanh arctan artanh
cot coth arccot arcoth
sec arcsec sech arsech
csc arcsc csch arcsch
Built-in algebraic functions
These functions take exactly one argument.
square sqrt abs fact
(factorial)
Built-in exponential and logarithm functions
These functions take exactly one argument.
exp ln log
(logarithm to basis 10)
Built-in complex-valued functions
These functions take exactly one argument.
re im conjugate
Built-in other functions
These functions take exactly two numbers as arguments.
max(x; y) min(x; y)
This function linearly interpolates between two points given as pairs of (x,y)-values in the first four arguments. The fifth argument is the x-value for which the corresponding y-value should be interpolated.
interpol(x1; y1; x2; y2; x)
Built-in functions for vectors and matrices
charpoly ( expression )
If the expression contains a matrix, evaluates to the characteristic polynomial of the matrix.
det ( expression )
If the expression contains a matrix, evaluates to the determinant of the matrix.
diag ( expression )
If the expression contains a (row or column) vector, creates a matrix with the elements of the vector in the diagonal.
hadamard ( expression ; expression ; expression )
If both first and second expression are vectors or matrices of equal dimensions, calculates their element-wise product (if the third expression is 0), division (if the third expression is 1) or power (if the third expression is 2). Usually, this function is not used directly. Rather, the operators .*
, ./
and .^
should be used. The element-wise product is also called the Hadamard product.
invertmatrix ( expression )
If the expression contains a matrix, inverts the matrix.
matrixcols ( expression )
If the expression contains a matrix, counts the number of columns of the matrix.
matrixrows ( expression )
If the expression contains a matrix, counts the number of rows of the matrix.
mindex ( expression ; expression ; expression )
If the first expression contains a vector or matrix, evaluates to the element at the given row (second expression) and column (third expression). If the row is a wildcard, a whole column will be returned as a vector. If the column is a wildcard, a whole row will be returned.
See also Vector and matrix element access.
ones ( expression; expression )
If the two first expressions evaluate to positive integers, creates a matrix filled with ones.
rank ( expression )
If the expression contains a matrix, evaluates to the rank of the matrix.
reducematrix ( expression; expression; expression)
If the first expression is a matrix, and the other expressions evaluate to positive integers, creates a new matrix from the given matrix where the given row and column (second and third expression) are omitted.
scalprod ( expression ; expression )
If both expressions are vectors, evaluates to their scalar product. The vector product can only be calculated from a column and a row vector of equal length. Any other dimensions will leave the function unchanged.
solvematrix ( expression ; expression ; expression )
Solves the linear system with the matrix of the first expression, the variables of the second expression and the right-hand side of the third expression.
submatrix ( expression; expression; expression; expression; expression)
If the first expression is a matrix, and the other expressions evaluate to positive integers, creates a new matrix from the given matrix containing the elements beginning at the given offset (second and fourth expression) and having the given number of rows and columns (third and fifth expression). Note that row and column count starts at zero!
tr ( expression )
If the expression contains a matrix, evaluates to the trace of the matrix.
transpose ( expression )
If the expression contains a vector or matrix, evaluates to the transposed vector or matrix.
ident ( expression ; expression )
If the two expressions evaluate to positive integers, creates a unit matrix of the given dimensions.
vecprod ( expression ; expression )
If both expressions are vectors, evaluates to their vector product. The vector product can only be calculated with two row or column vectors of three components each. Any other dimensions will produce an error.
vmax ( expression )
If the expression contains a vector or matrix of which all elements are numbers, evaluates to the greatest element.
vmin ( expression )
If the expression contains a vector or matrix of which all elements are numbers, evaluates to the smallest element.
Functions for number display
round ( expression ; expression )
Immediately evaluates to a number rounded to the given number of decimal places, if possible.
ceil ( expression ; expression )
Immediately evaluates to a number rounded up to the given number of decimal places, if possible.
floor ( expression ; expression )
Immediately evaluates to a number rounded down to the given number of decimal places, if possible.
Functions for sums and products
sum ( expression ; expression ; expression )
Sums the third expression from the lower bound given by the first expression to the upper bound given by the second expression. This function is created by SUM FROM ... TO.
Functions for conditional evaluation
ifelse ( condition ; expression ; expression )
If the condition can be evaluated to a boolean value, evaluates to the first expression if the condition is true, otherwise to the second expression.
Temperature conversion functions
The following functions are defined in the abbreviated SI units reference file. They take exactly one argument.
kelvintocelsius celsiustokelvin
The following functions are defined in the imperial units reference file. They take exactly one argument.
kelvintofahrenheit fahrenheittokelvin