
Custom Variables
Sorry, no results were found.
Getting Started
Learning
Nodes
Nodes Properties
Connections
Custom Variables
Simulations
Collaboration
Unity Plugin (UP) & API
Account & Billing
Math.js Functions
Function | What it does |
abs(x) | Calculate the absolute value of a number |
add(x, y) | Add two or more values, x + y |
cbrt(x [, allRoots]) | Calculates the cubic root of a value |
ceil(x) | Round a value towards plus infinity If x is complex, both real and imaginary parts are rounded towards plus infinity |
cube(x) | Compute the cube of a value, x * x * x |
divide(x, y) | Divide two values, x / y |
dotPow(x, y) | Calculates the power of x to y element-wise |
exp(x) | Calculate the exponent of a value |
expm1(x) | Calculate the value of subtracting 1 from the exponential value |
fix(x) | Round a value towards zero |
floor(x) | Round a value towards minus infinity |
gcd(a, b) | Calculate the greatest common divisor for two or more values or arrays |
hypot(a, b, …) | Calculate the hypotenusa of a list with values |
lcm(a, b) | Calculate the least common multiple for two or more values or arrays |
log(x [, base]) | Calculate the logarithm of a value |
log10(x) | Calculate the 10-base logarithm of a value |
log1p(x) | Calculate the logarithm of a value+1 |
log2(x) | Calculate the 2-base of a value |
mod(x, y) | Calculates the modulus, the remainder of an integer division |
multiply(x, y) | Multiply two or more values, x * y |
norm(x [, p]) | Calculate the norm of a number, vector or matrix |
nthRoot(a) | Calculate the nth root of a value |
nthRoots(x) | Calculate the nth roots of a value |
pow(x, y) | Calculates the power of x to y, x ^ y |
round(x [, n]) | Round a value towards the nearest integer |
sign(x) | Compute the sign of a value |
sqrt(x) | Calculate the square root of a value |
square(x) | Compute the square of a value, x * x |
subtract(x, y) | Subtract two values, x – y |
unaryMinus(x) | Inverse the sign of a value, apply a unary minus operation |
unaryPlus(x) | Unary plus operation |
xgcd(a, b) | Calculate the extended greatest common divisor for two values |
Functions | What it does |
bitAnd(x, y) | Bitwise AND two values, x & y |
bitNot(x) | Bitwise NOT value, ~x |
bitOr(x, y) | Bitwise OR two values, x | y |
bitXor(x, y) | Bitwise XOR two values, x ^ y |
leftShift(x, y) | Bitwise left logical shift of a value x by y number of bits, x << y |
rightArithShift(x, y) | Bitwise right arithmetic shift of a value x by y number of bits, x >> y |
rightLogShift(x, y) | Bitwise right logical shift of value x by y number of bits, x >>> y |
Function | What it does |
index(range1, range2,…) | Create an index. An Index can store ranges having start, step, and end for multiple dimensions. Matrix.get, Matrix.set, and math.subset accept an Index as input. |
subset(value, index) | Get or set a subset of a matrix or string. |
size(x) | Calculate the size of a matrix or scalar |
sort(x) | Sort the items in a matrix |
Function | What it does |
factorial(n) | Compute the factorial of a value Factorial only supports an integer value as argument |
gamma(n) | Compute the gamma function of a value using Lanczos approximation for small values, and an extended Stirling approximation for large values |
pickRandom(array) | Random pick one or more values from a one dimensional array |
random([min, max]) | Return a random number larger or equal to min and smaller than max using a uniform distribution |
randomInt([min, max]) | Return a random integer number larger or equal to min and smaller than max using a uniform distribution |
Function | Whate it does |
compare(x, y) | Compare two values |
compareNatural(x, y) | Compare two values of any type in a deterministic, natural way |
equal(x, y) | Test whether two values are equal |
larger(x, y) | Test whether value x is larger than y |
largerEq(x, y) | Test whether value x is larger or equal to y |
smaller(x, y) | Test whether value x is smaller than y |
smallerEq(x, y) | Test whether value x is smaller or equal to y |
unequal(x, y) | Test whether two values are unequal |
Function | What it does |
mad(a, b, c, …) | Compute the median absolute deviation of a matrix or a list with values |
max(a, b, c, …) | Compute the maximum value of a matrix or a list with values |
mean(a, b, c, …) | Compute the mean value of matrix or a list with values |
median(a, b, c, …) | Compute the median of a matrix or a list with values |
min(a, b, c, …) | Compute the minimum value of a matrix or a list of values |
mode(a, b, c, …) | Computes the mode of a set of numbers or a list with values(numbers or characters) |
prod(a, b, c, …) | Compute the product of a matrix or a list with values |
std(a, b, c, …) | Compute the standard deviation of a matrix or a list with values |
sum(a, b, c, …) | Compute the sum of a matrix or a list with values |
variance(a, b, c, …) | Compute the variance of a matrix or a list with values |
Function | What it does |
acos(x) | Calculate the inverse cosine of a value |
acosh(x) | Calculate the hyperbolic arccos of a value, defined as acosh(x) = ln(sqrt(x^2 – 1) + x) |
acot(x) | Calculate the inverse cotangent of a value, defined as acot(x) = atan(1/x) |
acoth(x) | Calculate the hyperbolic arccotangent of a value, defined as acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2 |
acsc(x) | Calculate the inverse cosecant of a value, defined as acsc(x) = asin(1/x) |
acsch(x) | Calculate the hyperbolic arccosecant of a value, defined as acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1)) |
asec(x) | Calculate the inverse secant of a value |
asech(x) | Calculate the hyperbolic arcsecant of a value, defined as asech(x) = acosh(1/x) = ln(sqrt(1/x^2 – 1) + 1/x) |
asin(x) | Calculate the inverse sine of a value |
asinh(x) | Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)) |
atan(x) | Calculate the inverse tangent of a value |
atan2(y, x) | Calculate the inverse tangent function with two arguments, y/x |
atanh(x) | Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 – x)) / 2 |
cos(x) | Calculate the cosine of a value |
cosh(x) | Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 * (exp(x) + exp(-x)) |
cot(x) | Calculate the cotangent of a value |
coth(x) | Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x) |
csc(x) | Calculate the cosecant of a value, defined as csc(x) = 1/sin(x) |
csch(x) | Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x) |
sec(x) | Calculate the secant of a value, defined as sec(x) = 1/cos(x) |
sech(x) | Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x) |
sin(x) | Calculate the sine of a value |
sinh(x) | Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) – exp(-x)) |
tan(x) | Calculate the tangent of a value |
tanh(x) | Calculate the hyperbolic tangent of a value, defined as tanh(x)=(exp(2 * x) – 1)/(exp(2 * x)+1) |
Function | What it does |
hasNumericValue(x) | Test whether a value is a numeric value |
isInteger(x) | Test whether a value is an integer number |
isNaN(x) | Test whether a value is NaN (not a number) |
isNegative(x) | Test whether a value is negative: smaller than zero |
isNumeric(x) | Test whether a value is an numeric value |
isPositive(x) | Test whether a value is positive: larger than zero |
isPrime(x) | Test whether a value is prime: has no divisors other than itself and one |
isZero(x) | Test whether a value is zero |
Contents