Operations - Waigo01/math_utils_lib GitHub Wiki

In terms of supported operations, the library supports most common operations on scalars, vectors and matrices and implements some special operations for numerical derivatives, numerical integrals and equation solving.

The following is a list of all operations with a short explanation:

a+b: Add two scalars, vectors, or matrices
a-b: Subtract two scalars, vectors, or matrices
a&b: Add and subtract two scalars, vectors or matrices (This allows for ±√)
a*b: Multiply a scalar, vector or matrix with each other (Dotproduct, Matrix multiplication, Scalar multiplication, ...)
a/b: Divide two scalars or a vector or matrix with a scalar
A#B: Calculate the cross product, only works with dim(V) <= 3. When dim(V) < 3 the vector gets augmented with zeros.
3a: Hidden multiplication between scalar and variable or parentheses
a^b: Take a scalar to the power of another scalar using "^"
A?a: Index into vector using "?" (e.g. [3, 5, 7]?1 = 5)
sin(a): Calculate the sin of a scalar
cos(a): Calculate the cos of a scalar
tan(a): Calculate the tan of a scalar
abs(a): Calculate the absolute value of a scalar or a vector (length of the vector)
sqrt(a): Calculate the square root of a scalar
root(a, n): Calculate the nth root of a scalar
ln(a): Calculate the natural log of a scalar
arcsin(a): Calculate the arcsin of a scalar
arccos(a): Calculate the arccos of a scalar
arctan(a): Calculate the arctan of a scalar

D(f, n, m): Calculate the derivative of a function f in respect to n at a value m
I(f, n, a, b): Calculate the integral of a function f in respect to n with the bounds a and b
eq(eq_1, eq_2, eq_3, ..., x, y, z, ...): Solve the given equation(s) in terms of the given variable(s)

For example:

3+4 = 7
3&sqrt(9) = {0, 6}
[3, 2, 1]?0 = 3
sin(0) = 0
[3, 1, 6]*[2, 7, 1] = 19
eq(x^2 = 9, x) = {3, -3}