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

132
node_modules/mathjs/lib/esm/expression/Help.js generated vendored Normal file
View File

@@ -0,0 +1,132 @@
import { isHelp } from '../utils/is.js';
import { clone } from '../utils/object.js';
import { format } from '../utils/string.js';
import { factory } from '../utils/factory.js';
var name = 'Help';
var dependencies = ['evaluate'];
export var createHelpClass = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
evaluate
} = _ref;
/**
* Documentation object
* @param {Object} doc Object containing properties:
* {string} name
* {string} category
* {string} description
* {string[]} syntax
* {string[]} examples
* {string[]} seealso
* @constructor
*/
function Help(doc) {
if (!(this instanceof Help)) {
throw new SyntaxError('Constructor must be called with the new operator');
}
if (!doc) throw new Error('Argument "doc" missing');
this.doc = doc;
}
/**
* Attach type information
*/
Help.prototype.type = 'Help';
Help.prototype.isHelp = true;
/**
* Generate a string representation of the Help object
* @return {string} Returns a string
* @private
*/
Help.prototype.toString = function () {
var doc = this.doc || {};
var desc = '\n';
if (doc.name) {
desc += 'Name: ' + doc.name + '\n\n';
}
if (doc.category) {
desc += 'Category: ' + doc.category + '\n\n';
}
if (doc.description) {
desc += 'Description:\n ' + doc.description + '\n\n';
}
if (doc.syntax) {
desc += 'Syntax:\n ' + doc.syntax.join('\n ') + '\n\n';
}
if (doc.examples) {
desc += 'Examples:\n';
// after evaluating the examples, we restore config in case the examples
// did change the config.
var configChanged = false;
var originalConfig = evaluate('config()');
var scope = {
config: newConfig => {
configChanged = true;
return evaluate('config(newConfig)', {
newConfig
});
}
};
for (var i = 0; i < doc.examples.length; i++) {
var expr = doc.examples[i];
desc += ' ' + expr + '\n';
var res = void 0;
try {
// note: res can be undefined when `expr` is an empty string
res = evaluate(expr, scope);
} catch (e) {
res = e;
}
if (res !== undefined && !isHelp(res)) {
desc += ' ' + format(res, {
precision: 14
}) + '\n';
}
}
desc += '\n';
if (configChanged) {
evaluate('config(originalConfig)', {
originalConfig
});
}
}
if (doc.mayThrow && doc.mayThrow.length) {
desc += 'Throws: ' + doc.mayThrow.join(', ') + '\n\n';
}
if (doc.seealso && doc.seealso.length) {
desc += 'See also: ' + doc.seealso.join(', ') + '\n';
}
return desc;
};
/**
* Export the help object to JSON
*/
Help.prototype.toJSON = function () {
var obj = clone(this.doc);
obj.mathjs = 'Help';
return obj;
};
/**
* Instantiate a Help object from a JSON object
* @param {Object} json
* @returns {Help} Returns a new Help object
*/
Help.fromJSON = function (json) {
var doc = {};
Object.keys(json).filter(prop => prop !== 'mathjs').forEach(prop => {
doc[prop] = json[prop];
});
return new Help(doc);
};
/**
* Returns a string representation of the Help object
*/
Help.prototype.valueOf = Help.prototype.toString;
return Help;
}, {
isClass: true
});

160
node_modules/mathjs/lib/esm/expression/Parser.js generated vendored Normal file
View File

@@ -0,0 +1,160 @@
import { factory } from '../utils/factory.js';
import { createEmptyMap, toObject } from '../utils/map.js';
var name = 'Parser';
var dependencies = ['evaluate', 'parse'];
export var createParserClass = /* #__PURE__ */factory(name, dependencies, _ref => {
var {
evaluate,
parse
} = _ref;
/**
* @constructor Parser
* Parser contains methods to evaluate or parse expressions, and has a number
* of convenience methods to get, set, and remove variables from memory. Parser
* keeps a scope containing variables in memory, which is used for all
* evaluations.
*
* Methods:
* const result = parser.evaluate(expr) // evaluate an expression
* const value = parser.get(name) // retrieve a variable from the parser
* const values = parser.getAll() // retrieve all defined variables
* parser.set(name, value) // set a variable in the parser
* parser.remove(name) // clear a variable from the
* // parsers scope
* parser.clear() // clear the parsers scope
*
* Example usage:
* const parser = new Parser()
* // Note: there is a convenience method which can be used instead:
* // const parser = new math.parser()
*
* // evaluate expressions
* parser.evaluate('sqrt(3^2 + 4^2)') // 5
* parser.evaluate('sqrt(-4)') // 2i
* parser.evaluate('2 inch in cm') // 5.08 cm
* parser.evaluate('cos(45 deg)') // 0.7071067811865476
*
* // define variables and functions
* parser.evaluate('x = 7 / 2') // 3.5
* parser.evaluate('x + 3') // 6.5
* parser.evaluate('f(x, y) = x^y') // f(x, y)
* parser.evaluate('f(2, 3)') // 8
*
* // get and set variables and functions
* const x = parser.get('x') // 3.5
* const f = parser.get('f') // function
* const g = f(3, 2) // 9
* parser.set('h', 500)
* const i = parser.evaluate('h / 2') // 250
* parser.set('hello', function (name) {
* return 'hello, ' + name + '!'
* })
* parser.evaluate('hello("user")') // "hello, user!"
*
* // clear defined functions and variables
* parser.clear()
*
*/
function Parser() {
if (!(this instanceof Parser)) {
throw new SyntaxError('Constructor must be called with the new operator');
}
Object.defineProperty(this, 'scope', {
value: createEmptyMap(),
writable: false
});
}
/**
* Attach type information
*/
Parser.prototype.type = 'Parser';
Parser.prototype.isParser = true;
/**
* Parse and evaluate the given expression
* @param {string | string[]} expr A string containing an expression,
* for example "2+3", or a list with expressions
* @return {*} result The result, or undefined when the expression was empty
* @throws {Error}
*/
Parser.prototype.evaluate = function (expr) {
// TODO: validate arguments
return evaluate(expr, this.scope);
};
/**
* Get a variable (a function or variable) by name from the parsers scope.
* Returns undefined when not found
* @param {string} name
* @return {* | undefined} value
*/
Parser.prototype.get = function (name) {
// TODO: validate arguments
if (this.scope.has(name)) {
return this.scope.get(name);
}
};
/**
* Get a map with all defined variables
* @return {Object} values
*/
Parser.prototype.getAll = function () {
return toObject(this.scope);
};
/**
* Get a map with all defined variables
* @return {Map} values
*/
Parser.prototype.getAllAsMap = function () {
return this.scope;
};
function isValidVariableName(name) {
if (name.length === 0) {
return false;
}
for (var i = 0; i < name.length; i++) {
var cPrev = name.charAt(i - 1);
var c = name.charAt(i);
var cNext = name.charAt(i + 1);
var valid = parse.isAlpha(c, cPrev, cNext) || i > 0 && parse.isDigit(c);
if (!valid) {
return false;
}
}
return true;
}
/**
* Set a symbol (a function or variable) by name from the parsers scope.
* @param {string} name
* @param {* | undefined} value
*/
Parser.prototype.set = function (name, value) {
if (!isValidVariableName(name)) {
throw new Error("Invalid variable name: '".concat(name, "'. Variable names must follow the specified rules."));
}
this.scope.set(name, value);
return value;
};
/**
* Remove a variable from the parsers scope
* @param {string} name
*/
Parser.prototype.remove = function (name) {
this.scope.delete(name);
};
/**
* Clear the scope with variables and functions
*/
Parser.prototype.clear = function () {
this.scope.clear();
};
return Parser;
}, {
isClass: true
});

View File

@@ -0,0 +1,8 @@
export var InfinityDocs = {
name: 'Infinity',
category: 'Constants',
syntax: ['Infinity'],
description: 'Infinity, a number which is larger than the maximum number that can be handled by a floating point number.',
examples: ['Infinity', '1 / 0'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var LN10Docs = {
name: 'LN10',
category: 'Constants',
syntax: ['LN10'],
description: 'Returns the natural logarithm of 10, approximately equal to 2.302',
examples: ['LN10', 'log(10)'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var LN2Docs = {
name: 'LN2',
category: 'Constants',
syntax: ['LN2'],
description: 'Returns the natural logarithm of 2, approximately equal to 0.693',
examples: ['LN2', 'log(2)'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var LOG10EDocs = {
name: 'LOG10E',
category: 'Constants',
syntax: ['LOG10E'],
description: 'Returns the base-10 logarithm of E, approximately equal to 0.434',
examples: ['LOG10E', 'log(e, 10)'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var LOG2EDocs = {
name: 'LOG2E',
category: 'Constants',
syntax: ['LOG2E'],
description: 'Returns the base-2 logarithm of E, approximately equal to 1.442',
examples: ['LOG2E', 'log(e, 2)'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var NaNDocs = {
name: 'NaN',
category: 'Constants',
syntax: ['NaN'],
description: 'Not a number',
examples: ['NaN', '0 / 0'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var SQRT12Docs = {
name: 'SQRT1_2',
category: 'Constants',
syntax: ['SQRT1_2'],
description: 'Returns the square root of 1/2, approximately equal to 0.707',
examples: ['SQRT1_2', 'sqrt(1/2)'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var SQRT2Docs = {
name: 'SQRT2',
category: 'Constants',
syntax: ['SQRT2'],
description: 'Returns the square root of 2, approximately equal to 1.414',
examples: ['SQRT2', 'sqrt(2)'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var eDocs = {
name: 'e',
category: 'Constants',
syntax: ['e'],
description: 'Euler\'s number, the base of the natural logarithm. Approximately equal to 2.71828',
examples: ['e', 'e ^ 2', 'exp(2)', 'log(e)'],
seealso: ['exp']
};

View File

@@ -0,0 +1,8 @@
export var falseDocs = {
name: 'false',
category: 'Constants',
syntax: ['false'],
description: 'Boolean value false',
examples: ['false'],
seealso: ['true']
};

View File

@@ -0,0 +1,8 @@
export var iDocs = {
name: 'i',
category: 'Constants',
syntax: ['i'],
description: 'Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.',
examples: ['i', 'i * i', 'sqrt(-1)'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var nullDocs = {
name: 'null',
category: 'Constants',
syntax: ['null'],
description: 'Value null',
examples: ['null'],
seealso: ['true', 'false']
};

View File

@@ -0,0 +1,8 @@
export var phiDocs = {
name: 'phi',
category: 'Constants',
syntax: ['phi'],
description: 'Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...',
examples: ['phi'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var piDocs = {
name: 'pi',
category: 'Constants',
syntax: ['pi'],
description: 'The number pi is a mathematical constant that is the ratio of a circle\'s circumference to its diameter, and is approximately equal to 3.14159',
examples: ['pi', 'sin(pi/2)'],
seealso: ['tau']
};

View File

@@ -0,0 +1,8 @@
export var tauDocs = {
name: 'tau',
category: 'Constants',
syntax: ['tau'],
description: 'Tau is the ratio constant of a circle\'s circumference to radius, equal to 2 * pi, approximately 6.2832.',
examples: ['tau', '2 * pi'],
seealso: ['pi']
};

View File

@@ -0,0 +1,8 @@
export var trueDocs = {
name: 'true',
category: 'Constants',
syntax: ['true'],
description: 'Boolean value true',
examples: ['true'],
seealso: ['false']
};

View File

@@ -0,0 +1,8 @@
export var versionDocs = {
name: 'version',
category: 'Constants',
syntax: ['version'],
description: 'A string with the version number of math.js',
examples: ['version'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var bigintDocs = {
name: 'bigint',
category: 'Construction',
syntax: ['bigint(x)'],
description: 'Create a bigint, an integer with an arbitrary number of digits, from a number or string.',
examples: ['123123123123123123 # a large number will lose digits', 'bigint("123123123123123123")', 'bignumber(["1", "3", "5"])'],
seealso: ['boolean', 'bignumber', 'number', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var bignumberDocs = {
name: 'bignumber',
category: 'Construction',
syntax: ['bignumber(x)'],
description: 'Create a big number from a number or string.',
examples: ['0.1 + 0.2', 'bignumber(0.1) + bignumber(0.2)', 'bignumber("7.2")', 'bignumber("7.2e500")', 'bignumber([0.1, 0.2, 0.3])'],
seealso: ['boolean', 'bigint', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var booleanDocs = {
name: 'boolean',
category: 'Construction',
syntax: ['x', 'boolean(x)'],
description: 'Convert a string or number into a boolean.',
examples: ['boolean(0)', 'boolean(1)', 'boolean(3)', 'boolean("true")', 'boolean("false")', 'boolean([1, 0, 1, 1])'],
seealso: ['bignumber', 'complex', 'index', 'matrix', 'number', 'string', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var complexDocs = {
name: 'complex',
category: 'Construction',
syntax: ['complex()', 'complex(re, im)', 'complex(string)'],
description: 'Create a complex number.',
examples: ['complex()', 'complex(2, 3)', 'complex("7 - 2i")'],
seealso: ['bignumber', 'boolean', 'index', 'matrix', 'number', 'string', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var createUnitDocs = {
name: 'createUnit',
category: 'Construction',
syntax: ['createUnit(definitions)', 'createUnit(name, definition)'],
description: 'Create a user-defined unit and register it with the Unit type.',
examples: ['createUnit("foo")', 'createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})', 'createUnit("mph", "1 mile/hour")'],
seealso: ['unit', 'splitUnit']
};

View File

@@ -0,0 +1,8 @@
export var fractionDocs = {
name: 'fraction',
category: 'Construction',
syntax: ['fraction(num)', 'fraction(matrix)', 'fraction(num,den)', 'fraction({n: num, d: den})'],
description: 'Create a fraction from a number or from integer numerator and denominator.',
examples: ['fraction(0.125)', 'fraction(1, 3) + fraction(2, 5)', 'fraction({n: 333, d: 53})', 'fraction([sqrt(9), sqrt(10), sqrt(11)])'],
seealso: ['bignumber', 'boolean', 'complex', 'index', 'matrix', 'string', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var indexDocs = {
name: 'index',
category: 'Construction',
syntax: ['[start]', '[start:end]', '[start:step:end]', '[start1, start 2, ...]', '[start1:end1, start2:end2, ...]', '[start1:step1:end1, start2:step2:end2, ...]'],
description: 'Create an index to get or replace a subset of a matrix',
examples: ['A = [1, 2, 3; 4, 5, 6]', 'A[1, :]', 'A[1, 2] = 50', 'A[1:2, 1:2] = 1', 'B = [1, 2, 3]', 'B[B>1 and B<3]'],
seealso: ['bignumber', 'boolean', 'complex', 'matrix,', 'number', 'range', 'string', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var matrixDocs = {
name: 'matrix',
category: 'Construction',
syntax: ['[]', '[a1, b1, ...; a2, b2, ...]', 'matrix()', 'matrix("dense")', 'matrix([...])'],
description: 'Create a matrix.',
examples: ['[]', '[1, 2, 3]', '[1, 2, 3; 4, 5, 6]', 'matrix()', 'matrix([3, 4])', 'matrix([3, 4; 5, 6], "sparse")', 'matrix([3, 4; 5, 6], "sparse", "number")'],
seealso: ['bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit', 'sparse']
};

View File

@@ -0,0 +1,8 @@
export var numberDocs = {
name: 'number',
category: 'Construction',
syntax: ['x', 'number(x)', 'number(unit, valuelessUnit)'],
description: 'Create a number or convert a string or boolean into a number.',
examples: ['2', '2e3', '4.05', 'number(2)', 'number("7.2")', 'number(true)', 'number([true, false, true, true])', 'number(unit("52cm"), "m")'],
seealso: ['bignumber', 'bigint', 'boolean', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var sparseDocs = {
name: 'sparse',
category: 'Construction',
syntax: ['sparse()', 'sparse([a1, b1, ...; a1, b2, ...])', 'sparse([a1, b1, ...; a1, b2, ...], "number")'],
description: 'Create a sparse matrix.',
examples: ['sparse()', 'sparse([3, 4; 5, 6])', 'sparse([3, 0; 5, 0], "number")'],
seealso: ['bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit', 'matrix']
};

View File

@@ -0,0 +1,8 @@
export var splitUnitDocs = {
name: 'splitUnit',
category: 'Construction',
syntax: ['splitUnit(unit: Unit, parts: Unit[])'],
description: 'Split a unit in an array of units whose sum is equal to the original unit.',
examples: ['splitUnit(1 m, ["feet", "inch"])'],
seealso: ['unit', 'createUnit']
};

View File

@@ -0,0 +1,8 @@
export var stringDocs = {
name: 'string',
category: 'Construction',
syntax: ['"text"', 'string(x)'],
description: 'Create a string or convert a value to a string',
examples: ['"Hello World!"', 'string(4.2)', 'string(3 + 2i)'],
seealso: ['bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'unit']
};

View File

@@ -0,0 +1,8 @@
export var unitDocs = {
name: 'unit',
category: 'Construction',
syntax: ['value unit', 'unit(value, unit)', 'unit(string)'],
description: 'Create a unit.',
examples: ['5.5 mm', '3 inch', 'unit(7.1, "kilogram")', 'unit("23 deg")'],
seealso: ['bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'string']
};

View File

@@ -0,0 +1,8 @@
export var configDocs = {
name: 'config',
category: 'Core',
syntax: ['config()', 'config(options)'],
description: 'Get configuration or change configuration.',
examples: ['config()', '1/3 + 1/4', 'config({number: "Fraction"})', '1/3 + 1/4'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var importDocs = {
name: 'import',
category: 'Core',
syntax: ['import(functions)', 'import(functions, options)'],
description: 'Import functions or constants from an object.',
examples: ['import({myFn: f(x)=x^2, myConstant: 32 })', 'myFn(2)', 'myConstant'],
seealso: []
};

View File

@@ -0,0 +1,8 @@
export var typedDocs = {
name: 'typed',
category: 'Core',
syntax: ['typed(signatures)', 'typed(name, signatures)'],
description: 'Create a typed function.',
examples: ['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })', 'double(2)', 'double("hello")'],
seealso: []
};

View File

@@ -0,0 +1,720 @@
import { eDocs } from './constants/e.js';
import { falseDocs } from './constants/false.js';
import { iDocs } from './constants/i.js';
import { InfinityDocs } from './constants/Infinity.js';
import { LN10Docs } from './constants/LN10.js';
import { LN2Docs } from './constants/LN2.js';
import { LOG10EDocs } from './constants/LOG10E.js';
import { LOG2EDocs } from './constants/LOG2E.js';
import { NaNDocs } from './constants/NaN.js';
import { nullDocs } from './constants/null.js';
import { phiDocs } from './constants/phi.js';
import { piDocs } from './constants/pi.js';
import { SQRT12Docs } from './constants/SQRT1_2.js';
import { SQRT2Docs } from './constants/SQRT2.js';
import { tauDocs } from './constants/tau.js';
import { trueDocs } from './constants/true.js';
import { versionDocs } from './constants/version.js';
import { bignumberDocs } from './construction/bignumber.js';
import { bigintDocs } from './construction/bigint.js';
import { booleanDocs } from './construction/boolean.js';
import { complexDocs } from './construction/complex.js';
import { createUnitDocs } from './construction/createUnit.js';
import { fractionDocs } from './construction/fraction.js';
import { indexDocs } from './construction/index.js';
import { matrixDocs } from './construction/matrix.js';
import { numberDocs } from './construction/number.js';
import { sparseDocs } from './construction/sparse.js';
import { splitUnitDocs } from './construction/splitUnit.js';
import { stringDocs } from './construction/string.js';
import { unitDocs } from './construction/unit.js';
import { configDocs } from './core/config.js';
import { importDocs } from './core/import.js';
import { typedDocs } from './core/typed.js';
import { derivativeDocs } from './function/algebra/derivative.js';
import { leafCountDocs } from './function/algebra/leafCount.js';
import { lsolveDocs } from './function/algebra/lsolve.js';
import { lsolveAllDocs } from './function/algebra/lsolveAll.js';
import { lupDocs } from './function/algebra/lup.js';
import { lusolveDocs } from './function/algebra/lusolve.js';
import { polynomialRootDocs } from './function/algebra/polynomialRoot.js';
import { qrDocs } from './function/algebra/qr.js';
import { rationalizeDocs } from './function/algebra/rationalize.js';
import { resolveDocs } from './function/algebra/resolve.js';
import { simplifyDocs } from './function/algebra/simplify.js';
import { simplifyConstantDocs } from './function/algebra/simplifyConstant.js';
import { simplifyCoreDocs } from './function/algebra/simplifyCore.js';
import { sluDocs } from './function/algebra/slu.js';
import { symbolicEqualDocs } from './function/algebra/symbolicEqual.js';
import { usolveDocs } from './function/algebra/usolve.js';
import { usolveAllDocs } from './function/algebra/usolveAll.js';
import { absDocs } from './function/arithmetic/abs.js';
import { addDocs } from './function/arithmetic/add.js';
import { cbrtDocs } from './function/arithmetic/cbrt.js';
import { ceilDocs } from './function/arithmetic/ceil.js';
import { cubeDocs } from './function/arithmetic/cube.js';
import { divideDocs } from './function/arithmetic/divide.js';
import { dotDivideDocs } from './function/arithmetic/dotDivide.js';
import { dotMultiplyDocs } from './function/arithmetic/dotMultiply.js';
import { dotPowDocs } from './function/arithmetic/dotPow.js';
import { expDocs } from './function/arithmetic/exp.js';
import { expmDocs } from './function/arithmetic/expm.js';
import { expm1Docs } from './function/arithmetic/expm1.js';
import { fixDocs } from './function/arithmetic/fix.js';
import { floorDocs } from './function/arithmetic/floor.js';
import { gcdDocs } from './function/arithmetic/gcd.js';
import { hypotDocs } from './function/arithmetic/hypot.js';
import { invmodDocs } from './function/arithmetic/invmod.js';
import { lcmDocs } from './function/arithmetic/lcm.js';
import { logDocs } from './function/arithmetic/log.js';
import { log10Docs } from './function/arithmetic/log10.js';
import { log1pDocs } from './function/arithmetic/log1p.js';
import { log2Docs } from './function/arithmetic/log2.js';
import { modDocs } from './function/arithmetic/mod.js';
import { multiplyDocs } from './function/arithmetic/multiply.js';
import { normDocs } from './function/arithmetic/norm.js';
import { nthRootDocs } from './function/arithmetic/nthRoot.js';
import { nthRootsDocs } from './function/arithmetic/nthRoots.js';
import { powDocs } from './function/arithmetic/pow.js';
import { roundDocs } from './function/arithmetic/round.js';
import { signDocs } from './function/arithmetic/sign.js';
import { sqrtDocs } from './function/arithmetic/sqrt.js';
import { sqrtmDocs } from './function/arithmetic/sqrtm.js';
import { sylvesterDocs } from './function/algebra/sylvester.js';
import { schurDocs } from './function/algebra/schur.js';
import { lyapDocs } from './function/algebra/lyap.js';
import { squareDocs } from './function/arithmetic/square.js';
import { subtractDocs } from './function/arithmetic/subtract.js';
import { unaryMinusDocs } from './function/arithmetic/unaryMinus.js';
import { unaryPlusDocs } from './function/arithmetic/unaryPlus.js';
import { xgcdDocs } from './function/arithmetic/xgcd.js';
import { bitAndDocs } from './function/bitwise/bitAnd.js';
import { bitNotDocs } from './function/bitwise/bitNot.js';
import { bitOrDocs } from './function/bitwise/bitOr.js';
import { bitXorDocs } from './function/bitwise/bitXor.js';
import { leftShiftDocs } from './function/bitwise/leftShift.js';
import { rightArithShiftDocs } from './function/bitwise/rightArithShift.js';
import { rightLogShiftDocs } from './function/bitwise/rightLogShift.js';
import { bellNumbersDocs } from './function/combinatorics/bellNumbers.js';
import { catalanDocs } from './function/combinatorics/catalan.js';
import { compositionDocs } from './function/combinatorics/composition.js';
import { stirlingS2Docs } from './function/combinatorics/stirlingS2.js';
import { argDocs } from './function/complex/arg.js';
import { conjDocs } from './function/complex/conj.js';
import { imDocs } from './function/complex/im.js';
import { reDocs } from './function/complex/re.js';
import { evaluateDocs } from './function/expression/evaluate.js';
import { helpDocs } from './function/expression/help.js';
import { distanceDocs } from './function/geometry/distance.js';
import { intersectDocs } from './function/geometry/intersect.js';
import { andDocs } from './function/logical/and.js';
import { notDocs } from './function/logical/not.js';
import { orDocs } from './function/logical/or.js';
import { xorDocs } from './function/logical/xor.js';
import { columnDocs } from './function/matrix/column.js';
import { concatDocs } from './function/matrix/concat.js';
import { countDocs } from './function/matrix/count.js';
import { crossDocs } from './function/matrix/cross.js';
import { ctransposeDocs } from './function/matrix/ctranspose.js';
import { detDocs } from './function/matrix/det.js';
import { diagDocs } from './function/matrix/diag.js';
import { diffDocs } from './function/matrix/diff.js';
import { dotDocs } from './function/matrix/dot.js';
import { eigsDocs } from './function/matrix/eigs.js';
import { filterDocs } from './function/matrix/filter.js';
import { flattenDocs } from './function/matrix/flatten.js';
import { forEachDocs } from './function/matrix/forEach.js';
import { getMatrixDataTypeDocs } from './function/matrix/getMatrixDataType.js';
import { identityDocs } from './function/matrix/identity.js';
import { invDocs } from './function/matrix/inv.js';
import { pinvDocs } from './function/matrix/pinv.js';
import { kronDocs } from './function/matrix/kron.js';
import { mapDocs } from './function/matrix/map.js';
import { matrixFromColumnsDocs } from './function/matrix/matrixFromColumns.js';
import { matrixFromFunctionDocs } from './function/matrix/matrixFromFunction.js';
import { matrixFromRowsDocs } from './function/matrix/matrixFromRows.js';
import { onesDocs } from './function/matrix/ones.js';
import { partitionSelectDocs } from './function/matrix/partitionSelect.js';
import { rangeDocs } from './function/matrix/range.js';
import { reshapeDocs } from './function/matrix/reshape.js';
import { resizeDocs } from './function/matrix/resize.js';
import { rotateDocs } from './function/matrix/rotate.js';
import { rotationMatrixDocs } from './function/matrix/rotationMatrix.js';
import { rowDocs } from './function/matrix/row.js';
import { sizeDocs } from './function/matrix/size.js';
import { sortDocs } from './function/matrix/sort.js';
import { squeezeDocs } from './function/matrix/squeeze.js';
import { subsetDocs } from './function/matrix/subset.js';
import { traceDocs } from './function/matrix/trace.js';
import { transposeDocs } from './function/matrix/transpose.js';
import { zerosDocs } from './function/matrix/zeros.js';
import { fftDocs } from './function/matrix/fft.js';
import { ifftDocs } from './function/matrix/ifft.js';
import { combinationsDocs } from './function/probability/combinations.js';
import { combinationsWithRepDocs } from './function/probability/combinationsWithRep.js';
import { factorialDocs } from './function/probability/factorial.js';
import { gammaDocs } from './function/probability/gamma.js';
import { lgammaDocs } from './function/probability/lgamma.js';
import { kldivergenceDocs } from './function/probability/kldivergence.js';
import { multinomialDocs } from './function/probability/multinomial.js';
import { permutationsDocs } from './function/probability/permutations.js';
import { pickRandomDocs } from './function/probability/pickRandom.js';
import { randomDocs } from './function/probability/random.js';
import { randomIntDocs } from './function/probability/randomInt.js';
import { compareDocs } from './function/relational/compare.js';
import { compareNaturalDocs } from './function/relational/compareNatural.js';
import { compareTextDocs } from './function/relational/compareText.js';
import { deepEqualDocs } from './function/relational/deepEqual.js';
import { equalDocs } from './function/relational/equal.js';
import { equalTextDocs } from './function/relational/equalText.js';
import { largerDocs } from './function/relational/larger.js';
import { largerEqDocs } from './function/relational/largerEq.js';
import { smallerDocs } from './function/relational/smaller.js';
import { smallerEqDocs } from './function/relational/smallerEq.js';
import { unequalDocs } from './function/relational/unequal.js';
import { setCartesianDocs } from './function/set/setCartesian.js';
import { setDifferenceDocs } from './function/set/setDifference.js';
import { setDistinctDocs } from './function/set/setDistinct.js';
import { setIntersectDocs } from './function/set/setIntersect.js';
import { setIsSubsetDocs } from './function/set/setIsSubset.js';
import { setMultiplicityDocs } from './function/set/setMultiplicity.js';
import { setPowersetDocs } from './function/set/setPowerset.js';
import { setSizeDocs } from './function/set/setSize.js';
import { setSymDifferenceDocs } from './function/set/setSymDifference.js';
import { setUnionDocs } from './function/set/setUnion.js';
import { zpk2tfDocs } from './function/signal/zpk2tf.js';
import { freqzDocs } from './function/signal/freqz.js';
import { erfDocs } from './function/special/erf.js';
import { zetaDocs } from './function/special/zeta.js';
import { madDocs } from './function/statistics/mad.js';
import { maxDocs } from './function/statistics/max.js';
import { meanDocs } from './function/statistics/mean.js';
import { medianDocs } from './function/statistics/median.js';
import { minDocs } from './function/statistics/min.js';
import { modeDocs } from './function/statistics/mode.js';
import { prodDocs } from './function/statistics/prod.js';
import { quantileSeqDocs } from './function/statistics/quantileSeq.js';
import { stdDocs } from './function/statistics/std.js';
import { cumSumDocs } from './function/statistics/cumsum.js';
import { sumDocs } from './function/statistics/sum.js';
import { varianceDocs } from './function/statistics/variance.js';
import { corrDocs } from './function/statistics/corr.js';
import { acosDocs } from './function/trigonometry/acos.js';
import { acoshDocs } from './function/trigonometry/acosh.js';
import { acotDocs } from './function/trigonometry/acot.js';
import { acothDocs } from './function/trigonometry/acoth.js';
import { acscDocs } from './function/trigonometry/acsc.js';
import { acschDocs } from './function/trigonometry/acsch.js';
import { asecDocs } from './function/trigonometry/asec.js';
import { asechDocs } from './function/trigonometry/asech.js';
import { asinDocs } from './function/trigonometry/asin.js';
import { asinhDocs } from './function/trigonometry/asinh.js';
import { atanDocs } from './function/trigonometry/atan.js';
import { atan2Docs } from './function/trigonometry/atan2.js';
import { atanhDocs } from './function/trigonometry/atanh.js';
import { cosDocs } from './function/trigonometry/cos.js';
import { coshDocs } from './function/trigonometry/cosh.js';
import { cotDocs } from './function/trigonometry/cot.js';
import { cothDocs } from './function/trigonometry/coth.js';
import { cscDocs } from './function/trigonometry/csc.js';
import { cschDocs } from './function/trigonometry/csch.js';
import { secDocs } from './function/trigonometry/sec.js';
import { sechDocs } from './function/trigonometry/sech.js';
import { sinDocs } from './function/trigonometry/sin.js';
import { sinhDocs } from './function/trigonometry/sinh.js';
import { tanDocs } from './function/trigonometry/tan.js';
import { tanhDocs } from './function/trigonometry/tanh.js';
import { toDocs } from './function/units/to.js';
import { binDocs } from './function/utils/bin.js';
import { cloneDocs } from './function/utils/clone.js';
import { formatDocs } from './function/utils/format.js';
import { hasNumericValueDocs } from './function/utils/hasNumericValue.js';
import { hexDocs } from './function/utils/hex.js';
import { isIntegerDocs } from './function/utils/isInteger.js';
import { isNaNDocs } from './function/utils/isNaN.js';
import { isNegativeDocs } from './function/utils/isNegative.js';
import { isNumericDocs } from './function/utils/isNumeric.js';
import { isPositiveDocs } from './function/utils/isPositive.js';
import { isPrimeDocs } from './function/utils/isPrime.js';
import { isZeroDocs } from './function/utils/isZero.js';
import { numericDocs } from './function/utils/numeric.js';
import { octDocs } from './function/utils/oct.js';
import { printDocs } from './function/utils/print.js';
import { typeOfDocs } from './function/utils/typeOf.js';
import { solveODEDocs } from './function/numeric/solveODE.js';
export var embeddedDocs = {
// construction functions
bignumber: bignumberDocs,
bigint: bigintDocs,
boolean: booleanDocs,
complex: complexDocs,
createUnit: createUnitDocs,
fraction: fractionDocs,
index: indexDocs,
matrix: matrixDocs,
number: numberDocs,
sparse: sparseDocs,
splitUnit: splitUnitDocs,
string: stringDocs,
unit: unitDocs,
// constants
e: eDocs,
E: eDocs,
false: falseDocs,
i: iDocs,
Infinity: InfinityDocs,
LN2: LN2Docs,
LN10: LN10Docs,
LOG2E: LOG2EDocs,
LOG10E: LOG10EDocs,
NaN: NaNDocs,
null: nullDocs,
pi: piDocs,
PI: piDocs,
phi: phiDocs,
SQRT1_2: SQRT12Docs,
SQRT2: SQRT2Docs,
tau: tauDocs,
true: trueDocs,
version: versionDocs,
// physical constants
// TODO: more detailed docs for physical constants
speedOfLight: {
description: 'Speed of light in vacuum',
examples: ['speedOfLight']
},
gravitationConstant: {
description: 'Newtonian constant of gravitation',
examples: ['gravitationConstant']
},
planckConstant: {
description: 'Planck constant',
examples: ['planckConstant']
},
reducedPlanckConstant: {
description: 'Reduced Planck constant',
examples: ['reducedPlanckConstant']
},
magneticConstant: {
description: 'Magnetic constant (vacuum permeability)',
examples: ['magneticConstant']
},
electricConstant: {
description: 'Electric constant (vacuum permeability)',
examples: ['electricConstant']
},
vacuumImpedance: {
description: 'Characteristic impedance of vacuum',
examples: ['vacuumImpedance']
},
coulomb: {
description: 'Coulomb\'s constant',
examples: ['coulomb']
},
elementaryCharge: {
description: 'Elementary charge',
examples: ['elementaryCharge']
},
bohrMagneton: {
description: 'Bohr magneton',
examples: ['bohrMagneton']
},
conductanceQuantum: {
description: 'Conductance quantum',
examples: ['conductanceQuantum']
},
inverseConductanceQuantum: {
description: 'Inverse conductance quantum',
examples: ['inverseConductanceQuantum']
},
// josephson: {description: 'Josephson constant', examples: ['josephson']},
magneticFluxQuantum: {
description: 'Magnetic flux quantum',
examples: ['magneticFluxQuantum']
},
nuclearMagneton: {
description: 'Nuclear magneton',
examples: ['nuclearMagneton']
},
klitzing: {
description: 'Von Klitzing constant',
examples: ['klitzing']
},
bohrRadius: {
description: 'Bohr radius',
examples: ['bohrRadius']
},
classicalElectronRadius: {
description: 'Classical electron radius',
examples: ['classicalElectronRadius']
},
electronMass: {
description: 'Electron mass',
examples: ['electronMass']
},
fermiCoupling: {
description: 'Fermi coupling constant',
examples: ['fermiCoupling']
},
fineStructure: {
description: 'Fine-structure constant',
examples: ['fineStructure']
},
hartreeEnergy: {
description: 'Hartree energy',
examples: ['hartreeEnergy']
},
protonMass: {
description: 'Proton mass',
examples: ['protonMass']
},
deuteronMass: {
description: 'Deuteron Mass',
examples: ['deuteronMass']
},
neutronMass: {
description: 'Neutron mass',
examples: ['neutronMass']
},
quantumOfCirculation: {
description: 'Quantum of circulation',
examples: ['quantumOfCirculation']
},
rydberg: {
description: 'Rydberg constant',
examples: ['rydberg']
},
thomsonCrossSection: {
description: 'Thomson cross section',
examples: ['thomsonCrossSection']
},
weakMixingAngle: {
description: 'Weak mixing angle',
examples: ['weakMixingAngle']
},
efimovFactor: {
description: 'Efimov factor',
examples: ['efimovFactor']
},
atomicMass: {
description: 'Atomic mass constant',
examples: ['atomicMass']
},
avogadro: {
description: 'Avogadro\'s number',
examples: ['avogadro']
},
boltzmann: {
description: 'Boltzmann constant',
examples: ['boltzmann']
},
faraday: {
description: 'Faraday constant',
examples: ['faraday']
},
firstRadiation: {
description: 'First radiation constant',
examples: ['firstRadiation']
},
loschmidt: {
description: 'Loschmidt constant at T=273.15 K and p=101.325 kPa',
examples: ['loschmidt']
},
gasConstant: {
description: 'Gas constant',
examples: ['gasConstant']
},
molarPlanckConstant: {
description: 'Molar Planck constant',
examples: ['molarPlanckConstant']
},
molarVolume: {
description: 'Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa',
examples: ['molarVolume']
},
sackurTetrode: {
description: 'Sackur-Tetrode constant at T=1 K and p=101.325 kPa',
examples: ['sackurTetrode']
},
secondRadiation: {
description: 'Second radiation constant',
examples: ['secondRadiation']
},
stefanBoltzmann: {
description: 'Stefan-Boltzmann constant',
examples: ['stefanBoltzmann']
},
wienDisplacement: {
description: 'Wien displacement law constant',
examples: ['wienDisplacement']
},
// spectralRadiance: {description: 'First radiation constant for spectral radiance', examples: ['spectralRadiance']},
molarMass: {
description: 'Molar mass constant',
examples: ['molarMass']
},
molarMassC12: {
description: 'Molar mass constant of carbon-12',
examples: ['molarMassC12']
},
gravity: {
description: 'Standard acceleration of gravity (standard acceleration of free-fall on Earth)',
examples: ['gravity']
},
planckLength: {
description: 'Planck length',
examples: ['planckLength']
},
planckMass: {
description: 'Planck mass',
examples: ['planckMass']
},
planckTime: {
description: 'Planck time',
examples: ['planckTime']
},
planckCharge: {
description: 'Planck charge',
examples: ['planckCharge']
},
planckTemperature: {
description: 'Planck temperature',
examples: ['planckTemperature']
},
// functions - algebra
derivative: derivativeDocs,
lsolve: lsolveDocs,
lsolveAll: lsolveAllDocs,
lup: lupDocs,
lusolve: lusolveDocs,
leafCount: leafCountDocs,
polynomialRoot: polynomialRootDocs,
resolve: resolveDocs,
simplify: simplifyDocs,
simplifyConstant: simplifyConstantDocs,
simplifyCore: simplifyCoreDocs,
symbolicEqual: symbolicEqualDocs,
rationalize: rationalizeDocs,
slu: sluDocs,
usolve: usolveDocs,
usolveAll: usolveAllDocs,
qr: qrDocs,
// functions - arithmetic
abs: absDocs,
add: addDocs,
cbrt: cbrtDocs,
ceil: ceilDocs,
cube: cubeDocs,
divide: divideDocs,
dotDivide: dotDivideDocs,
dotMultiply: dotMultiplyDocs,
dotPow: dotPowDocs,
exp: expDocs,
expm: expmDocs,
expm1: expm1Docs,
fix: fixDocs,
floor: floorDocs,
gcd: gcdDocs,
hypot: hypotDocs,
lcm: lcmDocs,
log: logDocs,
log2: log2Docs,
log1p: log1pDocs,
log10: log10Docs,
mod: modDocs,
multiply: multiplyDocs,
norm: normDocs,
nthRoot: nthRootDocs,
nthRoots: nthRootsDocs,
pow: powDocs,
round: roundDocs,
sign: signDocs,
sqrt: sqrtDocs,
sqrtm: sqrtmDocs,
square: squareDocs,
subtract: subtractDocs,
unaryMinus: unaryMinusDocs,
unaryPlus: unaryPlusDocs,
xgcd: xgcdDocs,
invmod: invmodDocs,
// functions - bitwise
bitAnd: bitAndDocs,
bitNot: bitNotDocs,
bitOr: bitOrDocs,
bitXor: bitXorDocs,
leftShift: leftShiftDocs,
rightArithShift: rightArithShiftDocs,
rightLogShift: rightLogShiftDocs,
// functions - combinatorics
bellNumbers: bellNumbersDocs,
catalan: catalanDocs,
composition: compositionDocs,
stirlingS2: stirlingS2Docs,
// functions - core
config: configDocs,
import: importDocs,
typed: typedDocs,
// functions - complex
arg: argDocs,
conj: conjDocs,
re: reDocs,
im: imDocs,
// functions - expression
evaluate: evaluateDocs,
help: helpDocs,
// functions - geometry
distance: distanceDocs,
intersect: intersectDocs,
// functions - logical
and: andDocs,
not: notDocs,
or: orDocs,
xor: xorDocs,
// functions - matrix
concat: concatDocs,
count: countDocs,
cross: crossDocs,
column: columnDocs,
ctranspose: ctransposeDocs,
det: detDocs,
diag: diagDocs,
diff: diffDocs,
dot: dotDocs,
getMatrixDataType: getMatrixDataTypeDocs,
identity: identityDocs,
filter: filterDocs,
flatten: flattenDocs,
forEach: forEachDocs,
inv: invDocs,
pinv: pinvDocs,
eigs: eigsDocs,
kron: kronDocs,
matrixFromFunction: matrixFromFunctionDocs,
matrixFromRows: matrixFromRowsDocs,
matrixFromColumns: matrixFromColumnsDocs,
map: mapDocs,
ones: onesDocs,
partitionSelect: partitionSelectDocs,
range: rangeDocs,
resize: resizeDocs,
reshape: reshapeDocs,
rotate: rotateDocs,
rotationMatrix: rotationMatrixDocs,
row: rowDocs,
size: sizeDocs,
sort: sortDocs,
squeeze: squeezeDocs,
subset: subsetDocs,
trace: traceDocs,
transpose: transposeDocs,
zeros: zerosDocs,
fft: fftDocs,
ifft: ifftDocs,
sylvester: sylvesterDocs,
schur: schurDocs,
lyap: lyapDocs,
// functions - numeric
solveODE: solveODEDocs,
// functions - probability
combinations: combinationsDocs,
combinationsWithRep: combinationsWithRepDocs,
// distribution: distributionDocs,
factorial: factorialDocs,
gamma: gammaDocs,
kldivergence: kldivergenceDocs,
lgamma: lgammaDocs,
multinomial: multinomialDocs,
permutations: permutationsDocs,
pickRandom: pickRandomDocs,
random: randomDocs,
randomInt: randomIntDocs,
// functions - relational
compare: compareDocs,
compareNatural: compareNaturalDocs,
compareText: compareTextDocs,
deepEqual: deepEqualDocs,
equal: equalDocs,
equalText: equalTextDocs,
larger: largerDocs,
largerEq: largerEqDocs,
smaller: smallerDocs,
smallerEq: smallerEqDocs,
unequal: unequalDocs,
// functions - set
setCartesian: setCartesianDocs,
setDifference: setDifferenceDocs,
setDistinct: setDistinctDocs,
setIntersect: setIntersectDocs,
setIsSubset: setIsSubsetDocs,
setMultiplicity: setMultiplicityDocs,
setPowerset: setPowersetDocs,
setSize: setSizeDocs,
setSymDifference: setSymDifferenceDocs,
setUnion: setUnionDocs,
// functions - signal
zpk2tf: zpk2tfDocs,
freqz: freqzDocs,
// functions - special
erf: erfDocs,
zeta: zetaDocs,
// functions - statistics
cumsum: cumSumDocs,
mad: madDocs,
max: maxDocs,
mean: meanDocs,
median: medianDocs,
min: minDocs,
mode: modeDocs,
prod: prodDocs,
quantileSeq: quantileSeqDocs,
std: stdDocs,
sum: sumDocs,
variance: varianceDocs,
corr: corrDocs,
// functions - trigonometry
acos: acosDocs,
acosh: acoshDocs,
acot: acotDocs,
acoth: acothDocs,
acsc: acscDocs,
acsch: acschDocs,
asec: asecDocs,
asech: asechDocs,
asin: asinDocs,
asinh: asinhDocs,
atan: atanDocs,
atanh: atanhDocs,
atan2: atan2Docs,
cos: cosDocs,
cosh: coshDocs,
cot: cotDocs,
coth: cothDocs,
csc: cscDocs,
csch: cschDocs,
sec: secDocs,
sech: sechDocs,
sin: sinDocs,
sinh: sinhDocs,
tan: tanDocs,
tanh: tanhDocs,
// functions - units
to: toDocs,
// functions - utils
clone: cloneDocs,
format: formatDocs,
bin: binDocs,
oct: octDocs,
hex: hexDocs,
isNaN: isNaNDocs,
isInteger: isIntegerDocs,
isNegative: isNegativeDocs,
isNumeric: isNumericDocs,
hasNumericValue: hasNumericValueDocs,
isPositive: isPositiveDocs,
isPrime: isPrimeDocs,
isZero: isZeroDocs,
print: printDocs,
typeOf: typeOfDocs,
numeric: numericDocs
};

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']
};

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