mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
Update to standard@13.0.2
This commit is contained in:
parent
01ad85fdef
commit
d8a4f3a00a
22
bin/cli.js
22
bin/cli.js
@ -96,7 +96,7 @@ function completer (text) {
|
||||
|
||||
// scope variables
|
||||
for (const def in scope) {
|
||||
if (scope.hasOwnProperty(def)) {
|
||||
if (hasOwnProperty(scope, def)) {
|
||||
if (def.indexOf(keyword) === 0) {
|
||||
matches.push(def)
|
||||
}
|
||||
@ -113,7 +113,7 @@ function completer (text) {
|
||||
// math functions and constants
|
||||
const ignore = ['expr', 'type']
|
||||
for (const func in math.expression.mathWithTransform) {
|
||||
if (math.expression.mathWithTransform.hasOwnProperty(func)) {
|
||||
if (hasOwnProperty(math.expression.mathWithTransform, func)) {
|
||||
if (func.indexOf(keyword) === 0 && ignore.indexOf(func) === -1) {
|
||||
matches.push(func)
|
||||
}
|
||||
@ -122,24 +122,24 @@ function completer (text) {
|
||||
|
||||
// units
|
||||
const Unit = math.Unit
|
||||
for (let name in Unit.UNITS) {
|
||||
if (Unit.UNITS.hasOwnProperty(name)) {
|
||||
for (const name in Unit.UNITS) {
|
||||
if (hasOwnProperty(Unit.UNITS, name)) {
|
||||
if (name.indexOf(keyword) === 0) {
|
||||
matches.push(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let name in Unit.PREFIXES) {
|
||||
if (Unit.PREFIXES.hasOwnProperty(name)) {
|
||||
for (const name in Unit.PREFIXES) {
|
||||
if (hasOwnProperty(Unit.PREFIXES, name)) {
|
||||
const prefixes = Unit.PREFIXES[name]
|
||||
for (const prefix in prefixes) {
|
||||
if (prefixes.hasOwnProperty(prefix)) {
|
||||
if (hasOwnProperty(prefixes, prefix)) {
|
||||
if (prefix.indexOf(keyword) === 0) {
|
||||
matches.push(prefix)
|
||||
} else if (keyword.indexOf(prefix) === 0) {
|
||||
const unitKeyword = keyword.substring(prefix.length)
|
||||
for (const n in Unit.UNITS) {
|
||||
if (Unit.UNITS.hasOwnProperty(n)) {
|
||||
if (hasOwnProperty(Unit.UNITS, n)) {
|
||||
if (n.indexOf(unitKeyword) === 0 &&
|
||||
Unit.isValuelessUnit(prefix + n)) {
|
||||
matches.push(prefix + n)
|
||||
@ -424,3 +424,9 @@ if (version) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// helper function to safely check whether an object as a property
|
||||
// copy from the function in object.js which is ES6
|
||||
function hasOwnProperty (object, property) {
|
||||
return object && Object.hasOwnProperty.call(object, property)
|
||||
}
|
||||
|
||||
@ -93,6 +93,6 @@ console.log(math.integrate(f, 0, 1)) // outputs 0.6667254718034714
|
||||
console.log(math.evaluate('integrate(x^0.5, x, 0, 1)')) // outputs 0.6667254718034714
|
||||
|
||||
// use the function via the expression parser (2)
|
||||
let scope = {}
|
||||
const scope = {}
|
||||
math.evaluate('f(x) = 2 * x', scope)
|
||||
console.log(math.evaluate('integrate(f(x), x, 0, 2)', scope)) // outputs 4.000000000000003
|
||||
|
||||
@ -24,12 +24,12 @@ const math = create(all)
|
||||
const limitedEvaluate = math.evaluate
|
||||
|
||||
math.import({
|
||||
'import': function () { throw new Error('Function import is disabled') },
|
||||
'createUnit': function () { throw new Error('Function createUnit is disabled') },
|
||||
'evaluate': function () { throw new Error('Function evaluate is disabled') },
|
||||
'parse': function () { throw new Error('Function parse is disabled') },
|
||||
'simplify': function () { throw new Error('Function simplify is disabled') },
|
||||
'derivative': function () { throw new Error('Function derivative is disabled') }
|
||||
import: function () { throw new Error('Function import is disabled') },
|
||||
createUnit: function () { throw new Error('Function createUnit is disabled') },
|
||||
evaluate: function () { throw new Error('Function evaluate is disabled') },
|
||||
parse: function () { throw new Error('Function parse is disabled') },
|
||||
simplify: function () { throw new Error('Function simplify is disabled') },
|
||||
derivative: function () { throw new Error('Function derivative is disabled') }
|
||||
}, { override: true })
|
||||
|
||||
console.log(limitedEvaluate('sqrt(16)')) // Ok, 4
|
||||
|
||||
@ -6,7 +6,7 @@ const math = create(all)
|
||||
function noImport () {
|
||||
throw new Error('function import is disabled.')
|
||||
}
|
||||
math.import({ 'import': noImport }, { override: true })
|
||||
math.import({ import: noImport }, { override: true })
|
||||
|
||||
/**
|
||||
* Evaluate an expression
|
||||
|
||||
@ -36,7 +36,7 @@ print(math.evaluate([
|
||||
|
||||
// provide a scope (just a regular JavaScript Object)
|
||||
console.log('\nevaluate expressions providing a scope with variables and functions')
|
||||
let scope = {
|
||||
const scope = {
|
||||
a: 3,
|
||||
b: 4
|
||||
}
|
||||
@ -84,7 +84,7 @@ console.log('\nprovide a scope')
|
||||
const node2 = math.parse('x^a')
|
||||
const code2 = node2.compile()
|
||||
print(node2.toString()) // "x ^ a"
|
||||
let scope2 = {
|
||||
const scope2 = {
|
||||
x: 3,
|
||||
a: 2
|
||||
}
|
||||
@ -115,7 +115,7 @@ print(code3.evaluate()) // 5
|
||||
// provide a scope for the variable assignment
|
||||
console.log('\nprovide a scope')
|
||||
const code4 = math.compile('a = a + 3')
|
||||
let scope3 = {
|
||||
const scope3 = {
|
||||
a: 7
|
||||
}
|
||||
code4.evaluate(scope3)
|
||||
|
||||
@ -10,7 +10,7 @@ print(evaluate('{"name": "John"}')) // {"name": "John"}
|
||||
// create an object containing an object
|
||||
print(evaluate('{a: 2, b: {c: 3, d: 4}}')) // {"a": 2, "b": {"c": 3, "d": 4}}
|
||||
|
||||
let scope = {
|
||||
const scope = {
|
||||
obj: {
|
||||
prop: 42
|
||||
}
|
||||
|
||||
@ -169,8 +169,6 @@ function minify (done) {
|
||||
|
||||
log('Minified ' + FILE_MIN)
|
||||
log('Mapped ' + FILE_MAP)
|
||||
} catch (e) {
|
||||
throw e
|
||||
} finally {
|
||||
process.chdir(oldCwd)
|
||||
}
|
||||
|
||||
2162
package-lock.json
generated
2162
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -132,7 +132,7 @@
|
||||
"benchmark": "2.1.4",
|
||||
"codecov": "3.5.0",
|
||||
"del": "5.0.0",
|
||||
"expr-eval": "1.2.2",
|
||||
"expr-eval": "1.2.3",
|
||||
"fancy-log": "1.3.3",
|
||||
"glob": "7.1.4",
|
||||
"gulp": "4.0.2",
|
||||
@ -157,7 +157,7 @@
|
||||
"numericjs": "1.2.6",
|
||||
"nyc": "14.1.1",
|
||||
"pad-right": "0.2.2",
|
||||
"standard": "12.0.1",
|
||||
"standard": "13.0.2",
|
||||
"sylvester": "0.0.21",
|
||||
"uglify-js": "3.6.0",
|
||||
"underscore": "1.9.1",
|
||||
|
||||
@ -80,7 +80,7 @@ export function importFactory (typed, load, math, importedFactories) {
|
||||
value.forEach(item => flattenImports(flatValues, item))
|
||||
} else if (typeof value === 'object') {
|
||||
for (const name in value) {
|
||||
if (value.hasOwnProperty(name)) {
|
||||
if (hasOwnProperty(value, name)) {
|
||||
flattenImports(flatValues, value[name], name)
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ export function importFactory (typed, load, math, importedFactories) {
|
||||
flattenImports(flatValues, functions)
|
||||
|
||||
for (const name in flatValues) {
|
||||
if (flatValues.hasOwnProperty(name)) {
|
||||
if (hasOwnProperty(flatValues, name)) {
|
||||
// console.log('import', name)
|
||||
const value = flatValues[name]
|
||||
|
||||
@ -247,7 +247,7 @@ export function importFactory (typed, load, math, importedFactories) {
|
||||
const name = factory.name
|
||||
const existingTransform = name in math.expression.transform
|
||||
const namespace = factory.path ? traverse(math, factory.path) : math
|
||||
const existing = namespace.hasOwnProperty(name) ? namespace[name] : undefined
|
||||
const existing = hasOwnProperty(namespace, name) ? namespace[name] : undefined
|
||||
|
||||
const resolver = function () {
|
||||
let instance = load(factory)
|
||||
@ -329,7 +329,7 @@ export function importFactory (typed, load, math, importedFactories) {
|
||||
: math
|
||||
|
||||
const existingTransform = name in math.expression.transform
|
||||
const existing = namespace.hasOwnProperty(name) ? namespace[name] : undefined
|
||||
const existing = hasOwnProperty(namespace, name) ? namespace[name] : undefined
|
||||
|
||||
const resolver = function () {
|
||||
// collect all dependencies, handle finding both functions and classes and other special cases
|
||||
@ -353,7 +353,7 @@ export function importFactory (typed, load, math, importedFactories) {
|
||||
}
|
||||
})
|
||||
|
||||
let instance = /* #__PURE__ */ factory(dependencies)
|
||||
const instance = /* #__PURE__ */ factory(dependencies)
|
||||
|
||||
if (instance && typeof instance.transform === 'function') {
|
||||
throw new Error('Transforms cannot be attached to factory functions. ' +
|
||||
@ -442,16 +442,16 @@ export function importFactory (typed, load, math, importedFactories) {
|
||||
}
|
||||
|
||||
function allowedInExpressions (name) {
|
||||
return !unsafe.hasOwnProperty(name)
|
||||
return !hasOwnProperty(unsafe, name)
|
||||
}
|
||||
|
||||
function legacyFactoryAllowedInExpressions (factory) {
|
||||
return factory.path === undefined && !unsafe.hasOwnProperty(factory.name)
|
||||
return factory.path === undefined && !hasOwnProperty(unsafe, factory.name)
|
||||
}
|
||||
|
||||
function factoryAllowedInExpressions (factory) {
|
||||
return factory.fn.indexOf('.') === -1 && // FIXME: make checking on path redundant, check on meta data instead
|
||||
!unsafe.hasOwnProperty(factory.fn) &&
|
||||
!hasOwnProperty(unsafe, factory.fn) &&
|
||||
(!factory.meta || !factory.meta.isClass)
|
||||
}
|
||||
|
||||
@ -463,12 +463,12 @@ export function importFactory (typed, load, math, importedFactories) {
|
||||
|
||||
// namespaces and functions not available in the parser for safety reasons
|
||||
const unsafe = {
|
||||
'expression': true,
|
||||
'type': true,
|
||||
'docs': true,
|
||||
'error': true,
|
||||
'json': true,
|
||||
'chain': true // chain method not supported. Note that there is a unit chain too.
|
||||
expression: true,
|
||||
type: true,
|
||||
docs: true,
|
||||
error: true,
|
||||
json: true,
|
||||
chain: true // chain method not supported. Note that there is a unit chain too.
|
||||
}
|
||||
|
||||
return mathImport
|
||||
|
||||
@ -58,7 +58,7 @@ export const createHelpClass = /* #__PURE__ */ factory(name, dependencies, ({ pa
|
||||
if (doc.examples) {
|
||||
desc += 'Examples:\n'
|
||||
|
||||
let scope = {}
|
||||
const scope = {}
|
||||
for (let i = 0; i < doc.examples.length; i++) {
|
||||
const expr = doc.examples[i]
|
||||
desc += ' ' + expr + '\n'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { factory } from '../utils/factory'
|
||||
import { extend } from '../utils/object'
|
||||
import { extend, hasOwnProperty } from '../utils/object'
|
||||
import { getSafeProperty, setSafeProperty } from '../utils/customs'
|
||||
import { warnOnce } from '../utils/log'
|
||||
|
||||
@ -163,7 +163,7 @@ export const createParserClass = /* #__PURE__ */ factory(name, dependencies, ({
|
||||
*/
|
||||
Parser.prototype.clear = function () {
|
||||
for (const name in this.scope) {
|
||||
if (this.scope.hasOwnProperty(name)) {
|
||||
if (hasOwnProperty(this.scope, name)) {
|
||||
delete this.scope[name]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const InfinityDocs = {
|
||||
'name': 'Infinity',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const LN10Docs = {
|
||||
'name': 'LN10',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'LN10',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'LN10'
|
||||
],
|
||||
'description': 'Returns the natural logarithm of 10, approximately equal to 2.302',
|
||||
'examples': [
|
||||
description: 'Returns the natural logarithm of 10, approximately equal to 2.302',
|
||||
examples: [
|
||||
'LN10',
|
||||
'log(10)'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const LN2Docs = {
|
||||
'name': 'LN2',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'LN2',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'LN2'
|
||||
],
|
||||
'description': 'Returns the natural logarithm of 2, approximately equal to 0.693',
|
||||
'examples': [
|
||||
description: 'Returns the natural logarithm of 2, approximately equal to 0.693',
|
||||
examples: [
|
||||
'LN2',
|
||||
'log(2)'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const LOG10EDocs = {
|
||||
'name': 'LOG10E',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'LOG10E',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'LOG10E'
|
||||
],
|
||||
'description': 'Returns the base-10 logarithm of E, approximately equal to 0.434',
|
||||
'examples': [
|
||||
description: 'Returns the base-10 logarithm of E, approximately equal to 0.434',
|
||||
examples: [
|
||||
'LOG10E',
|
||||
'log(e, 10)'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const LOG2EDocs = {
|
||||
'name': 'LOG2E',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'LOG2E',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'LOG2E'
|
||||
],
|
||||
'description': 'Returns the base-2 logarithm of E, approximately equal to 1.442',
|
||||
'examples': [
|
||||
description: 'Returns the base-2 logarithm of E, approximately equal to 1.442',
|
||||
examples: [
|
||||
'LOG2E',
|
||||
'log(e, 2)'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const NaNDocs = {
|
||||
'name': 'NaN',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'NaN',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'NaN'
|
||||
],
|
||||
'description': 'Not a number',
|
||||
'examples': [
|
||||
description: 'Not a number',
|
||||
examples: [
|
||||
'NaN',
|
||||
'0 / 0'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const SQRT12Docs = {
|
||||
'name': 'SQRT1_2',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'SQRT1_2',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'SQRT1_2'
|
||||
],
|
||||
'description': 'Returns the square root of 1/2, approximately equal to 0.707',
|
||||
'examples': [
|
||||
description: 'Returns the square root of 1/2, approximately equal to 0.707',
|
||||
examples: [
|
||||
'SQRT1_2',
|
||||
'sqrt(1/2)'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const SQRT2Docs = {
|
||||
'name': 'SQRT2',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'SQRT2',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'SQRT2'
|
||||
],
|
||||
'description': 'Returns the square root of 2, approximately equal to 1.414',
|
||||
'examples': [
|
||||
description: 'Returns the square root of 2, approximately equal to 1.414',
|
||||
examples: [
|
||||
'SQRT2',
|
||||
'sqrt(2)'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const eDocs = {
|
||||
'name': 'e',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'e',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'e'
|
||||
],
|
||||
'description': 'Euler\'s number, the base of the natural logarithm. Approximately equal to 2.71828',
|
||||
'examples': [
|
||||
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']
|
||||
seealso: ['exp']
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const falseDocs = {
|
||||
'name': 'false',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'false',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'false'
|
||||
],
|
||||
'description': 'Boolean value false',
|
||||
'examples': [
|
||||
description: 'Boolean value false',
|
||||
examples: [
|
||||
'false'
|
||||
],
|
||||
'seealso': ['true']
|
||||
seealso: ['true']
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
export const iDocs = {
|
||||
'name': 'i',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const nullDocs = {
|
||||
'name': 'null',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'null',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'null'
|
||||
],
|
||||
'description': 'Value null',
|
||||
'examples': [
|
||||
description: 'Value null',
|
||||
examples: [
|
||||
'null'
|
||||
],
|
||||
'seealso': ['true', 'false']
|
||||
seealso: ['true', 'false']
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const phiDocs = {
|
||||
'name': 'phi',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const piDocs = {
|
||||
'name': 'pi',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
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': [
|
||||
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']
|
||||
seealso: ['tau']
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const tauDocs = {
|
||||
'name': 'tau',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
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': [
|
||||
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']
|
||||
seealso: ['pi']
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const trueDocs = {
|
||||
'name': 'true',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'true',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'true'
|
||||
],
|
||||
'description': 'Boolean value true',
|
||||
'examples': [
|
||||
description: 'Boolean value true',
|
||||
examples: [
|
||||
'true'
|
||||
],
|
||||
'seealso': ['false']
|
||||
seealso: ['false']
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const versionDocs = {
|
||||
'name': 'version',
|
||||
'category': 'Constants',
|
||||
'syntax': [
|
||||
name: 'version',
|
||||
category: 'Constants',
|
||||
syntax: [
|
||||
'version'
|
||||
],
|
||||
'description': 'A string with the version number of math.js',
|
||||
'examples': [
|
||||
description: 'A string with the version number of math.js',
|
||||
examples: [
|
||||
'version'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const bignumberDocs = {
|
||||
'name': 'bignumber',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'bignumber',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'bignumber(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a big number from a number or string.',
|
||||
'examples': [
|
||||
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': [
|
||||
seealso: [
|
||||
'boolean', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const booleanDocs = {
|
||||
'name': 'boolean',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'boolean',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'x',
|
||||
'boolean(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Convert a string or number into a boolean.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'boolean(0)',
|
||||
'boolean(1)',
|
||||
'boolean(3)',
|
||||
@ -15,7 +15,7 @@ export const booleanDocs = {
|
||||
'boolean("false")',
|
||||
'boolean([1, 0, 1, 1])'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'complex', 'index', 'matrix', 'number', 'string', 'unit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const complexDocs = {
|
||||
'name': 'complex',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'complex',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'complex()',
|
||||
'complex(re, im)',
|
||||
'complex(string)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a complex number.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'complex()',
|
||||
'complex(2, 3)',
|
||||
'complex("7 - 2i")'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'index', 'matrix', 'number', 'string', 'unit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const createUnitDocs = {
|
||||
'name': 'createUnit',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'createUnit',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'createUnit(definitions)',
|
||||
'createUnit(name, definition)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a user-defined unit and register it with the Unit type.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'createUnit("foo")',
|
||||
'createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})',
|
||||
'createUnit("mph", "1 mile/hour")'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'unit', 'splitUnit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const fractionDocs = {
|
||||
'name': 'fraction',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'fraction',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'fraction(num)',
|
||||
'fraction(num,den)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a fraction from a number or from a numerator and denominator.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'fraction(0.125)',
|
||||
'fraction(1, 3) + fraction(2, 5)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'complex', 'index', 'matrix', 'string', 'unit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
export const indexDocs = {
|
||||
'name': 'index',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'index',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'[start]',
|
||||
'[start:end]',
|
||||
'[start:step:end]',
|
||||
@ -9,9 +9,9 @@ export const indexDocs = {
|
||||
'[start1:end1, start2:end2, ...]',
|
||||
'[start1:step1:end1, start2:step2:end2, ...]'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create an index to get or replace a subset of a matrix',
|
||||
'examples': [
|
||||
examples: [
|
||||
'[]',
|
||||
'[1, 2, 3]',
|
||||
'A = [1, 2, 3; 4, 5, 6]',
|
||||
@ -19,7 +19,7 @@ export const indexDocs = {
|
||||
'A[1, 2] = 50',
|
||||
'A[0:2, 0:2] = ones(2, 2)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'complex', 'matrix,', 'number', 'range', 'string', 'unit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const matrixDocs = {
|
||||
'name': 'matrix',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'matrix',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'[]',
|
||||
'[a1, b1, ...; a2, b2, ...]',
|
||||
'matrix()',
|
||||
'matrix("dense")',
|
||||
'matrix([...])'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a matrix.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'[]',
|
||||
'[1, 2, 3]',
|
||||
'[1, 2, 3; 4, 5, 6]',
|
||||
@ -19,7 +19,7 @@ export const matrixDocs = {
|
||||
'matrix([3, 4; 5, 6], "sparse")',
|
||||
'matrix([3, 4; 5, 6], "sparse", "number")'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit', 'sparse'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
export const numberDocs = {
|
||||
'name': 'number',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'number',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'x',
|
||||
'number(x)',
|
||||
'number(unit, valuelessUnit)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a number or convert a string or boolean into a number.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'2',
|
||||
'2e3',
|
||||
'4.05',
|
||||
@ -18,7 +18,7 @@ export const numberDocs = {
|
||||
'number([true, false, true, true])',
|
||||
'number(unit("52cm"), "m")'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const sparseDocs = {
|
||||
'name': 'sparse',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'sparse',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'sparse()',
|
||||
'sparse([a1, b1, ...; a1, b2, ...])',
|
||||
'sparse([a1, b1, ...; a1, b2, ...], "number")'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a sparse matrix.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'sparse()',
|
||||
'sparse([3, 4; 5, 6])',
|
||||
'sparse([3, 0; 5, 0], "number")'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit', 'matrix'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const splitUnitDocs = {
|
||||
'name': 'splitUnit',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'splitUnit',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'splitUnit(unit: Unit, parts: Unit[])'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Split a unit in an array of units whose sum is equal to the original unit.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'splitUnit(1 m, ["feet", "inch"])'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'unit', 'createUnit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const stringDocs = {
|
||||
'name': 'string',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'string',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'"text"',
|
||||
'string(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a string or convert a value to a string',
|
||||
'examples': [
|
||||
examples: [
|
||||
'"Hello World!"',
|
||||
'string(4.2)',
|
||||
'string(3 + 2i)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'unit'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
export const unitDocs = {
|
||||
'name': 'unit',
|
||||
'category': 'Construction',
|
||||
'syntax': [
|
||||
name: 'unit',
|
||||
category: 'Construction',
|
||||
syntax: [
|
||||
'value unit',
|
||||
'unit(value, unit)',
|
||||
'unit(string)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Create a unit.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'5.5 mm',
|
||||
'3 inch',
|
||||
'unit(7.1, "kilogram")',
|
||||
'unit("23 deg")'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'string'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const configDocs = {
|
||||
'name': 'config',
|
||||
'category': 'Core',
|
||||
'syntax': [
|
||||
name: 'config',
|
||||
category: 'Core',
|
||||
syntax: [
|
||||
'config()',
|
||||
'config(options)'
|
||||
],
|
||||
'description': 'Get configuration or change configuration.',
|
||||
'examples': [
|
||||
description: 'Get configuration or change configuration.',
|
||||
examples: [
|
||||
'config()',
|
||||
'1/3 + 1/4',
|
||||
'config({number: "Fraction"})',
|
||||
'1/3 + 1/4'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const importDocs = {
|
||||
'name': 'import',
|
||||
'category': 'Core',
|
||||
'syntax': [
|
||||
name: 'import',
|
||||
category: 'Core',
|
||||
syntax: [
|
||||
'import(functions)',
|
||||
'import(functions, options)'
|
||||
],
|
||||
'description': 'Import functions or constants from an object.',
|
||||
'examples': [
|
||||
description: 'Import functions or constants from an object.',
|
||||
examples: [
|
||||
'import({myFn: f(x)=x^2, myConstant: 32 })',
|
||||
'myFn(2)',
|
||||
'myConstant'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const typedDocs = {
|
||||
'name': 'typed',
|
||||
'category': 'Core',
|
||||
'syntax': [
|
||||
name: 'typed',
|
||||
category: 'Core',
|
||||
syntax: [
|
||||
'typed(signatures)',
|
||||
'typed(name, signatures)'
|
||||
],
|
||||
'description': 'Create a typed function.',
|
||||
'examples': [
|
||||
description: 'Create a typed function.',
|
||||
examples: [
|
||||
'double = typed({ "number, number": f(x)=x+x })',
|
||||
'double(2)',
|
||||
'double("hello")'
|
||||
],
|
||||
'seealso': []
|
||||
seealso: []
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ export const embeddedDocs = {
|
||||
|
||||
// construction functions
|
||||
bignumber: bignumberDocs,
|
||||
'boolean': booleanDocs,
|
||||
boolean: booleanDocs,
|
||||
complex: complexDocs,
|
||||
createUnit: createUnitDocs,
|
||||
fraction: fractionDocs,
|
||||
@ -226,22 +226,22 @@ export const embeddedDocs = {
|
||||
// constants
|
||||
e: eDocs,
|
||||
E: eDocs,
|
||||
'false': falseDocs,
|
||||
false: falseDocs,
|
||||
i: iDocs,
|
||||
'Infinity': InfinityDocs,
|
||||
Infinity: InfinityDocs,
|
||||
LN2: LN2Docs,
|
||||
LN10: LN10Docs,
|
||||
LOG2E: LOG2EDocs,
|
||||
LOG10E: LOG10EDocs,
|
||||
NaN: NaNDocs,
|
||||
'null': nullDocs,
|
||||
null: nullDocs,
|
||||
pi: piDocs,
|
||||
PI: piDocs,
|
||||
phi: phiDocs,
|
||||
SQRT1_2: SQRT12Docs,
|
||||
SQRT2: SQRT2Docs,
|
||||
tau: tauDocs,
|
||||
'true': trueDocs,
|
||||
true: trueDocs,
|
||||
version: versionDocs,
|
||||
|
||||
// physical constants
|
||||
@ -369,9 +369,9 @@ export const embeddedDocs = {
|
||||
stirlingS2: stirlingS2Docs,
|
||||
|
||||
// functions - core
|
||||
'config': configDocs,
|
||||
'import': importDocs,
|
||||
'typed': typedDocs,
|
||||
config: configDocs,
|
||||
import: importDocs,
|
||||
typed: typedDocs,
|
||||
|
||||
// functions - complex
|
||||
arg: argDocs,
|
||||
@ -380,8 +380,8 @@ export const embeddedDocs = {
|
||||
im: imDocs,
|
||||
|
||||
// functions - expression
|
||||
'evaluate': evaluateDocs,
|
||||
'eval': evaluateDocs, // TODO: deprecated, cleanup in v7
|
||||
evaluate: evaluateDocs,
|
||||
eval: evaluateDocs, // TODO: deprecated, cleanup in v7
|
||||
help: helpDocs,
|
||||
|
||||
// functions - geometry
|
||||
@ -389,13 +389,13 @@ export const embeddedDocs = {
|
||||
intersect: intersectDocs,
|
||||
|
||||
// functions - logical
|
||||
'and': andDocs,
|
||||
'not': notDocs,
|
||||
'or': orDocs,
|
||||
'xor': xorDocs,
|
||||
and: andDocs,
|
||||
not: notDocs,
|
||||
or: orDocs,
|
||||
xor: xorDocs,
|
||||
|
||||
// functions - matrix
|
||||
'concat': concatDocs,
|
||||
concat: concatDocs,
|
||||
cross: crossDocs,
|
||||
column: columnDocs,
|
||||
ctranspose: ctransposeDocs,
|
||||
@ -441,7 +441,7 @@ export const embeddedDocs = {
|
||||
compareNatural: compareNaturalDocs,
|
||||
compareText: compareTextDocs,
|
||||
deepEqual: deepEqualDocs,
|
||||
'equal': equalDocs,
|
||||
equal: equalDocs,
|
||||
equalText: equalTextDocs,
|
||||
larger: largerDocs,
|
||||
largerEq: largerEqDocs,
|
||||
@ -475,8 +475,8 @@ export const embeddedDocs = {
|
||||
quantileSeq: quantileSeqDocs,
|
||||
std: stdDocs,
|
||||
sum: sumDocs,
|
||||
'variance': varianceDocs,
|
||||
'var': varianceDocs, // TODO: deprecated, cleanup in v7
|
||||
variance: varianceDocs,
|
||||
var: varianceDocs, // TODO: deprecated, cleanup in v7
|
||||
|
||||
// functions - trigonometry
|
||||
acos: acosDocs,
|
||||
@ -520,7 +520,7 @@ export const embeddedDocs = {
|
||||
isPrime: isPrimeDocs,
|
||||
isZero: isZeroDocs,
|
||||
// print: printDocs // TODO: add documentation for print as soon as the parser supports objects.
|
||||
'typeOf': typeOfDocs,
|
||||
'typeof': typeOfDocs, // TODO: deprecated, cleanup in v7
|
||||
'numeric': numericDocs
|
||||
typeOf: typeOfDocs,
|
||||
typeof: typeOfDocs, // TODO: deprecated, cleanup in v7
|
||||
numeric: numericDocs
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const derivativeDocs = {
|
||||
'name': 'derivative',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
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': [
|
||||
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")',
|
||||
@ -16,7 +16,7 @@ export const derivativeDocs = {
|
||||
'df = derivative(f, x)',
|
||||
'df.evaluate({x: 3})'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'simplify', 'parse', 'evaluate'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const lsolveDocs = {
|
||||
'name': 'lsolve',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
name: 'lsolve',
|
||||
category: 'Algebra',
|
||||
syntax: [
|
||||
'x=lsolve(L, b)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Solves the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'a = [-2, 3; 2, 1]',
|
||||
'b = [11, 9]',
|
||||
'x = lsolve(a, b)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'lup', 'lusolve', 'usolve', 'matrix', 'sparse'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const lupDocs = {
|
||||
'name': 'lup',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
name: 'lup',
|
||||
category: 'Algebra',
|
||||
syntax: [
|
||||
'lup(m)'
|
||||
],
|
||||
'description':
|
||||
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': [
|
||||
examples: [
|
||||
'lup([[2, 1], [1, 4]])',
|
||||
'lup(matrix([[2, 1], [1, 4]]))',
|
||||
'lup(sparse([[2, 1], [1, 4]]))'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'lusolve', 'lsolve', 'usolve', 'matrix', 'sparse', 'slu', 'qr'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const lusolveDocs = {
|
||||
'name': 'lusolve',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'lup', 'slu', 'lsolve', 'usolve', 'matrix', 'sparse'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const qrDocs = {
|
||||
'name': 'qr',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
name: 'qr',
|
||||
category: 'Algebra',
|
||||
syntax: [
|
||||
'qr(A)'
|
||||
],
|
||||
'description':
|
||||
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': [
|
||||
examples: [
|
||||
'qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'lup', 'slu', 'matrix'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const rationalizeDocs = {
|
||||
'name': 'rationalize',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'simplify'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const simplifyDocs = {
|
||||
'name': 'simplify',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
name: 'simplify',
|
||||
category: 'Algebra',
|
||||
syntax: [
|
||||
'simplify(expr)',
|
||||
'simplify(expr, rules)'
|
||||
],
|
||||
'description': 'Simplify an expression tree.',
|
||||
'examples': [
|
||||
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': [
|
||||
seealso: [
|
||||
'derivative', 'parse', 'evaluate'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
export const sluDocs = {
|
||||
'name': 'slu',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'lusolve', 'lsolve', 'usolve', 'matrix', 'sparse', 'lup', 'qr'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const usolveDocs = {
|
||||
'name': 'usolve',
|
||||
'category': 'Algebra',
|
||||
'syntax': [
|
||||
name: 'usolve',
|
||||
category: 'Algebra',
|
||||
syntax: [
|
||||
'x=usolve(U, b)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Solves the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.',
|
||||
'examples': [
|
||||
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': [
|
||||
seealso: [
|
||||
'lup', 'lusolve', 'lsolve', 'matrix', 'sparse'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const absDocs = {
|
||||
'name': 'abs',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'abs',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'abs(x)'
|
||||
],
|
||||
'description': 'Compute the absolute value.',
|
||||
'examples': [
|
||||
description: 'Compute the absolute value.',
|
||||
examples: [
|
||||
'abs(3.5)',
|
||||
'abs(-4.2)'
|
||||
],
|
||||
'seealso': ['sign']
|
||||
seealso: ['sign']
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const addDocs = {
|
||||
'name': 'add',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'add',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x + y',
|
||||
'add(x, y)'
|
||||
],
|
||||
'description': 'Add two values.',
|
||||
'examples': [
|
||||
description: 'Add two values.',
|
||||
examples: [
|
||||
'a = 2.1 + 3.6',
|
||||
'a - 3.6',
|
||||
'3 + 2i',
|
||||
'3 cm + 2 inch',
|
||||
'"2.3" + "4"'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'subtract'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const cbrtDocs = {
|
||||
'name': 'cbrt',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'cbrt',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'cbrt(x)',
|
||||
'cbrt(x, allRoots)'
|
||||
],
|
||||
'description':
|
||||
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': [
|
||||
examples: [
|
||||
'cbrt(64)',
|
||||
'cube(4)',
|
||||
'cbrt(-8)',
|
||||
@ -16,7 +16,7 @@ export const cbrtDocs = {
|
||||
'cbrt(8i, true)',
|
||||
'cbrt(27 m^3)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'square',
|
||||
'sqrt',
|
||||
'cube',
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const ceilDocs = {
|
||||
'name': 'ceil',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'ceil',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'ceil(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'ceil(3.2)',
|
||||
'ceil(3.8)',
|
||||
'ceil(-4.2)'
|
||||
],
|
||||
'seealso': ['floor', 'fix', 'round']
|
||||
seealso: ['floor', 'fix', 'round']
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const cubeDocs = {
|
||||
'name': 'cube',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'cube',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'cube(x)'
|
||||
],
|
||||
'description': 'Compute the cube of a value. The cube of x is x * x * x.',
|
||||
'examples': [
|
||||
description: 'Compute the cube of a value. The cube of x is x * x * x.',
|
||||
examples: [
|
||||
'cube(2)',
|
||||
'2^3',
|
||||
'2 * 2 * 2'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'multiply',
|
||||
'square',
|
||||
'pow'
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const divideDocs = {
|
||||
'name': 'divide',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'divide',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x / y',
|
||||
'divide(x, y)'
|
||||
],
|
||||
'description': 'Divide two values.',
|
||||
'examples': [
|
||||
description: 'Divide two values.',
|
||||
examples: [
|
||||
'a = 2 / 3',
|
||||
'a * 3',
|
||||
'4.5 / 2',
|
||||
@ -14,7 +14,7 @@ export const divideDocs = {
|
||||
'(3 + 4) / 2',
|
||||
'18 km / 4.5'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'multiply'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const dotDivideDocs = {
|
||||
'name': 'dotDivide',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'dotDivide',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x ./ y',
|
||||
'dotDivide(x, y)'
|
||||
],
|
||||
'description': 'Divide two values element wise.',
|
||||
'examples': [
|
||||
description: 'Divide two values element wise.',
|
||||
examples: [
|
||||
'a = [1, 2, 3; 4, 5, 6]',
|
||||
'b = [2, 1, 1; 3, 2, 5]',
|
||||
'a ./ b'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'multiply',
|
||||
'dotMultiply',
|
||||
'divide'
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const dotMultiplyDocs = {
|
||||
'name': 'dotMultiply',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'dotMultiply',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x .* y',
|
||||
'dotMultiply(x, y)'
|
||||
],
|
||||
'description': 'Multiply two values element wise.',
|
||||
'examples': [
|
||||
description: 'Multiply two values element wise.',
|
||||
examples: [
|
||||
'a = [1, 2, 3; 4, 5, 6]',
|
||||
'b = [2, 1, 1; 3, 2, 5]',
|
||||
'a .* b'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'multiply',
|
||||
'divide',
|
||||
'dotDivide'
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const dotPowDocs = {
|
||||
'name': 'dotPow',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'dotPow',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x .^ y',
|
||||
'dotPow(x, y)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Calculates the power of x to y element wise.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'a = [1, 2, 3; 4, 5, 6]',
|
||||
'a .^ 2'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'pow'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const expDocs = {
|
||||
'name': 'exp',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'exp',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'exp(x)'
|
||||
],
|
||||
'description': 'Calculate the exponent of a value.',
|
||||
'examples': [
|
||||
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': [
|
||||
seealso: [
|
||||
'expm',
|
||||
'expm1',
|
||||
'pow',
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const expmDocs = {
|
||||
'name': 'expm',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'expm',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'exp(x)'
|
||||
],
|
||||
'description': 'Compute the matrix exponential, expm(A) = e^A. ' +
|
||||
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': [
|
||||
examples: [
|
||||
'expm([[0,2],[0,0]])'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'exp'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const expm1Docs = {
|
||||
'name': 'expm1',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'expm1',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'expm1(x)'
|
||||
],
|
||||
'description': 'Calculate the value of subtracting 1 from the exponential value.',
|
||||
'examples': [
|
||||
description: 'Calculate the value of subtracting 1 from the exponential value.',
|
||||
examples: [
|
||||
'expm1(2)',
|
||||
'pow(e, 2) - 1',
|
||||
'log(expm1(2) + 1)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'exp',
|
||||
'pow',
|
||||
'log'
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const fixDocs = {
|
||||
'name': 'fix',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'fix',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'fix(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'fix(3.2)',
|
||||
'fix(3.8)',
|
||||
'fix(-4.2)',
|
||||
'fix(-4.8)'
|
||||
],
|
||||
'seealso': ['ceil', 'floor', 'round']
|
||||
seealso: ['ceil', 'floor', 'round']
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const floorDocs = {
|
||||
'name': 'floor',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'floor',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'floor(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'floor(3.2)',
|
||||
'floor(3.8)',
|
||||
'floor(-4.2)'
|
||||
],
|
||||
'seealso': ['ceil', 'fix', 'round']
|
||||
seealso: ['ceil', 'fix', 'round']
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const gcdDocs = {
|
||||
'name': 'gcd',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'gcd',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'gcd(a, b)',
|
||||
'gcd(a, b, c, ...)'
|
||||
],
|
||||
'description': 'Compute the greatest common divisor.',
|
||||
'examples': [
|
||||
description: 'Compute the greatest common divisor.',
|
||||
examples: [
|
||||
'gcd(8, 12)',
|
||||
'gcd(-4, 6)',
|
||||
'gcd(25, 15, -10)'
|
||||
],
|
||||
'seealso': [ 'lcm', 'xgcd' ]
|
||||
seealso: ['lcm', 'xgcd']
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const hypotDocs = {
|
||||
'name': 'hypot',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'hypot',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'hypot(a, b, c, ...)',
|
||||
'hypot([a, b, c, ...])'
|
||||
],
|
||||
'description': 'Calculate the hypotenusa of a list with values. ',
|
||||
'examples': [
|
||||
description: 'Calculate the hypotenusa of a list with values. ',
|
||||
examples: [
|
||||
'hypot(3, 4)',
|
||||
'sqrt(3^2 + 4^2)',
|
||||
'hypot(-2)',
|
||||
'hypot([3, 4, 5])'
|
||||
],
|
||||
'seealso': [ 'abs', 'norm' ]
|
||||
seealso: ['abs', 'norm']
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
export const lcmDocs = {
|
||||
'name': 'lcm',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'lcm',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'lcm(x, y)'
|
||||
],
|
||||
'description': 'Compute the least common multiple.',
|
||||
'examples': [
|
||||
description: 'Compute the least common multiple.',
|
||||
examples: [
|
||||
'lcm(4, 6)',
|
||||
'lcm(6, 21)',
|
||||
'lcm(6, 21, 5)'
|
||||
],
|
||||
'seealso': [ 'gcd' ]
|
||||
seealso: ['gcd']
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const logDocs = {
|
||||
'name': 'log',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
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': [
|
||||
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)',
|
||||
@ -16,7 +16,7 @@ export const logDocs = {
|
||||
'b = log(1024, 2)',
|
||||
'2 ^ b'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'exp',
|
||||
'log1p',
|
||||
'log2',
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const log10Docs = {
|
||||
'name': 'log10',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'log10',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'log10(x)'
|
||||
],
|
||||
'description': 'Compute the 10-base logarithm of a value.',
|
||||
'examples': [
|
||||
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': [
|
||||
seealso: [
|
||||
'exp',
|
||||
'log'
|
||||
]
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const log1pDocs = {
|
||||
'name': 'log1p',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'log1p',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'log1p(x)',
|
||||
'log1p(x, base)'
|
||||
],
|
||||
'description': 'Calculate the logarithm of a `value+1`',
|
||||
'examples': [
|
||||
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': [
|
||||
seealso: [
|
||||
'exp',
|
||||
'log',
|
||||
'log2',
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const log2Docs = {
|
||||
'name': 'log2',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'exp',
|
||||
'log1p',
|
||||
'log',
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
export const modDocs = {
|
||||
'name': 'mod',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'mod',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x % y',
|
||||
'x mod y',
|
||||
'mod(x, y)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Calculates the modulus, the remainder of an integer division.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'7 % 3',
|
||||
'11 % 2',
|
||||
'10 mod 4',
|
||||
@ -16,5 +16,5 @@ export const modDocs = {
|
||||
'isOdd(2)',
|
||||
'isOdd(3)'
|
||||
],
|
||||
'seealso': ['divide']
|
||||
seealso: ['divide']
|
||||
}
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const multiplyDocs = {
|
||||
'name': 'multiply',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'multiply',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x * y',
|
||||
'multiply(x, y)'
|
||||
],
|
||||
'description': 'multiply two values.',
|
||||
'examples': [
|
||||
description: 'multiply two values.',
|
||||
examples: [
|
||||
'a = 2.1 * 3.4',
|
||||
'a / 3.4',
|
||||
'2 * 3 + 4',
|
||||
'2 * (3 + 4)',
|
||||
'3 * 2.1 km'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'divide'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const normDocs = {
|
||||
'name': 'norm',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'norm',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'norm(x)',
|
||||
'norm(x, p)'
|
||||
],
|
||||
'description': 'Calculate the norm of a number, vector or matrix.',
|
||||
'examples': [
|
||||
description: 'Calculate the norm of a number, vector or matrix.',
|
||||
examples: [
|
||||
'abs(-3.5)',
|
||||
'norm(-3.5)',
|
||||
'norm(3 - 4i)',
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
export const nthRootDocs = {
|
||||
'name': 'nthRoot',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'nthRoot',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'nthRoot(a)',
|
||||
'nthRoot(a, root)'
|
||||
],
|
||||
'description': 'Calculate the nth root of a value. ' +
|
||||
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': [
|
||||
examples: [
|
||||
'4 ^ 3',
|
||||
'nthRoot(64, 3)',
|
||||
'nthRoot(9, 2)',
|
||||
'sqrt(9)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'nthRoots',
|
||||
'pow',
|
||||
'sqrt'
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
export const nthRootsDocs = {
|
||||
'name': 'nthRoots',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'nthRoots',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'nthRoots(A)',
|
||||
'nthRoots(A, root)'
|
||||
],
|
||||
'description': ('' +
|
||||
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': [
|
||||
examples: [
|
||||
'nthRoots(1)',
|
||||
'nthRoots(1, 3)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'sqrt',
|
||||
'pow',
|
||||
'nthRoot'
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const powDocs = {
|
||||
'name': 'pow',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'pow',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x ^ y',
|
||||
'pow(x, y)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Calculates the power of x to y, x^y.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'2^3',
|
||||
'2*2*2',
|
||||
'1 + e ^ (pi * i)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'multiply',
|
||||
'nthRoot',
|
||||
'nthRoots',
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const roundDocs = {
|
||||
'name': 'round',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'round',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'round(x)',
|
||||
'round(x, n)'
|
||||
],
|
||||
'description':
|
||||
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': [
|
||||
examples: [
|
||||
'round(3.2)',
|
||||
'round(3.8)',
|
||||
'round(-4.2)',
|
||||
@ -15,5 +15,5 @@ export const roundDocs = {
|
||||
'round(pi, 3)',
|
||||
'round(123.45678, 2)'
|
||||
],
|
||||
'seealso': ['ceil', 'floor', 'fix']
|
||||
seealso: ['ceil', 'floor', 'fix']
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const signDocs = {
|
||||
'name': 'sign',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'sign',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'sign(x)'
|
||||
],
|
||||
'description':
|
||||
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': [
|
||||
examples: [
|
||||
'sign(3.5)',
|
||||
'sign(-4.2)',
|
||||
'sign(0)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'abs'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const sqrtDocs = {
|
||||
'name': 'sqrt',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'sqrt',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'sqrt(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Compute the square root value. If x = y * y, then y is the square root of x.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'sqrt(25)',
|
||||
'5 * 5',
|
||||
'sqrt(-1)'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'square',
|
||||
'sqrtm',
|
||||
'multiply',
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const sqrtmDocs = {
|
||||
'name': 'sqrtm',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'sqrtm',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'sqrtm(x)'
|
||||
],
|
||||
'description':
|
||||
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': [
|
||||
examples: [
|
||||
'sqrtm([[1, 2], [3, 4]])'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'sqrt',
|
||||
'abs',
|
||||
'square',
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const squareDocs = {
|
||||
'name': 'square',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
name: 'square',
|
||||
category: 'Arithmetic',
|
||||
syntax: [
|
||||
'square(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Compute the square of a value. The square of x is x * x.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'square(3)',
|
||||
'sqrt(9)',
|
||||
'3^2',
|
||||
'3 * 3'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'multiply',
|
||||
'pow',
|
||||
'sqrt',
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
export const subtractDocs = {
|
||||
'name': 'subtract',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'subtract',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'x - y',
|
||||
'subtract(x, y)'
|
||||
],
|
||||
'description': 'subtract two values.',
|
||||
'examples': [
|
||||
description: 'subtract two values.',
|
||||
examples: [
|
||||
'a = 5.3 - 2',
|
||||
'a + 2',
|
||||
'2/3 - 1/6',
|
||||
'2 * 3 - 3',
|
||||
'2.1 km - 500m'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'add'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
export const unaryMinusDocs = {
|
||||
'name': 'unaryMinus',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'unaryMinus',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'-x',
|
||||
'unaryMinus(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Inverse the sign of a value. Converts booleans and strings to numbers.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'-4.5',
|
||||
'-(-5.6)',
|
||||
'-"22"'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'add', 'subtract', 'unaryPlus'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const unaryPlusDocs = {
|
||||
'name': 'unaryPlus',
|
||||
'category': 'Operators',
|
||||
'syntax': [
|
||||
name: 'unaryPlus',
|
||||
category: 'Operators',
|
||||
syntax: [
|
||||
'+x',
|
||||
'unaryPlus(x)'
|
||||
],
|
||||
'description':
|
||||
description:
|
||||
'Converts booleans and strings to numbers.',
|
||||
'examples': [
|
||||
examples: [
|
||||
'+true',
|
||||
'+"2"'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'add', 'subtract', 'unaryMinus'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
export const xgcdDocs = {
|
||||
'name': 'xgcd',
|
||||
'category': 'Arithmetic',
|
||||
'syntax': [
|
||||
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': [
|
||||
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' ]
|
||||
seealso: ['gcd', 'lcm']
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const bitAndDocs = {
|
||||
'name': 'bitAnd',
|
||||
'category': 'Bitwise',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const bitNotDocs = {
|
||||
'name': 'bitNot',
|
||||
'category': 'Bitwise',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'bitAnd', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const bitOrDocs = {
|
||||
'name': 'bitOr',
|
||||
'category': 'Bitwise',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'bitAnd', 'bitNot', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
export const bitXorDocs = {
|
||||
'name': 'bitXor',
|
||||
'category': 'Bitwise',
|
||||
'syntax': [
|
||||
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': [
|
||||
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': [
|
||||
seealso: [
|
||||
'bitAnd', 'bitNot', 'bitOr', 'leftShift', 'rightArithShift', 'rightLogShift'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
export const leftShiftDocs = {
|
||||
'name': 'leftShift',
|
||||
'category': 'Bitwise',
|
||||
'syntax': [
|
||||
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': [
|
||||
description: 'Bitwise left logical shift of a value x by y number of bits.',
|
||||
examples: [
|
||||
'4 << 1',
|
||||
'8 >> 1'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'rightArithShift', 'rightLogShift'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const rightArithShiftDocs = {
|
||||
'name': 'rightArithShift',
|
||||
'category': 'Bitwise',
|
||||
'syntax': [
|
||||
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': [
|
||||
description: 'Bitwise right arithmetic shift of a value x by y number of bits.',
|
||||
examples: [
|
||||
'8 >> 1',
|
||||
'4 << 1',
|
||||
'-12 >> 2'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightLogShift'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
export const rightLogShiftDocs = {
|
||||
'name': 'rightLogShift',
|
||||
'category': 'Bitwise',
|
||||
'syntax': [
|
||||
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': [
|
||||
description: 'Bitwise right logical shift of a value x by y number of bits.',
|
||||
examples: [
|
||||
'8 >>> 1',
|
||||
'4 << 1',
|
||||
'-12 >>> 2'
|
||||
],
|
||||
'seealso': [
|
||||
seealso: [
|
||||
'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift'
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const bellNumbersDocs = {
|
||||
'name': 'bellNumbers',
|
||||
'category': 'Combinatorics',
|
||||
'syntax': [
|
||||
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': [
|
||||
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']
|
||||
seealso: ['stirlingS2']
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
export const catalanDocs = {
|
||||
'name': 'catalan',
|
||||
'category': 'Combinatorics',
|
||||
'syntax': [
|
||||
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': [
|
||||
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']
|
||||
seealso: ['bellNumbers']
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
export const compositionDocs = {
|
||||
'name': 'composition',
|
||||
'category': 'Combinatorics',
|
||||
'syntax': [
|
||||
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': [
|
||||
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']
|
||||
seealso: ['combinations']
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user