feat:node-modules

This commit is contained in:
houjunxiang
2025-11-24 10:26:18 +08:00
parent 753766893b
commit 8a3e48d856
8825 changed files with 567399 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
export var derivativeDocs = {
name: 'derivative',
category: 'Algebra',
syntax: ['derivative(expr, variable)', 'derivative(expr, variable, {simplify: boolean})'],
description: 'Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.',
examples: ['derivative("2x^3", "x")', 'derivative("2x^3", "x", {simplify: false})', 'derivative("2x^2 + 3x + 4", "x")', 'derivative("sin(2x)", "x")', 'f = parse("x^2 + x")', 'x = parse("x")', 'df = derivative(f, x)', 'df.evaluate({x: 3})'],
seealso: ['simplify', 'parse', 'evaluate']
};

View File

@@ -0,0 +1,8 @@
export var leafCountDocs = {
name: 'leafCount',
category: 'Algebra',
syntax: ['leafCount(expr)'],
description: 'Computes the number of leaves in the parse tree of the given expression',
examples: ['leafCount("e^(i*pi)-1")', 'leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],
seealso: ['simplify']
};

View File

@@ -0,0 +1,8 @@
export var lsolveDocs = {
name: 'lsolve',
category: 'Algebra',
syntax: ['x=lsolve(L, b)'],
description: 'Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.',
examples: ['a = [-2, 3; 2, 1]', 'b = [11, 9]', 'x = lsolve(a, b)'],
seealso: ['lsolveAll', 'lup', 'lusolve', 'usolve', 'matrix', 'sparse']
};

View File

@@ -0,0 +1,8 @@
export var lsolveAllDocs = {
name: 'lsolveAll',
category: 'Algebra',
syntax: ['x=lsolveAll(L, b)'],
description: 'Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.',
examples: ['a = [-2, 3; 2, 1]', 'b = [11, 9]', 'x = lsolve(a, b)'],
seealso: ['lsolve', 'lup', 'lusolve', 'usolve', 'matrix', 'sparse']
};

View File

@@ -0,0 +1,8 @@
export var lupDocs = {
name: 'lup',
category: 'Algebra',
syntax: ['lup(m)'],
description: 'Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U',
examples: ['lup([[2, 1], [1, 4]])', 'lup(matrix([[2, 1], [1, 4]]))', 'lup(sparse([[2, 1], [1, 4]]))'],
seealso: ['lusolve', 'lsolve', 'usolve', 'matrix', 'sparse', 'slu', 'qr']
};

View File

@@ -0,0 +1,8 @@
export var lusolveDocs = {
name: 'lusolve',
category: 'Algebra',
syntax: ['x=lusolve(A, b)', 'x=lusolve(lu, b)'],
description: 'Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.',
examples: ['a = [-2, 3; 2, 1]', 'b = [11, 9]', 'x = lusolve(a, b)'],
seealso: ['lup', 'slu', 'lsolve', 'usolve', 'matrix', 'sparse']
};

View File

@@ -0,0 +1,8 @@
export var lyapDocs = {
name: 'lyap',
category: 'Algebra',
syntax: ['lyap(A,Q)'],
description: 'Solves the Continuous-time Lyapunov equation AP+PA\'+Q=0 for P',
examples: ['lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])', 'A = [[-2, 0], [1, -4]]', 'Q = [[3, 1], [1, 3]]', 'lyap(A,Q)'],
seealso: ['schur', 'sylvester']
};

View File

@@ -0,0 +1,8 @@
export var polynomialRootDocs = {
name: 'polynomialRoot',
category: 'Algebra',
syntax: ['x=polynomialRoot(-6, 3)', 'x=polynomialRoot(4, -4, 1)', 'x=polynomialRoot(-8, 12, -6, 1)'],
description: 'Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.',
examples: ['a = polynomialRoot(-6, 11, -6, 1)'],
seealso: ['cbrt', 'sqrt']
};

View File

@@ -0,0 +1,8 @@
export var qrDocs = {
name: 'qr',
category: 'Algebra',
syntax: ['qr(A)'],
description: 'Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.',
examples: ['qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])'],
seealso: ['lup', 'slu', 'matrix']
};

View File

@@ -0,0 +1,8 @@
export var rationalizeDocs = {
name: 'rationalize',
category: 'Algebra',
syntax: ['rationalize(expr)', 'rationalize(expr, scope)', 'rationalize(expr, scope, detailed)'],
description: 'Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.',
examples: ['rationalize("2x/y - y/(x+1)")', 'rationalize("2x/y - y/(x+1)", true)'],
seealso: ['simplify']
};

View File

@@ -0,0 +1,9 @@
export var resolveDocs = {
name: 'resolve',
category: 'Algebra',
syntax: ['resolve(node, scope)'],
description: 'Recursively substitute variables in an expression tree.',
examples: ['resolve(parse("1 + x"), { x: 7 })', 'resolve(parse("size(text)"), { text: "Hello World" })', 'resolve(parse("x + y"), { x: parse("3z") })', 'resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],
seealso: ['simplify', 'evaluate'],
mayThrow: ['ReferenceError']
};

View File

@@ -0,0 +1,8 @@
export var schurDocs = {
name: 'schur',
category: 'Algebra',
syntax: ['schur(A)'],
description: 'Performs a real Schur decomposition of the real matrix A = UTU\'',
examples: ['schur([[1, 0], [-4, 3]])', 'A = [[1, 0], [-4, 3]]', 'schur(A)'],
seealso: ['lyap', 'sylvester']
};

View File

@@ -0,0 +1,8 @@
export var simplifyDocs = {
name: 'simplify',
category: 'Algebra',
syntax: ['simplify(expr)', 'simplify(expr, rules)'],
description: 'Simplify an expression tree.',
examples: ['simplify("3 + 2 / 4")', 'simplify("2x + x")', 'f = parse("x * (x + 2 + x)")', 'simplified = simplify(f)', 'simplified.evaluate({x: 2})'],
seealso: ['simplifyCore', 'derivative', 'evaluate', 'parse', 'rationalize', 'resolve']
};

View File

@@ -0,0 +1,8 @@
export var simplifyConstantDocs = {
name: 'simplifyConstant',
category: 'Algebra',
syntax: ['simplifyConstant(expr)', 'simplifyConstant(expr, options)'],
description: 'Replace constant subexpressions of node with their values.',
examples: ['simplifyConstant("(3-3)*x")', 'simplifyConstant(parse("z-cos(tau/8)"))'],
seealso: ['simplify', 'simplifyCore', 'evaluate']
};

View File

@@ -0,0 +1,8 @@
export var simplifyCoreDocs = {
name: 'simplifyCore',
category: 'Algebra',
syntax: ['simplifyCore(node)'],
description: 'Perform simple one-pass simplifications on an expression tree.',
examples: ['simplifyCore(parse("0*x"))', 'simplifyCore(parse("(x+0)*2"))'],
seealso: ['simplify', 'simplifyConstant', 'evaluate']
};

View File

@@ -0,0 +1,8 @@
export var sluDocs = {
name: 'slu',
category: 'Algebra',
syntax: ['slu(A, order, threshold)'],
description: 'Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U',
examples: ['slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)'],
seealso: ['lusolve', 'lsolve', 'usolve', 'matrix', 'sparse', 'lup', 'qr']
};

View File

@@ -0,0 +1,8 @@
export var sylvesterDocs = {
name: 'sylvester',
category: 'Algebra',
syntax: ['sylvester(A,B,C)'],
description: 'Solves the real-valued Sylvester equation AX+XB=C for X',
examples: ['sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])', 'A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]', 'sylvester(A, B, C)'],
seealso: ['schur', 'lyap']
};

View File

@@ -0,0 +1,8 @@
export var symbolicEqualDocs = {
name: 'symbolicEqual',
category: 'Algebra',
syntax: ['symbolicEqual(expr1, expr2)', 'symbolicEqual(expr1, expr2, options)'],
description: 'Returns true if the difference of the expressions simplifies to 0',
examples: ['symbolicEqual("x*y","y*x")', 'symbolicEqual("abs(x^2)", "x^2")', 'symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],
seealso: ['simplify', 'evaluate']
};

View File

@@ -0,0 +1,8 @@
export var usolveDocs = {
name: 'usolve',
category: 'Algebra',
syntax: ['x=usolve(U, b)'],
description: 'Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.',
examples: ['x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])'],
seealso: ['usolveAll', 'lup', 'lusolve', 'lsolve', 'matrix', 'sparse']
};

View File

@@ -0,0 +1,8 @@
export var usolveAllDocs = {
name: 'usolveAll',
category: 'Algebra',
syntax: ['x=usolve(U, b)'],
description: 'Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.',
examples: ['x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])'],
seealso: ['usolve', 'lup', 'lusolve', 'lsolve', 'matrix', 'sparse']
};

View File

@@ -0,0 +1,8 @@
export var absDocs = {
name: 'abs',
category: 'Arithmetic',
syntax: ['abs(x)'],
description: 'Compute the absolute value.',
examples: ['abs(3.5)', 'abs(-4.2)'],
seealso: ['sign']
};

View File

@@ -0,0 +1,8 @@
export var addDocs = {
name: 'add',
category: 'Operators',
syntax: ['x + y', 'add(x, y)'],
description: 'Add two values.',
examples: ['a = 2.1 + 3.6', 'a - 3.6', '3 + 2i', '3 cm + 2 inch', '"2.3" + "4"'],
seealso: ['subtract']
};

View File

@@ -0,0 +1,8 @@
export var cbrtDocs = {
name: 'cbrt',
category: 'Arithmetic',
syntax: ['cbrt(x)', 'cbrt(x, allRoots)'],
description: 'Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned',
examples: ['cbrt(64)', 'cube(4)', 'cbrt(-8)', 'cbrt(2 + 3i)', 'cbrt(8i)', 'cbrt(8i, true)', 'cbrt(27 m^3)'],
seealso: ['square', 'sqrt', 'cube', 'multiply']
};

View File

@@ -0,0 +1,8 @@
export var ceilDocs = {
name: 'ceil',
category: 'Arithmetic',
syntax: ['ceil(x)'],
description: 'Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.',
examples: ['ceil(3.2)', 'ceil(3.8)', 'ceil(-4.2)'],
seealso: ['floor', 'fix', 'round']
};

View File

@@ -0,0 +1,8 @@
export var cubeDocs = {
name: 'cube',
category: 'Arithmetic',
syntax: ['cube(x)'],
description: 'Compute the cube of a value. The cube of x is x * x * x.',
examples: ['cube(2)', '2^3', '2 * 2 * 2'],
seealso: ['multiply', 'square', 'pow']
};

View File

@@ -0,0 +1,8 @@
export var divideDocs = {
name: 'divide',
category: 'Operators',
syntax: ['x / y', 'divide(x, y)'],
description: 'Divide two values.',
examples: ['a = 2 / 3', 'a * 3', '4.5 / 2', '3 + 4 / 2', '(3 + 4) / 2', '18 km / 4.5'],
seealso: ['multiply']
};

View File

@@ -0,0 +1,8 @@
export var dotDivideDocs = {
name: 'dotDivide',
category: 'Operators',
syntax: ['x ./ y', 'dotDivide(x, y)'],
description: 'Divide two values element wise.',
examples: ['a = [1, 2, 3; 4, 5, 6]', 'b = [2, 1, 1; 3, 2, 5]', 'a ./ b'],
seealso: ['multiply', 'dotMultiply', 'divide']
};

View File

@@ -0,0 +1,8 @@
export var dotMultiplyDocs = {
name: 'dotMultiply',
category: 'Operators',
syntax: ['x .* y', 'dotMultiply(x, y)'],
description: 'Multiply two values element wise.',
examples: ['a = [1, 2, 3; 4, 5, 6]', 'b = [2, 1, 1; 3, 2, 5]', 'a .* b'],
seealso: ['multiply', 'divide', 'dotDivide']
};

View File

@@ -0,0 +1,8 @@
export var dotPowDocs = {
name: 'dotPow',
category: 'Operators',
syntax: ['x .^ y', 'dotPow(x, y)'],
description: 'Calculates the power of x to y element wise.',
examples: ['a = [1, 2, 3; 4, 5, 6]', 'a .^ 2'],
seealso: ['pow']
};

View File

@@ -0,0 +1,8 @@
export var expDocs = {
name: 'exp',
category: 'Arithmetic',
syntax: ['exp(x)'],
description: 'Calculate the exponent of a value.',
examples: ['exp(1.3)', 'e ^ 1.3', 'log(exp(1.3))', 'x = 2.4', '(exp(i*x) == cos(x) + i*sin(x)) # Euler\'s formula'],
seealso: ['expm', 'expm1', 'pow', 'log']
};

View File

@@ -0,0 +1,8 @@
export var expmDocs = {
name: 'expm',
category: 'Arithmetic',
syntax: ['exp(x)'],
description: 'Compute the matrix exponential, expm(A) = e^A. ' + 'The matrix must be square. ' + 'Not to be confused with exp(a), which performs element-wise exponentiation.',
examples: ['expm([[0,2],[0,0]])'],
seealso: ['exp']
};

View File

@@ -0,0 +1,8 @@
export var expm1Docs = {
name: 'expm1',
category: 'Arithmetic',
syntax: ['expm1(x)'],
description: 'Calculate the value of subtracting 1 from the exponential value.',
examples: ['expm1(2)', 'pow(e, 2) - 1', 'log(expm1(2) + 1)'],
seealso: ['exp', 'pow', 'log']
};

View File

@@ -0,0 +1,8 @@
export var fixDocs = {
name: 'fix',
category: 'Arithmetic',
syntax: ['fix(x)'],
description: 'Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.',
examples: ['fix(3.2)', 'fix(3.8)', 'fix(-4.2)', 'fix(-4.8)'],
seealso: ['ceil', 'floor', 'round']
};

View File

@@ -0,0 +1,8 @@
export var floorDocs = {
name: 'floor',
category: 'Arithmetic',
syntax: ['floor(x)'],
description: 'Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.',
examples: ['floor(3.2)', 'floor(3.8)', 'floor(-4.2)'],
seealso: ['ceil', 'fix', 'round']
};

View File

@@ -0,0 +1,8 @@
export var gcdDocs = {
name: 'gcd',
category: 'Arithmetic',
syntax: ['gcd(a, b)', 'gcd(a, b, c, ...)'],
description: 'Compute the greatest common divisor.',
examples: ['gcd(8, 12)', 'gcd(-4, 6)', 'gcd(25, 15, -10)'],
seealso: ['lcm', 'xgcd']
};

View File

@@ -0,0 +1,8 @@
export var hypotDocs = {
name: 'hypot',
category: 'Arithmetic',
syntax: ['hypot(a, b, c, ...)', 'hypot([a, b, c, ...])'],
description: 'Calculate the hypotenuse of a list with values.',
examples: ['hypot(3, 4)', 'sqrt(3^2 + 4^2)', 'hypot(-2)', 'hypot([3, 4, 5])'],
seealso: ['abs', 'norm']
};

View File

@@ -0,0 +1,8 @@
export var invmodDocs = {
name: 'invmod',
category: 'Arithmetic',
syntax: ['invmod(a, b)'],
description: 'Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)',
examples: ['invmod(8, 12)', 'invmod(7, 13)', 'invmod(15151, 15122)'],
seealso: ['gcd', 'xgcd']
};

View File

@@ -0,0 +1,8 @@
export var lcmDocs = {
name: 'lcm',
category: 'Arithmetic',
syntax: ['lcm(x, y)'],
description: 'Compute the least common multiple.',
examples: ['lcm(4, 6)', 'lcm(6, 21)', 'lcm(6, 21, 5)'],
seealso: ['gcd']
};

View File

@@ -0,0 +1,8 @@
export var logDocs = {
name: 'log',
category: 'Arithmetic',
syntax: ['log(x)', 'log(x, base)'],
description: 'Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).',
examples: ['log(3.5)', 'a = log(2.4)', 'exp(a)', '10 ^ 4', 'log(10000, 10)', 'log(10000) / log(10)', 'b = log(1024, 2)', '2 ^ b'],
seealso: ['exp', 'log1p', 'log2', 'log10']
};

View File

@@ -0,0 +1,8 @@
export var log10Docs = {
name: 'log10',
category: 'Arithmetic',
syntax: ['log10(x)'],
description: 'Compute the 10-base logarithm of a value.',
examples: ['log10(0.00001)', 'log10(10000)', '10 ^ 4', 'log(10000) / log(10)', 'log(10000, 10)'],
seealso: ['exp', 'log']
};

View File

@@ -0,0 +1,8 @@
export var log1pDocs = {
name: 'log1p',
category: 'Arithmetic',
syntax: ['log1p(x)', 'log1p(x, base)'],
description: 'Calculate the logarithm of a `value+1`',
examples: ['log1p(2.5)', 'exp(log1p(1.4))', 'pow(10, 4)', 'log1p(9999, 10)', 'log1p(9999) / log(10)'],
seealso: ['exp', 'log', 'log2', 'log10']
};

View File

@@ -0,0 +1,8 @@
export var log2Docs = {
name: 'log2',
category: 'Arithmetic',
syntax: ['log2(x)'],
description: 'Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.',
examples: ['log2(0.03125)', 'log2(16)', 'log2(16) / log2(2)', 'pow(2, 4)'],
seealso: ['exp', 'log1p', 'log', 'log10']
};

View File

@@ -0,0 +1,8 @@
export var modDocs = {
name: 'mod',
category: 'Operators',
syntax: ['x % y', 'x mod y', 'mod(x, y)'],
description: 'Calculates the modulus, the remainder of an integer division.',
examples: ['7 % 3', '11 % 2', '10 mod 4', 'isOdd(x) = x % 2', 'isOdd(2)', 'isOdd(3)'],
seealso: ['divide']
};

View File

@@ -0,0 +1,8 @@
export var multiplyDocs = {
name: 'multiply',
category: 'Operators',
syntax: ['x * y', 'multiply(x, y)'],
description: 'multiply two values.',
examples: ['a = 2.1 * 3.4', 'a / 3.4', '2 * 3 + 4', '2 * (3 + 4)', '3 * 2.1 km'],
seealso: ['divide']
};

View File

@@ -0,0 +1,7 @@
export var normDocs = {
name: 'norm',
category: 'Arithmetic',
syntax: ['norm(x)', 'norm(x, p)'],
description: 'Calculate the norm of a number, vector or matrix.',
examples: ['abs(-3.5)', 'norm(-3.5)', 'norm(3 - 4i)', 'norm([1, 2, -3], Infinity)', 'norm([1, 2, -3], -Infinity)', 'norm([3, 4], 2)', 'norm([[1, 2], [3, 4]], 1)', 'norm([[1, 2], [3, 4]], "inf")', 'norm([[1, 2], [3, 4]], "fro")']
};

View File

@@ -0,0 +1,8 @@
export var nthRootDocs = {
name: 'nthRoot',
category: 'Arithmetic',
syntax: ['nthRoot(a)', 'nthRoot(a, root)'],
description: 'Calculate the nth root of a value. ' + 'The principal nth root of a positive real number A, ' + 'is the positive real solution of the equation "x^root = A".',
examples: ['4 ^ 3', 'nthRoot(64, 3)', 'nthRoot(9, 2)', 'sqrt(9)'],
seealso: ['nthRoots', 'pow', 'sqrt']
};

View File

@@ -0,0 +1,8 @@
export var nthRootsDocs = {
name: 'nthRoots',
category: 'Arithmetic',
syntax: ['nthRoots(A)', 'nthRoots(A, root)'],
description: '' + 'Calculate the nth roots of a value. ' + 'An nth root of a positive real number A, ' + 'is a positive real solution of the equation "x^root = A". ' + 'This function returns an array of complex values.',
examples: ['nthRoots(1)', 'nthRoots(1, 3)'],
seealso: ['sqrt', 'pow', 'nthRoot']
};

View File

@@ -0,0 +1,8 @@
export var powDocs = {
name: 'pow',
category: 'Operators',
syntax: ['x ^ y', 'pow(x, y)'],
description: 'Calculates the power of x to y, x^y.',
examples: ['2^3', '2*2*2', '1 + e ^ (pi * i)', 'pow([[1, 2], [4, 3]], 2)', 'pow([[1, 2], [4, 3]], -1)'],
seealso: ['multiply', 'nthRoot', 'nthRoots', 'sqrt']
};

View File

@@ -0,0 +1,8 @@
export var roundDocs = {
name: 'round',
category: 'Arithmetic',
syntax: ['round(x)', 'round(x, n)', 'round(unit, valuelessUnit)', 'round(unit, n, valuelessUnit)'],
description: 'round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.',
examples: ['round(3.2)', 'round(3.8)', 'round(-4.2)', 'round(-4.8)', 'round(pi, 3)', 'round(123.45678, 2)', 'round(3.241cm, 2, cm)', 'round([3.2, 3.8, -4.7])'],
seealso: ['ceil', 'floor', 'fix']
};

View File

@@ -0,0 +1,8 @@
export var signDocs = {
name: 'sign',
category: 'Arithmetic',
syntax: ['sign(x)'],
description: 'Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.',
examples: ['sign(3.5)', 'sign(-4.2)', 'sign(0)'],
seealso: ['abs']
};

View File

@@ -0,0 +1,8 @@
export var sqrtDocs = {
name: 'sqrt',
category: 'Arithmetic',
syntax: ['sqrt(x)'],
description: 'Compute the square root value. If x = y * y, then y is the square root of x.',
examples: ['sqrt(25)', '5 * 5', 'sqrt(-1)'],
seealso: ['square', 'sqrtm', 'multiply', 'nthRoot', 'nthRoots', 'pow']
};

View File

@@ -0,0 +1,8 @@
export var sqrtmDocs = {
name: 'sqrtm',
category: 'Arithmetic',
syntax: ['sqrtm(x)'],
description: 'Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.',
examples: ['sqrtm([[33, 24], [48, 57]])'],
seealso: ['sqrt', 'abs', 'square', 'multiply']
};

View File

@@ -0,0 +1,8 @@
export var squareDocs = {
name: 'square',
category: 'Arithmetic',
syntax: ['square(x)'],
description: 'Compute the square of a value. The square of x is x * x.',
examples: ['square(3)', 'sqrt(9)', '3^2', '3 * 3'],
seealso: ['multiply', 'pow', 'sqrt', 'cube']
};

View File

@@ -0,0 +1,8 @@
export var subtractDocs = {
name: 'subtract',
category: 'Operators',
syntax: ['x - y', 'subtract(x, y)'],
description: 'subtract two values.',
examples: ['a = 5.3 - 2', 'a + 2', '2/3 - 1/6', '2 * 3 - 3', '2.1 km - 500m'],
seealso: ['add']
};

View File

@@ -0,0 +1,8 @@
export var unaryMinusDocs = {
name: 'unaryMinus',
category: 'Operators',
syntax: ['-x', 'unaryMinus(x)'],
description: 'Inverse the sign of a value. Converts booleans and strings to numbers.',
examples: ['-4.5', '-(-5.6)', '-"22"'],
seealso: ['add', 'subtract', 'unaryPlus']
};

View File

@@ -0,0 +1,8 @@
export var unaryPlusDocs = {
name: 'unaryPlus',
category: 'Operators',
syntax: ['+x', 'unaryPlus(x)'],
description: 'Converts booleans and strings to numbers.',
examples: ['+true', '+"2"'],
seealso: ['add', 'subtract', 'unaryMinus']
};

View File

@@ -0,0 +1,8 @@
export var xgcdDocs = {
name: 'xgcd',
category: 'Arithmetic',
syntax: ['xgcd(a, b)'],
description: 'Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.',
examples: ['xgcd(8, 12)', 'gcd(8, 12)', 'xgcd(36163, 21199)'],
seealso: ['gcd', 'lcm']
};

View File

@@ -0,0 +1,8 @@
export var bitAndDocs = {
name: 'bitAnd',
category: 'Bitwise',
syntax: ['x & y', 'bitAnd(x, y)'],
description: 'Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0',
examples: ['5 & 3', 'bitAnd(53, 131)', '[1, 12, 31] & 42'],
seealso: ['bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift']
};

View File

@@ -0,0 +1,8 @@
export var bitNotDocs = {
name: 'bitNot',
category: 'Bitwise',
syntax: ['~x', 'bitNot(x)'],
description: 'Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.',
examples: ['~1', '~2', 'bitNot([2, -3, 4])'],
seealso: ['bitAnd', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift']
};

View File

@@ -0,0 +1,8 @@
export var bitOrDocs = {
name: 'bitOr',
category: 'Bitwise',
syntax: ['x | y', 'bitOr(x, y)'],
description: 'Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.',
examples: ['5 | 3', 'bitOr([1, 2, 3], 4)'],
seealso: ['bitAnd', 'bitNot', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift']
};

View File

@@ -0,0 +1,8 @@
export var bitXorDocs = {
name: 'bitXor',
category: 'Bitwise',
syntax: ['bitXor(x, y)'],
description: 'Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.',
examples: ['bitOr(1, 2)', 'bitXor([2, 3, 4], 4)'],
seealso: ['bitAnd', 'bitNot', 'bitOr', 'leftShift', 'rightArithShift', 'rightLogShift']
};

View File

@@ -0,0 +1,8 @@
export var leftShiftDocs = {
name: 'leftShift',
category: 'Bitwise',
syntax: ['x << y', 'leftShift(x, y)'],
description: 'Bitwise left logical shift of a value x by y number of bits.',
examples: ['4 << 1', '8 >> 1'],
seealso: ['bitAnd', 'bitNot', 'bitOr', 'bitXor', 'rightArithShift', 'rightLogShift']
};

View File

@@ -0,0 +1,8 @@
export var rightArithShiftDocs = {
name: 'rightArithShift',
category: 'Bitwise',
syntax: ['x >> y', 'rightArithShift(x, y)'],
description: 'Bitwise right arithmetic shift of a value x by y number of bits.',
examples: ['8 >> 1', '4 << 1', '-12 >> 2'],
seealso: ['bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightLogShift']
};

View File

@@ -0,0 +1,8 @@
export var rightLogShiftDocs = {
name: 'rightLogShift',
category: 'Bitwise',
syntax: ['x >>> y', 'rightLogShift(x, y)'],
description: 'Bitwise right logical shift of a value x by y number of bits.',
examples: ['8 >>> 1', '4 << 1', '-12 >>> 2'],
seealso: ['bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift']
};

View File

@@ -0,0 +1,8 @@
export var bellNumbersDocs = {
name: 'bellNumbers',
category: 'Combinatorics',
syntax: ['bellNumbers(n)'],
description: 'The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.',
examples: ['bellNumbers(3)', 'bellNumbers(8)'],
seealso: ['stirlingS2']
};

View File

@@ -0,0 +1,8 @@
export var catalanDocs = {
name: 'catalan',
category: 'Combinatorics',
syntax: ['catalan(n)'],
description: 'The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.',
examples: ['catalan(3)', 'catalan(8)'],
seealso: ['bellNumbers']
};

View File

@@ -0,0 +1,8 @@
export var compositionDocs = {
name: 'composition',
category: 'Combinatorics',
syntax: ['composition(n, k)'],
description: 'The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.',
examples: ['composition(5, 3)'],
seealso: ['combinations']
};

View File

@@ -0,0 +1,8 @@
export var stirlingS2Docs = {
name: 'stirlingS2',
category: 'Combinatorics',
syntax: ['stirlingS2(n, k)'],
description: 'he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.',
examples: ['stirlingS2(5, 3)'],
seealso: ['bellNumbers']
};

View File

@@ -0,0 +1,8 @@
export var argDocs = {
name: 'arg',
category: 'Complex',
syntax: ['arg(x)'],
description: 'Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).',
examples: ['arg(2 + 2i)', 'atan2(3, 2)', 'arg(2 + 3i)'],
seealso: ['re', 'im', 'conj', 'abs']
};

View File

@@ -0,0 +1,8 @@
export var conjDocs = {
name: 'conj',
category: 'Complex',
syntax: ['conj(x)'],
description: 'Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.',
examples: ['conj(2 + 3i)', 'conj(2 - 3i)', 'conj(-5.2i)'],
seealso: ['re', 'im', 'abs', 'arg']
};

View File

@@ -0,0 +1,8 @@
export var imDocs = {
name: 'im',
category: 'Complex',
syntax: ['im(x)'],
description: 'Get the imaginary part of a complex number.',
examples: ['im(2 + 3i)', 're(2 + 3i)', 'im(-5.2i)', 'im(2.4)'],
seealso: ['re', 'conj', 'abs', 'arg']
};

View File

@@ -0,0 +1,8 @@
export var reDocs = {
name: 're',
category: 'Complex',
syntax: ['re(x)'],
description: 'Get the real part of a complex number.',
examples: ['re(2 + 3i)', 'im(2 + 3i)', 're(-5.2i)', 're(2.4)'],
seealso: ['im', 'conj', 'abs', 'arg']
};

View File

@@ -0,0 +1,8 @@
export var evaluateDocs = {
name: 'evaluate',
category: 'Expression',
syntax: ['evaluate(expression)', 'evaluate(expression, scope)', 'evaluate([expr1, expr2, expr3, ...])', 'evaluate([expr1, expr2, expr3, ...], scope)'],
description: 'Evaluate an expression or an array with expressions.',
examples: ['evaluate("2 + 3")', 'evaluate("sqrt(16)")', 'evaluate("2 inch to cm")', 'evaluate("sin(x * pi)", { "x": 1/2 })', 'evaluate(["width=2", "height=4","width*height"])'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var helpDocs = {
name: 'help',
category: 'Expression',
syntax: ['help(object)', 'help(string)'],
description: 'Display documentation on a function or data type.',
examples: ['help(sqrt)', 'help("complex")'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var distanceDocs = {
name: 'distance',
category: 'Geometry',
syntax: ['distance([x1, y1], [x2, y2])', 'distance([[x1, y1], [x2, y2]])'],
description: 'Calculates the Euclidean distance between two points.',
examples: ['distance([0,0], [4,4])', 'distance([[0,0], [4,4]])'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var intersectDocs = {
name: 'intersect',
category: 'Geometry',
syntax: ['intersect(expr1, expr2, expr3, expr4)', 'intersect(expr1, expr2, expr3)'],
description: 'Computes the intersection point of lines and/or planes.',
examples: ['intersect([0, 0], [10, 10], [10, 0], [0, 10])', 'intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var andDocs = {
name: 'and',
category: 'Logical',
syntax: ['x and y', 'and(x, y)'],
description: 'Logical and. Test whether two values are both defined with a nonzero/nonempty value.',
examples: ['true and false', 'true and true', '2 and 4'],
seealso: ['not', 'or', 'xor']
};

View File

@@ -0,0 +1,8 @@
export var notDocs = {
name: 'not',
category: 'Logical',
syntax: ['not x', 'not(x)'],
description: 'Logical not. Flips the boolean value of given argument.',
examples: ['not true', 'not false', 'not 2', 'not 0'],
seealso: ['and', 'or', 'xor']
};

View File

@@ -0,0 +1,8 @@
export var orDocs = {
name: 'or',
category: 'Logical',
syntax: ['x or y', 'or(x, y)'],
description: 'Logical or. Test if at least one value is defined with a nonzero/nonempty value.',
examples: ['true or false', 'false or false', '0 or 4'],
seealso: ['not', 'and', 'xor']
};

View File

@@ -0,0 +1,8 @@
export var xorDocs = {
name: 'xor',
category: 'Logical',
syntax: ['x xor y', 'xor(x, y)'],
description: 'Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.',
examples: ['true xor false', 'false xor false', 'true xor true', '0 xor 4'],
seealso: ['not', 'and', 'or']
};

View File

@@ -0,0 +1,8 @@
export var columnDocs = {
name: 'column',
category: 'Matrix',
syntax: ['column(x, index)'],
description: 'Return a column from a matrix or array.',
examples: ['A = [[1, 2], [3, 4]]', 'column(A, 1)', 'column(A, 2)'],
seealso: ['row', 'matrixFromColumns']
};

View File

@@ -0,0 +1,8 @@
export var concatDocs = {
name: 'concat',
category: 'Matrix',
syntax: ['concat(A, B, C, ...)', 'concat(A, B, C, ..., dim)'],
description: 'Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.',
examples: ['A = [1, 2; 5, 6]', 'B = [3, 4; 7, 8]', 'concat(A, B)', 'concat(A, B, 1)', 'concat(A, B, 2)'],
seealso: ['det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros']
};

View File

@@ -0,0 +1,8 @@
export var countDocs = {
name: 'count',
category: 'Matrix',
syntax: ['count(x)'],
description: 'Count the number of elements of a matrix, array or string.',
examples: ['a = [1, 2; 3, 4; 5, 6]', 'count(a)', 'size(a)', 'count("hello world")'],
seealso: ['size']
};

View File

@@ -0,0 +1,8 @@
export var crossDocs = {
name: 'cross',
category: 'Matrix',
syntax: ['cross(A, B)'],
description: 'Calculate the cross product for two vectors in three dimensional space.',
examples: ['cross([1, 1, 0], [0, 1, 1])', 'cross([3, -3, 1], [4, 9, 2])', 'cross([2, 3, 4], [5, 6, 7])'],
seealso: ['multiply', 'dot']
};

View File

@@ -0,0 +1,8 @@
export var ctransposeDocs = {
name: 'ctranspose',
category: 'Matrix',
syntax: ['x\'', 'ctranspose(x)'],
description: 'Complex Conjugate and Transpose a matrix',
examples: ['a = [1, 2, 3; 4, 5, 6]', 'a\'', 'ctranspose(a)'],
seealso: ['concat', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'zeros']
};

View File

@@ -0,0 +1,8 @@
export var detDocs = {
name: 'det',
category: 'Matrix',
syntax: ['det(x)'],
description: 'Calculate the determinant of a matrix',
examples: ['det([1, 2; 3, 4])', 'det([-2, 2, 3; -1, 1, 3; 2, 0, -1])'],
seealso: ['concat', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros']
};

View File

@@ -0,0 +1,8 @@
export var diagDocs = {
name: 'diag',
category: 'Matrix',
syntax: ['diag(x)', 'diag(x, k)'],
description: 'Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.',
examples: ['diag(1:3)', 'diag(1:3, 1)', 'a = [1, 2, 3; 4, 5, 6; 7, 8, 9]', 'diag(a)'],
seealso: ['concat', 'det', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros']
};

View File

@@ -0,0 +1,8 @@
export var diffDocs = {
name: 'diff',
category: 'Matrix',
syntax: ['diff(arr)', 'diff(arr, dim)'],
description: ['Create a new matrix or array with the difference of the passed matrix or array.', 'Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference', 'If no dimension parameter is passed it is assumed as dimension 0', 'Dimension is zero-based in javascript and one-based in the parser', 'Arrays must be \'rectangular\' meaning arrays like [1, 2]', 'If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays'],
examples: ['A = [1, 2, 4, 7, 0]', 'diff(A)', 'diff(A, 1)', 'B = [[1, 2], [3, 4]]', 'diff(B)', 'diff(B, 1)', 'diff(B, 2)', 'diff(B, bignumber(2))', 'diff([[1, 2], matrix([3, 4])], 2)'],
seealso: ['subtract', 'partitionSelect']
};

View File

@@ -0,0 +1,8 @@
export var dotDocs = {
name: 'dot',
category: 'Matrix',
syntax: ['dot(A, B)', 'A * B'],
description: 'Calculate the dot product of two vectors. ' + 'The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] ' + 'is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn',
examples: ['dot([2, 4, 1], [2, 2, 3])', '[2, 4, 1] * [2, 2, 3]'],
seealso: ['multiply', 'cross']
};

View File

@@ -0,0 +1,8 @@
export var eigsDocs = {
name: 'eigs',
category: 'Matrix',
syntax: ['eigs(x)'],
description: 'Calculate the eigenvalues and optionally eigenvectors of a square matrix',
examples: ['eigs([[5, 2.3], [2.3, 1]])', 'eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })'],
seealso: ['inv']
};

View File

@@ -0,0 +1,8 @@
export var fftDocs = {
name: 'fft',
category: 'Matrix',
syntax: ['fft(x)'],
description: 'Calculate N-dimensional Fourier transform',
examples: ['fft([[1, 0], [1, 0]])'],
seealso: ['ifft']
};

View File

@@ -0,0 +1,8 @@
export var filterDocs = {
name: 'filter',
category: 'Matrix',
syntax: ['filter(x, test)'],
description: 'Filter items in a matrix.',
examples: ['isPositive(x) = x > 0', 'filter([6, -2, -1, 4, 3], isPositive)', 'filter([6, -2, 0, 1, 0], x != 0)'],
seealso: ['sort', 'map', 'forEach']
};

View File

@@ -0,0 +1,8 @@
export var flattenDocs = {
name: 'flatten',
category: 'Matrix',
syntax: ['flatten(x)'],
description: 'Flatten a multi dimensional matrix into a single dimensional matrix.',
examples: ['a = [1, 2, 3; 4, 5, 6]', 'size(a)', 'b = flatten(a)', 'size(b)'],
seealso: ['concat', 'resize', 'size', 'squeeze']
};

View File

@@ -0,0 +1,8 @@
export var forEachDocs = {
name: 'forEach',
category: 'Matrix',
syntax: ['forEach(x, callback)'],
description: 'Iterates over all elements of a matrix/array, and executes the given callback function.',
examples: ['numberOfPets = {}', 'addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;', 'forEach(["Dog","Cat","Cat"], addPet)', 'numberOfPets'],
seealso: ['map', 'sort', 'filter']
};

View File

@@ -0,0 +1,8 @@
export var getMatrixDataTypeDocs = {
name: 'getMatrixDataType',
category: 'Matrix',
syntax: ['getMatrixDataType(x)'],
description: 'Find the data type of all elements in a matrix or array, ' + 'for example "number" if all items are a number ' + 'and "Complex" if all values are complex numbers. ' + 'If a matrix contains more than one data type, it will return "mixed".',
examples: ['getMatrixDataType([1, 2, 3])', 'getMatrixDataType([[5 cm], [2 inch]])', 'getMatrixDataType([1, "text"])', 'getMatrixDataType([1, bignumber(4)])'],
seealso: ['matrix', 'sparse', 'typeOf']
};

View File

@@ -0,0 +1,8 @@
export var identityDocs = {
name: 'identity',
category: 'Matrix',
syntax: ['identity(n)', 'identity(m, n)', 'identity([m, n])'],
description: 'Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.',
examples: ['identity(3)', 'identity(3, 5)', 'a = [1, 2, 3; 4, 5, 6]', 'identity(size(a))'],
seealso: ['concat', 'det', 'diag', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros']
};

View File

@@ -0,0 +1,8 @@
export var ifftDocs = {
name: 'ifft',
category: 'Matrix',
syntax: ['ifft(x)'],
description: 'Calculate N-dimensional inverse Fourier transform',
examples: ['ifft([[2, 2], [0, 0]])'],
seealso: ['fft']
};

View File

@@ -0,0 +1,8 @@
export var invDocs = {
name: 'inv',
category: 'Matrix',
syntax: ['inv(x)'],
description: 'Calculate the inverse of a matrix',
examples: ['inv([1, 2; 3, 4])', 'inv(4)', '1 / 4'],
seealso: ['concat', 'det', 'diag', 'identity', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros']
};

View File

@@ -0,0 +1,8 @@
export var kronDocs = {
name: 'kron',
category: 'Matrix',
syntax: ['kron(x, y)'],
description: 'Calculates the Kronecker product of 2 matrices or vectors.',
examples: ['kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])', 'kron([1,1], [2,3,4])'],
seealso: ['multiply', 'dot', 'cross']
};

View File

@@ -0,0 +1,8 @@
export var mapDocs = {
name: 'map',
category: 'Matrix',
syntax: ['map(x, callback)', 'map(x, y, ..., callback)'],
description: 'Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.',
examples: ['map([1, 2, 3], square)', 'map([1, 2], [3, 4], f(a,b) = a + b)'],
seealso: ['filter', 'forEach']
};

Some files were not shown because too many files have changed in this diff Show More