mathjs 10.5.2 → 10.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HISTORY.md +8 -0
- package/lib/browser/math.js +3 -3
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +6 -11
- package/docs/command_line_interface.md +0 -87
- package/docs/core/chaining.md +0 -41
- package/docs/core/configuration.md +0 -144
- package/docs/core/extension.md +0 -263
- package/docs/core/index.md +0 -21
- package/docs/core/serialization.md +0 -50
- package/docs/custom_bundling.md +0 -116
- package/docs/datatypes/bignumbers.md +0 -102
- package/docs/datatypes/complex_numbers.md +0 -168
- package/docs/datatypes/fractions.md +0 -75
- package/docs/datatypes/index.md +0 -67
- package/docs/datatypes/matrices.md +0 -375
- package/docs/datatypes/numbers.md +0 -106
- package/docs/datatypes/units.md +0 -444
- package/docs/expressions/algebra.md +0 -110
- package/docs/expressions/customization.md +0 -379
- package/docs/expressions/expression_trees.md +0 -710
- package/docs/expressions/html_classes.md +0 -38
- package/docs/expressions/index.md +0 -21
- package/docs/expressions/parsing.md +0 -224
- package/docs/expressions/security.md +0 -89
- package/docs/expressions/syntax.md +0 -706
- package/docs/getting_started.md +0 -124
- package/docs/index.md +0 -39
- package/docs/reference/classes/densematrix.md +0 -247
- package/docs/reference/classes/fibonacciheap.md +0 -70
- package/docs/reference/classes/matrixindex.md +0 -133
- package/docs/reference/classes/matrixrange.md +0 -158
- package/docs/reference/classes/resultset.md +0 -47
- package/docs/reference/classes/sparsematrix.md +0 -245
- package/docs/reference/classes/unit.md +0 -242
- package/docs/reference/classes.md +0 -86
- package/docs/reference/constants.md +0 -29
- package/docs/reference/functions/abs.md +0 -46
- package/docs/reference/functions/acos.md +0 -49
- package/docs/reference/functions/acosh.md +0 -47
- package/docs/reference/functions/acot.md +0 -48
- package/docs/reference/functions/acoth.md +0 -46
- package/docs/reference/functions/acsc.md +0 -49
- package/docs/reference/functions/acsch.md +0 -46
- package/docs/reference/functions/add.md +0 -59
- package/docs/reference/functions/and.md +0 -53
- package/docs/reference/functions/apply.md +0 -56
- package/docs/reference/functions/arg.md +0 -53
- package/docs/reference/functions/asec.md +0 -49
- package/docs/reference/functions/asech.md +0 -46
- package/docs/reference/functions/asin.md +0 -49
- package/docs/reference/functions/asinh.md +0 -46
- package/docs/reference/functions/atan.md +0 -49
- package/docs/reference/functions/atan2.md +0 -56
- package/docs/reference/functions/atanh.md +0 -46
- package/docs/reference/functions/bellNumbers.md +0 -45
- package/docs/reference/functions/bignumber.md +0 -47
- package/docs/reference/functions/bin.md +0 -45
- package/docs/reference/functions/bitAnd.md +0 -51
- package/docs/reference/functions/bitNot.md +0 -51
- package/docs/reference/functions/bitOr.md +0 -52
- package/docs/reference/functions/bitXor.md +0 -51
- package/docs/reference/functions/boolean.md +0 -50
- package/docs/reference/functions/catalan.md +0 -45
- package/docs/reference/functions/cbrt.md +0 -60
- package/docs/reference/functions/ceil.md +0 -63
- package/docs/reference/functions/chain.md +0 -54
- package/docs/reference/functions/clone.md +0 -43
- package/docs/reference/functions/column.md +0 -45
- package/docs/reference/functions/combinations.md +0 -49
- package/docs/reference/functions/combinationsWithRep.md +0 -49
- package/docs/reference/functions/compare.md +0 -67
- package/docs/reference/functions/compareNatural.md +0 -92
- package/docs/reference/functions/compareText.md +0 -54
- package/docs/reference/functions/compile.md +0 -56
- package/docs/reference/functions/complex.md +0 -17
- package/docs/reference/functions/composition.md +0 -46
- package/docs/reference/functions/concat.md +0 -56
- package/docs/reference/functions/config.md +0 -44
- package/docs/reference/functions/conj.md +0 -50
- package/docs/reference/functions/cos.md +0 -51
- package/docs/reference/functions/cosh.md +0 -46
- package/docs/reference/functions/cot.md +0 -47
- package/docs/reference/functions/coth.md +0 -49
- package/docs/reference/functions/count.md +0 -45
- package/docs/reference/functions/createUnit.md +0 -52
- package/docs/reference/functions/cross.md +0 -58
- package/docs/reference/functions/csc.md +0 -47
- package/docs/reference/functions/csch.md +0 -49
- package/docs/reference/functions/ctranspose.md +0 -50
- package/docs/reference/functions/cube.md +0 -51
- package/docs/reference/functions/cumsum.md +0 -57
- package/docs/reference/functions/deepEqual.md +0 -53
- package/docs/reference/functions/derivative.md +0 -61
- package/docs/reference/functions/det.md +0 -49
- package/docs/reference/functions/diag.md +0 -61
- package/docs/reference/functions/diff.md +0 -70
- package/docs/reference/functions/distance.md +0 -80
- package/docs/reference/functions/divide.md +0 -55
- package/docs/reference/functions/dot.md +0 -48
- package/docs/reference/functions/dotDivide.md +0 -52
- package/docs/reference/functions/dotMultiply.md +0 -52
- package/docs/reference/functions/dotPow.md +0 -49
- package/docs/reference/functions/eigs.md +0 -54
- package/docs/reference/functions/equal.md +0 -75
- package/docs/reference/functions/equalText.md +0 -53
- package/docs/reference/functions/erf.md +0 -49
- package/docs/reference/functions/evaluate.md +0 -56
- package/docs/reference/functions/exp.md +0 -54
- package/docs/reference/functions/expm.md +0 -49
- package/docs/reference/functions/expm1.md +0 -54
- package/docs/reference/functions/factorial.md +0 -49
- package/docs/reference/functions/fft.md +0 -35
- package/docs/reference/functions/filter.md +0 -50
- package/docs/reference/functions/fix.md +0 -62
- package/docs/reference/functions/flatten.md +0 -46
- package/docs/reference/functions/floor.md +0 -66
- package/docs/reference/functions/forEach.md +0 -41
- package/docs/reference/functions/format.md +0 -127
- package/docs/reference/functions/fraction.md +0 -45
- package/docs/reference/functions/gamma.md +0 -49
- package/docs/reference/functions/gcd.md +0 -50
- package/docs/reference/functions/getMatrixDataType.md +0 -59
- package/docs/reference/functions/hasNumericValue.md +0 -55
- package/docs/reference/functions/help.md +0 -42
- package/docs/reference/functions/hex.md +0 -45
- package/docs/reference/functions/hypot.md +0 -51
- package/docs/reference/functions/identity.md +0 -57
- package/docs/reference/functions/ifft.md +0 -35
- package/docs/reference/functions/im.md +0 -53
- package/docs/reference/functions/import.md +0 -68
- package/docs/reference/functions/index.md +0 -55
- package/docs/reference/functions/intersect.md +0 -50
- package/docs/reference/functions/inv.md +0 -45
- package/docs/reference/functions/invmod.md +0 -47
- package/docs/reference/functions/isInteger.md +0 -55
- package/docs/reference/functions/isNaN.md +0 -56
- package/docs/reference/functions/isNegative.md +0 -55
- package/docs/reference/functions/isNumeric.md +0 -55
- package/docs/reference/functions/isPositive.md +0 -57
- package/docs/reference/functions/isPrime.md +0 -54
- package/docs/reference/functions/isZero.md +0 -59
- package/docs/reference/functions/kldivergence.md +0 -41
- package/docs/reference/functions/kron.md +0 -53
- package/docs/reference/functions/larger.md +0 -60
- package/docs/reference/functions/largerEq.md +0 -56
- package/docs/reference/functions/lcm.md +0 -54
- package/docs/reference/functions/leafCount.md +0 -52
- package/docs/reference/functions/leftShift.md +0 -52
- package/docs/reference/functions/lgamma.md +0 -46
- package/docs/reference/functions/log.md +0 -57
- package/docs/reference/functions/log10.md +0 -50
- package/docs/reference/functions/log1p.md +0 -54
- package/docs/reference/functions/log2.md +0 -50
- package/docs/reference/functions/lsolve.md +0 -51
- package/docs/reference/functions/lsolveAll.md +0 -51
- package/docs/reference/functions/lup.md +0 -52
- package/docs/reference/functions/lusolve.md +0 -59
- package/docs/reference/functions/mad.md +0 -50
- package/docs/reference/functions/map.md +0 -65
- package/docs/reference/functions/matrix.md +0 -56
- package/docs/reference/functions/matrixFromColumns.md +0 -49
- package/docs/reference/functions/matrixFromFunction.md +0 -54
- package/docs/reference/functions/matrixFromRows.md +0 -49
- package/docs/reference/functions/max.md +0 -61
- package/docs/reference/functions/mean.md +0 -57
- package/docs/reference/functions/median.md +0 -57
- package/docs/reference/functions/min.md +0 -61
- package/docs/reference/functions/mod.md +0 -59
- package/docs/reference/functions/mode.md +0 -50
- package/docs/reference/functions/multinomial.md +0 -46
- package/docs/reference/functions/multiply.md +0 -60
- package/docs/reference/functions/norm.md +0 -59
- package/docs/reference/functions/not.md +0 -50
- package/docs/reference/functions/nthRoot.md +0 -53
- package/docs/reference/functions/nthRoots.md +0 -58
- package/docs/reference/functions/number.md +0 -49
- package/docs/reference/functions/numeric.md +0 -52
- package/docs/reference/functions/oct.md +0 -45
- package/docs/reference/functions/ones.md +0 -59
- package/docs/reference/functions/or.md +0 -53
- package/docs/reference/functions/parse.md +0 -56
- package/docs/reference/functions/parser.md +0 -70
- package/docs/reference/functions/partitionSelect.md +0 -53
- package/docs/reference/functions/permutations.md +0 -51
- package/docs/reference/functions/pickRandom.md +0 -59
- package/docs/reference/functions/pinv.md +0 -44
- package/docs/reference/functions/pow.md +0 -65
- package/docs/reference/functions/print.md +0 -64
- package/docs/reference/functions/prod.md +0 -55
- package/docs/reference/functions/qr.md +0 -65
- package/docs/reference/functions/quantileSeq.md +0 -62
- package/docs/reference/functions/random.md +0 -54
- package/docs/reference/functions/randomInt.md +0 -53
- package/docs/reference/functions/range.md +0 -70
- package/docs/reference/functions/rationalize.md +0 -68
- package/docs/reference/functions/re.md +0 -53
- package/docs/reference/functions/reshape.md +0 -60
- package/docs/reference/functions/resize.md +0 -51
- package/docs/reference/functions/resolve.md +0 -46
- package/docs/reference/functions/rightArithShift.md +0 -52
- package/docs/reference/functions/rightLogShift.md +0 -52
- package/docs/reference/functions/rotate.md +0 -53
- package/docs/reference/functions/rotationMatrix.md +0 -57
- package/docs/reference/functions/round.md +0 -61
- package/docs/reference/functions/row.md +0 -45
- package/docs/reference/functions/sec.md +0 -47
- package/docs/reference/functions/sech.md +0 -49
- package/docs/reference/functions/setCartesian.md +0 -49
- package/docs/reference/functions/setDifference.md +0 -47
- package/docs/reference/functions/setDistinct.md +0 -43
- package/docs/reference/functions/setIntersect.md +0 -46
- package/docs/reference/functions/setIsSubset.md +0 -47
- package/docs/reference/functions/setMultiplicity.md +0 -46
- package/docs/reference/functions/setPowerset.md +0 -43
- package/docs/reference/functions/setSize.md +0 -47
- package/docs/reference/functions/setSymDifference.md +0 -47
- package/docs/reference/functions/setUnion.md +0 -46
- package/docs/reference/functions/sign.md +0 -52
- package/docs/reference/functions/simplify.md +0 -130
- package/docs/reference/functions/simplifyConstant.md +0 -52
- package/docs/reference/functions/simplifyCore.md +0 -50
- package/docs/reference/functions/sin.md +0 -51
- package/docs/reference/functions/sinh.md +0 -46
- package/docs/reference/functions/size.md +0 -50
- package/docs/reference/functions/slu.md +0 -57
- package/docs/reference/functions/smaller.md +0 -60
- package/docs/reference/functions/smallerEq.md +0 -56
- package/docs/reference/functions/sort.md +0 -56
- package/docs/reference/functions/sparse.md +0 -51
- package/docs/reference/functions/splitUnit.md +0 -37
- package/docs/reference/functions/sqrt.md +0 -50
- package/docs/reference/functions/sqrtm.md +0 -46
- package/docs/reference/functions/square.md +0 -51
- package/docs/reference/functions/squeeze.md +0 -53
- package/docs/reference/functions/std.md +0 -76
- package/docs/reference/functions/stirlingS2.md +0 -52
- package/docs/reference/functions/string.md +0 -49
- package/docs/reference/functions/subset.md +0 -65
- package/docs/reference/functions/subtract.md +0 -54
- package/docs/reference/functions/sum.md +0 -54
- package/docs/reference/functions/symbolicEqual.md +0 -62
- package/docs/reference/functions/tan.md +0 -49
- package/docs/reference/functions/tanh.md +0 -50
- package/docs/reference/functions/to.md +0 -47
- package/docs/reference/functions/trace.md +0 -50
- package/docs/reference/functions/transpose.md +0 -49
- package/docs/reference/functions/typeOf.md +0 -81
- package/docs/reference/functions/typed.md +0 -56
- package/docs/reference/functions/unaryMinus.md +0 -49
- package/docs/reference/functions/unaryPlus.md +0 -48
- package/docs/reference/functions/unequal.md +0 -74
- package/docs/reference/functions/unit.md +0 -48
- package/docs/reference/functions/usolve.md +0 -51
- package/docs/reference/functions/usolveAll.md +0 -51
- package/docs/reference/functions/variance.md +0 -78
- package/docs/reference/functions/xgcd.md +0 -47
- package/docs/reference/functions/xor.md +0 -53
- package/docs/reference/functions/zeros.md +0 -57
- package/docs/reference/functions.md +0 -297
- package/docs/reference/index.md +0 -5
- package/examples/advanced/convert_fraction_to_bignumber.js +0 -59
- package/examples/advanced/custom_argument_parsing.js +0 -98
- package/examples/advanced/custom_datatype.js +0 -56
- package/examples/advanced/custom_evaluate_using_factories.js +0 -19
- package/examples/advanced/custom_evaluate_using_import.js +0 -18
- package/examples/advanced/custom_loading.js +0 -33
- package/examples/advanced/custom_relational_functions.js +0 -62
- package/examples/advanced/custom_scope_objects.js +0 -115
- package/examples/advanced/expression_trees.js +0 -55
- package/examples/advanced/function_transform.js +0 -50
- package/examples/advanced/more_secure_eval.js +0 -36
- package/examples/advanced/use_bigint.js +0 -43
- package/examples/advanced/web_server/math_worker.js +0 -24
- package/examples/advanced/web_server/server.js +0 -80
- package/examples/algebra.js +0 -34
- package/examples/basic_usage.js +0 -49
- package/examples/bignumbers.js +0 -52
- package/examples/browser/angle_configuration.html +0 -134
- package/examples/browser/basic_usage.html +0 -39
- package/examples/browser/currency_conversion.html +0 -125
- package/examples/browser/custom_separators.html +0 -81
- package/examples/browser/plot.html +0 -78
- package/examples/browser/pretty_printing_with_mathjax.html +0 -122
- package/examples/browser/printing_html.html +0 -170
- package/examples/browser/requirejs_loading.html +0 -20
- package/examples/browser/rocket_trajectory_optimization.html +0 -301
- package/examples/browser/webworkers/webworkers.html +0 -80
- package/examples/browser/webworkers/worker.js +0 -28
- package/examples/chaining.js +0 -56
- package/examples/complex_numbers.js +0 -67
- package/examples/expressions.js +0 -188
- package/examples/fractions.js +0 -74
- package/examples/import.js +0 -95
- package/examples/matrices.js +0 -101
- package/examples/objects.js +0 -35
- package/examples/package.json +0 -3
- package/examples/serialization.js +0 -16
- package/examples/sparse_matrices.js +0 -19
- package/examples/units.js +0 -108
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function gamma
|
|
4
|
-
|
|
5
|
-
Compute the gamma function of a value using Lanczos approximation for
|
|
6
|
-
small values, and an extended Stirling approximation for large values.
|
|
7
|
-
|
|
8
|
-
For matrices, the function is evaluated element wise.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.gamma(n)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`n` | number | Array | Matrix | A real or complex number
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | Array | Matrix | The gamma of `n`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.gamma(5) // returns 24
|
|
40
|
-
math.gamma(-0.5) // returns -3.5449077018110335
|
|
41
|
-
math.gamma(math.i) // returns -0.15494982830180973 - 0.49801566811835596i
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[combinations](combinations.md),
|
|
48
|
-
[factorial](factorial.md),
|
|
49
|
-
[permutations](permutations.md)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function gcd
|
|
4
|
-
|
|
5
|
-
Calculate the greatest common divisor for two or more values or arrays.
|
|
6
|
-
|
|
7
|
-
For matrices, the function is evaluated element wise.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.gcd(a, b)
|
|
14
|
-
math.gcd(a, b, c, ...)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`args` | ... number | BigNumber | Fraction | Array | Matrix | Two or more integer numbers
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Fraction | Array | Matrix | The greatest common divisor
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.gcd(8, 12) // returns 4
|
|
40
|
-
math.gcd(-4, 6) // returns 2
|
|
41
|
-
math.gcd(25, 15, -10) // returns 5
|
|
42
|
-
|
|
43
|
-
math.gcd([8, -4], [12, 6]) // returns [4, 2]
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## See also
|
|
48
|
-
|
|
49
|
-
[lcm](lcm.md),
|
|
50
|
-
[xgcd](xgcd.md)
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function getMatrixDataType
|
|
4
|
-
|
|
5
|
-
Find the data type of all elements in a matrix or array,
|
|
6
|
-
for example 'number' if all items are a number and 'Complex' if all values
|
|
7
|
-
are complex numbers.
|
|
8
|
-
If a matrix contains more than one data type, it will return 'mixed'.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.getMatrixDataType(x)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`x` | ...Matrix | Array | The Matrix with values.
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
string | A string representation of the matrix type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const x = [ [1, 2, 3], [4, 5, 6] ]
|
|
40
|
-
const mixedX = [ [1, true], [2, 3] ]
|
|
41
|
-
const fractionX = [ [math.fraction(1, 3)], [math.fraction(1, 3] ]
|
|
42
|
-
const unitX = [ [math.unit('5cm')], [math.unit('5cm')] ]
|
|
43
|
-
const bigNumberX = [ [math.bignumber(1)], [math.bignumber(0)] ]
|
|
44
|
-
const sparse = math.sparse(x)
|
|
45
|
-
const dense = math.matrix(x)
|
|
46
|
-
math.getMatrixDataType(x) // returns 'number'
|
|
47
|
-
math.getMatrixDataType(sparse) // returns 'number'
|
|
48
|
-
math.getMatrixDataType(dense) // returns 'number'
|
|
49
|
-
math.getMatrixDataType(mixedX) // returns 'mixed'
|
|
50
|
-
math.getMatrixDataType(fractionX) // returns 'Fraction'
|
|
51
|
-
math.getMatrixDataType(unitX) // returns 'Unit'
|
|
52
|
-
math.getMatrixDataType(bigNumberX) // return 'BigNumber'
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## See also
|
|
57
|
-
|
|
58
|
-
[SparseMatrix](SparseMatrix.md),
|
|
59
|
-
[DenseMatrix](DenseMatrix.md)
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function hasNumericValue
|
|
4
|
-
|
|
5
|
-
Test whether a value is an numeric value.
|
|
6
|
-
|
|
7
|
-
In case of a string, true is returned if the string contains a numeric value.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.hasNumericValue(x)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | * | Value to be tested
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
boolean | Returns true when `x` is a `number`, `BigNumber`, `Fraction`, `Boolean`, or a `String` containing number. Returns false for other types. Throws an error in case of unknown types.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.hasNumericValue(2) // returns true
|
|
39
|
-
math.hasNumericValue('2') // returns true
|
|
40
|
-
math.isNumeric('2') // returns false
|
|
41
|
-
math.hasNumericValue(0) // returns true
|
|
42
|
-
math.hasNumericValue(math.bignumber(500)) // returns true
|
|
43
|
-
math.hasNumericValue(math.fraction(4)) // returns true
|
|
44
|
-
math.hasNumericValue(math.complex('2-4i') // returns false
|
|
45
|
-
math.hasNumericValue([2.3, 'foo', false]) // returns [true, false, true]
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## See also
|
|
50
|
-
|
|
51
|
-
[isZero](isZero.md),
|
|
52
|
-
[isPositive](isPositive.md),
|
|
53
|
-
[isNegative](isNegative.md),
|
|
54
|
-
[isInteger](isInteger.md),
|
|
55
|
-
[isNumeric](isNumeric.md)
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function help
|
|
4
|
-
|
|
5
|
-
Retrieve help on a function or data type.
|
|
6
|
-
Help files are retrieved from the embedded documentation in math.docs.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.help(search)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`search` | Function | string | Object | A function or function name for which to get help
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
Help | A help object
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
console.log(math.help('sin').toString())
|
|
38
|
-
console.log(math.help(math.add).toString())
|
|
39
|
-
console.log(math.help(math.add).toJSON())
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function hex
|
|
4
|
-
|
|
5
|
-
Format a number as hexadecimal.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.hex(value)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`value` | number | Value to be stringified
|
|
19
|
-
`wordSize` | number | Optional word size (see `format`)
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
string | The formatted value
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
//the following outputs "0xF0"
|
|
38
|
-
math.hex(240)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## See also
|
|
43
|
-
|
|
44
|
-
[oct](oct.md),
|
|
45
|
-
[bin](bin.md)
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function hypot
|
|
4
|
-
|
|
5
|
-
Calculate the hypotenusa of a list with values. The hypotenusa is defined as:
|
|
6
|
-
|
|
7
|
-
hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...)
|
|
8
|
-
|
|
9
|
-
For matrix input, the hypotenusa is calculated for all values in the matrix.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Syntax
|
|
13
|
-
|
|
14
|
-
```js
|
|
15
|
-
math.hypot(a, b, ...)
|
|
16
|
-
math.hypot([a, b, c, ...])
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Parameters
|
|
20
|
-
|
|
21
|
-
Parameter | Type | Description
|
|
22
|
-
--------- | ---- | -----------
|
|
23
|
-
`args` | ... number | BigNumber | Array | Matrix | A list with numeric values or an Array or Matrix. Matrix and Array input is flattened and returns a single number for the whole matrix.
|
|
24
|
-
|
|
25
|
-
### Returns
|
|
26
|
-
|
|
27
|
-
Type | Description
|
|
28
|
-
---- | -----------
|
|
29
|
-
number | BigNumber | Returns the hypothenusa of the input values.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Throws
|
|
33
|
-
|
|
34
|
-
Type | Description
|
|
35
|
-
---- | -----------
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Examples
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
math.hypot(3, 4) // 5
|
|
42
|
-
math.hypot(3, 4, 5) // 7.0710678118654755
|
|
43
|
-
math.hypot([3, 4, 5]) // 7.0710678118654755
|
|
44
|
-
math.hypot(-2) // 2
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## See also
|
|
49
|
-
|
|
50
|
-
[abs](abs.md),
|
|
51
|
-
[norm](norm.md)
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function identity
|
|
4
|
-
|
|
5
|
-
Create a 2-dimensional identity matrix with size m x n or n x n.
|
|
6
|
-
The matrix has ones on the diagonal and zeros elsewhere.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.identity(n)
|
|
13
|
-
math.identity(n, format)
|
|
14
|
-
math.identity(m, n)
|
|
15
|
-
math.identity(m, n, format)
|
|
16
|
-
math.identity([m, n])
|
|
17
|
-
math.identity([m, n], format)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Parameters
|
|
21
|
-
|
|
22
|
-
Parameter | Type | Description
|
|
23
|
-
--------- | ---- | -----------
|
|
24
|
-
`size` | ...number | Matrix | Array | The size for the matrix
|
|
25
|
-
`format` | string | The Matrix storage format
|
|
26
|
-
|
|
27
|
-
### Returns
|
|
28
|
-
|
|
29
|
-
Type | Description
|
|
30
|
-
---- | -----------
|
|
31
|
-
Matrix | Array | number | A matrix with ones on the diagonal.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Throws
|
|
35
|
-
|
|
36
|
-
Type | Description
|
|
37
|
-
---- | -----------
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## Examples
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
math.identity(3) // returns [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
|
44
|
-
math.identity(3, 2) // returns [[1, 0], [0, 1], [0, 0]]
|
|
45
|
-
|
|
46
|
-
const A = [[1, 2, 3], [4, 5, 6]]
|
|
47
|
-
math.identity(math.size(A)) // returns [[1, 0, 0], [0, 1, 0]]
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## See also
|
|
52
|
-
|
|
53
|
-
[diag](diag.md),
|
|
54
|
-
[ones](ones.md),
|
|
55
|
-
[zeros](zeros.md),
|
|
56
|
-
[size](size.md),
|
|
57
|
-
[range](range.md)
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function ifft
|
|
4
|
-
|
|
5
|
-
Calculate N-dimensional inverse fourier transform
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.ifft(arr)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`arr` | Array | Matrix | An array or matrix
|
|
19
|
-
|
|
20
|
-
### Returns
|
|
21
|
-
|
|
22
|
-
Type | Description
|
|
23
|
-
---- | -----------
|
|
24
|
-
Array | Matrix | N-dimensional fourier transformation of the array
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Throws
|
|
28
|
-
|
|
29
|
-
Type | Description
|
|
30
|
-
---- | -----------
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## See also
|
|
34
|
-
|
|
35
|
-
[fft](fft.md)
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function im
|
|
4
|
-
|
|
5
|
-
Get the imaginary part of a complex number.
|
|
6
|
-
For a complex number `a + bi`, the function returns `b`.
|
|
7
|
-
|
|
8
|
-
For matrices, the function is evaluated element wise.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.im(x)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`x` | number | BigNumber | Complex | Array | Matrix | A complex number or array with complex numbers
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Array | Matrix | The imaginary part of x
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const a = math.complex(2, 3)
|
|
40
|
-
math.re(a) // returns number 2
|
|
41
|
-
math.im(a) // returns number 3
|
|
42
|
-
|
|
43
|
-
math.re(math.complex('-5.2i')) // returns number -5.2
|
|
44
|
-
math.re(math.complex(2.4)) // returns number 0
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## See also
|
|
49
|
-
|
|
50
|
-
[re](re.md),
|
|
51
|
-
[conj](conj.md),
|
|
52
|
-
[abs](abs.md),
|
|
53
|
-
[arg](arg.md)
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function import
|
|
4
|
-
|
|
5
|
-
Import functions from an object or a module.
|
|
6
|
-
|
|
7
|
-
This function is only available on a mathjs instance created using `create`.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.import(functions)
|
|
14
|
-
math.import(functions, options)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Where
|
|
18
|
-
|
|
19
|
-
- `functions: Object`
|
|
20
|
-
An object with functions or factories to be imported.
|
|
21
|
-
- `options: Object` An object with import options. Available options:
|
|
22
|
-
- `override: boolean`
|
|
23
|
-
If true, existing functions will be overwritten. False by default.
|
|
24
|
-
- `silent: boolean`
|
|
25
|
-
If true, the function will not throw errors on duplicates or invalid
|
|
26
|
-
types. False by default.
|
|
27
|
-
- `wrap: boolean`
|
|
28
|
-
If true, the functions will be wrapped in a wrapper function
|
|
29
|
-
which converts data types like Matrix to primitive data types like Array.
|
|
30
|
-
The wrapper is needed when extending math.js with libraries which do not
|
|
31
|
-
support these data type. False by default.
|
|
32
|
-
|
|
33
|
-
### Parameters
|
|
34
|
-
|
|
35
|
-
Parameter | Type | Description
|
|
36
|
-
--------- | ---- | -----------
|
|
37
|
-
`functions` | Object | Array | Object with functions to be imported.
|
|
38
|
-
`options` | Object | Import options.
|
|
39
|
-
|
|
40
|
-
## Examples
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
import { create, all } from 'mathjs'
|
|
44
|
-
import * as numbers from 'numbers'
|
|
45
|
-
|
|
46
|
-
// create a mathjs instance
|
|
47
|
-
const math = create(all)
|
|
48
|
-
|
|
49
|
-
// define new functions and variables
|
|
50
|
-
math.import({
|
|
51
|
-
myvalue: 42,
|
|
52
|
-
hello: function (name) {
|
|
53
|
-
return 'hello, ' + name + '!'
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
// use the imported function and variable
|
|
58
|
-
math.myvalue * 2 // 84
|
|
59
|
-
math.hello('user') // 'hello, user!'
|
|
60
|
-
|
|
61
|
-
// import the npm module 'numbers'
|
|
62
|
-
// (must be installed first with `npm install numbers`)
|
|
63
|
-
math.import(numbers, {wrap: true})
|
|
64
|
-
|
|
65
|
-
math.fibonacci(7) // returns 13
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function index
|
|
4
|
-
|
|
5
|
-
Create an index. An Index can store ranges having start, step, and end
|
|
6
|
-
for multiple dimensions.
|
|
7
|
-
Matrix.get, Matrix.set, and math.subset accept an Index as input.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.index(range1, range2, ...)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Where
|
|
17
|
-
|
|
18
|
-
- A number
|
|
19
|
-
- A string for getting/setting an object property
|
|
20
|
-
- An instance of `Range`
|
|
21
|
-
- A one-dimensional Array or a Matrix with numbers
|
|
22
|
-
|
|
23
|
-
### Parameters
|
|
24
|
-
|
|
25
|
-
Parameter | Type | Description
|
|
26
|
-
--------- | ---- | -----------
|
|
27
|
-
`ranges` | ...* | Zero or more ranges or numbers.
|
|
28
|
-
|
|
29
|
-
### Returns
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
Index | Returns the created index
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const b = [1, 2, 3, 4, 5]
|
|
40
|
-
math.subset(b, math.index([1, 2, 3])) // returns [2, 3, 4]
|
|
41
|
-
|
|
42
|
-
const a = math.matrix([[1, 2], [3, 4]])
|
|
43
|
-
a.subset(math.index(0, 1)) // returns 2
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## See also
|
|
48
|
-
|
|
49
|
-
[bignumber](bignumber.md),
|
|
50
|
-
[boolean](boolean.md),
|
|
51
|
-
[complex](complex.md),
|
|
52
|
-
[matrix](matrix.md),
|
|
53
|
-
[number](number.md),
|
|
54
|
-
[string](string.md),
|
|
55
|
-
[unit](unit.md)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function intersect
|
|
4
|
-
|
|
5
|
-
Calculates the point of intersection of two lines in two or three dimensions
|
|
6
|
-
and of a line and a plane in three dimensions. The inputs are in the form of
|
|
7
|
-
arrays or 1 dimensional matrices. The line intersection functions return null
|
|
8
|
-
if the lines do not meet.
|
|
9
|
-
|
|
10
|
-
Note: Fill the plane coefficients as `x + y + z = c` and not as `x + y + z + c = 0`.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Syntax
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
math.intersect(endPoint1Line1, endPoint2Line1, endPoint1Line2, endPoint2Line2)
|
|
17
|
-
math.intersect(endPoint1, endPoint2, planeCoefficients)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Parameters
|
|
21
|
-
|
|
22
|
-
Parameter | Type | Description
|
|
23
|
-
--------- | ---- | -----------
|
|
24
|
-
`w` | Array | Matrix | Co-ordinates of first end-point of first line
|
|
25
|
-
`x` | Array | Matrix | Co-ordinates of second end-point of first line
|
|
26
|
-
`y` | Array | Matrix | Co-ordinates of first end-point of second line OR Co-efficients of the plane's equation
|
|
27
|
-
`z` | Array | Matrix | Co-ordinates of second end-point of second line OR undefined if the calculation is for line and plane
|
|
28
|
-
|
|
29
|
-
### Returns
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
Array | Returns the point of intersection of lines/lines-planes
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### Throws
|
|
37
|
-
|
|
38
|
-
Type | Description
|
|
39
|
-
---- | -----------
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Examples
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
math.intersect([0, 0], [10, 10], [10, 0], [0, 10]) // Returns [5, 5]
|
|
46
|
-
math.intersect([0, 0, 0], [10, 10, 0], [10, 0, 0], [0, 10, 0]) // Returns [5, 5, 0]
|
|
47
|
-
math.intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6]) // Returns [7, -4, 3]
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|