Create a typed-function which checks the types of the arguments and can match them against multiple provided signatures.
构建函数
描述
math.bignumber(x)
Create a BigNumber, which can store numbers with arbitrary precision.
math.boolean(x)
Create a boolean or convert a string or number to a boolean.
math.chain(value)
Wrap any value in a chain, allowing to perform chained operations on the value.
math.complex(re, im)
Create a complex value or convert a value to a complex value.
math.createUnit(units)
Create a user-defined unit and register it with the Unit type.
math.fraction(numerator, denominator)
Create a fraction convert a value to a fraction.
math.index(range1, range2, …)
Create an index.
math.matrix(x)
Create a Matrix.
math.number(value)
Create a number or convert a string, boolean, or unit to a number.
math.sparse(x)
Create a Sparse Matrix.
math.splitUnit(unit, parts)
Split a unit in an array of units whose sum is equal to the original unit.
math.string(value)
Create a string or convert any object into a string.
math.unit(x)
Create a unit.
表达函数
描述
math.compile(expr)
Parse and compile an expression.
math.eval(expr [, scope])
Evaluate an expression.
math.help(search)
Retrieve help on a function or data type.
math.parse(expr [, scope])
Parse an expression.
math.parser()
Create a parser.
代数函数
描述
derivative(expr, variable)
Takes the derivative of an expression expressed in parser Nodes.
math.lsolve(L, b)
Solves the linear equation system by forwards substitution.
math.lup(A)
Calculate the Matrix LU decomposition with partial pivoting.
math.lusolve(A, b)
Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.
math.qr(A)
Calculate the Matrix QR decomposition.
rationalize(expr)
Transform a rationalizable expression in a rational fraction.
simplify(expr)
Simplify an expression tree.
math.slu(A, order, threshold)
Calculate the Sparse Matrix LU decomposition with full pivoting.
math.usolve(U, b)
Solves the linear equation system by backward substitution.
| 算术函数 | 描述 | | math.abs(x) | Calculate the absolute value of a number. | | math.add(x, y) | Add two or more values, x + y. | | math.cbrt(x [, allRoots]) | Calculate the cubic root of a value. | | math.ceil(x) | Round a value towards plus infinity If x is complex, both real and imaginary part are rounded towards plus infinity. | | math.cube(x) | Compute the cube of a value, x * x * x. | | math.divide(x, y) | Divide two values, x / y. | | math.dotDivide(x, y) | Divide two matrices element wise. | | math.dotMultiply(x, y) | Multiply two matrices element wise. | | math.dotPow(x, y) | Calculates the power of x to y element wise. | | math.exp(x) | Calculate the exponent of a value. | | math.expm1(x) | Calculate the value of subtracting 1 from the exponential value. | | math.fix(x) | Round a value towards zero. | | math.floor(x) | Round a value towards minus infinity. | | math.gcd(a, b) | Calculate the greatest common divisor for two or more values or arrays. | | math.hypot(a, b, …) | Calculate the hypotenusa of a list with values. | | math.lcm(a, b) | Calculate the least common multiple for two or more values or arrays. | | math.log(x [, base]) | Calculate the logarithm of a value. | | math.log10(x) | Calculate the 10-base logarithm of a value. | | math.log1p(x) | Calculate the logarithm of a value+1. | | math.log2(x) | Calculate the 2-base of a value. | | math.mod(x, y) | Calculates the modulus, the remainder of an integer division. | | math.multiply(x, y) | Multiply two or more values, x * y. | | math.norm(x [, p]) | Calculate the norm of a number, vector or matrix. | | math.nthRoot(a) | Calculate the nth root of a value. | | math.pow(x, y) | Calculates the power of x to y, x ^ y. | | math.round(x [, n]) | Round a value towards the nearest integer. | | math.sign(x) | Compute the sign of a value. | | math.sqrt(x) | Calculate the square root of a value. | | math.square(x) | Compute the square of a value, x * x. | | math.subtract(x, y) | Subtract two values, x - y. | | math.unaryMinus(x) | Inverse the sign of a value, apply a unary minus operation. | | math.unaryPlus(x) | Unary plus operation. | | math.xgcd(a, b) | Calculate the extended greatest common divisor for two values. |
按位函数
Description
math.bitAnd(x, y)
Bitwise AND two values, x & y.
math.bitNot(x)
Bitwise NOT value, ~x.
math.bitOr(x, y)
Bitwise OR two values, x
math.bitXor(x, y)
Bitwise XOR two values, x ^ y.
math.leftShift(x, y)
Bitwise left logical shift of a value x by y number of bits, x << y.
math.rightArithShift(x, y)
Bitwise right arithmetic shift of a value x by y number of bits, x >> y.
math.rightLogShift(x, y)
Bitwise right logical shift of value x by y number of bits, x >>> y.
Combinatorics functions
Description
math.bellNumbers(n)
The Bell Numbers count the number of partitions of a set.
math.catalan(n)
The Catalan Numbers enumerate combinatorial structures of many different types.
math.composition(n, k)
The composition counts of n into k parts.
math.stirlingS2(n, k)
The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets.
Complex functions
Description
math.arg(x)
Compute the argument of a complex value.
math.conj(x)
Compute the complex conjugate of a complex value.
math.im(x)
Get the imaginary part of a complex number.
math.re(x)
Get the real part of a complex number.
几何函数
Description
math.distance([x1, y1], [x2, y2])
Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces.