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,54 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function exp
|
|
4
|
-
|
|
5
|
-
Calculate the exponent of a value.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.exp(x)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`x` | number | BigNumber | Complex | Array | Matrix | A number or matrix to exponentiate
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
number | BigNumber | Complex | Array | Matrix | Exponent of `x`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.exp(2) // returns number 7.3890560989306495
|
|
38
|
-
math.pow(math.e, 2) // returns number 7.3890560989306495
|
|
39
|
-
math.log(math.exp(2)) // returns number 2
|
|
40
|
-
|
|
41
|
-
math.exp([1, 2, 3])
|
|
42
|
-
// returns Array [
|
|
43
|
-
// 2.718281828459045,
|
|
44
|
-
// 7.3890560989306495,
|
|
45
|
-
// 20.085536923187668
|
|
46
|
-
// ]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## See also
|
|
51
|
-
|
|
52
|
-
[expm1](expm1.md),
|
|
53
|
-
[log](log.md),
|
|
54
|
-
[pow](pow.md)
|
|
@@ -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 expm
|
|
4
|
-
|
|
5
|
-
Compute the matrix exponential, expm(A) = e^A. The matrix must be square.
|
|
6
|
-
Not to be confused with exp(a), which performs element-wise
|
|
7
|
-
exponentiation.
|
|
8
|
-
|
|
9
|
-
The exponential is calculated using the Padé approximant with scaling and
|
|
10
|
-
squaring; see "Nineteen Dubious Ways to Compute the Exponential of a
|
|
11
|
-
Matrix," by Moler and Van Loan.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Syntax
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
math.expm(x)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Parameters
|
|
21
|
-
|
|
22
|
-
Parameter | Type | Description
|
|
23
|
-
--------- | ---- | -----------
|
|
24
|
-
`x` | Matrix | A square Matrix
|
|
25
|
-
|
|
26
|
-
### Returns
|
|
27
|
-
|
|
28
|
-
Type | Description
|
|
29
|
-
---- | -----------
|
|
30
|
-
Matrix | The exponential of x
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Throws
|
|
34
|
-
|
|
35
|
-
Type | Description
|
|
36
|
-
---- | -----------
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Examples
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
const A = [[0,2],[0,0]]
|
|
43
|
-
math.expm(A) // returns [[1,2],[0,1]]
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## See also
|
|
48
|
-
|
|
49
|
-
[exp](exp.md)
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function expm1
|
|
4
|
-
|
|
5
|
-
Calculate the value of subtracting 1 from the exponential value.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.expm1(x)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`x` | number | BigNumber | Complex | Array | Matrix | A number or matrix to apply expm1
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
number | BigNumber | Complex | Array | Matrix | Exponent of `x`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.expm1(2) // returns number 6.38905609893065
|
|
38
|
-
math.pow(math.e, 2) - 1 // returns number 6.3890560989306495
|
|
39
|
-
math.log(math.expm1(2) + 1) // returns number 2
|
|
40
|
-
|
|
41
|
-
math.expm1([1, 2, 3])
|
|
42
|
-
// returns Array [
|
|
43
|
-
// 1.718281828459045,
|
|
44
|
-
// 6.3890560989306495,
|
|
45
|
-
// 19.085536923187668
|
|
46
|
-
// ]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## See also
|
|
51
|
-
|
|
52
|
-
[exp](exp.md),
|
|
53
|
-
[log](log.md),
|
|
54
|
-
[pow](pow.md)
|
|
@@ -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 factorial
|
|
4
|
-
|
|
5
|
-
Compute the factorial of a value
|
|
6
|
-
|
|
7
|
-
Factorial only supports an integer value as argument.
|
|
8
|
-
For matrices, the function is evaluated element wise.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.factorial(n)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`n` | number | BigNumber | Array | Matrix | An integer number
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Array | Matrix | The factorial of `n`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.factorial(5) // returns 120
|
|
40
|
-
math.factorial(3) // returns 6
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## See also
|
|
45
|
-
|
|
46
|
-
[combinations](combinations.md),
|
|
47
|
-
[combinationsWithRep](combinationsWithRep.md),
|
|
48
|
-
[gamma](gamma.md),
|
|
49
|
-
[permutations](permutations.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 fft
|
|
4
|
-
|
|
5
|
-
Calculate N-dimensional fourier transform
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.fft(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
|
-
[ifft](ifft.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 filter
|
|
4
|
-
|
|
5
|
-
Filter the items in an array or one dimensional matrix.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.filter(x, test)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`x` | Matrix | Array | A one dimensional matrix or array to filter
|
|
19
|
-
`test` | Function | RegExp | A function or regular expression to test items. All entries for which `test` returns true are returned. When `test` is a function, it is invoked with three parameters: the value of the element, the index of the element, and the matrix/array being traversed. The function must return a boolean.
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
Matrix | Array | Returns the filtered matrix.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
function isPositive (x) {
|
|
38
|
-
return x > 0
|
|
39
|
-
}
|
|
40
|
-
math.filter([6, -2, -1, 4, 3], isPositive) // returns [6, 4, 3]
|
|
41
|
-
|
|
42
|
-
math.filter(["23", "foo", "100", "55", "bar"], /[0-9]+/) // returns ["23", "100", "55"]
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## See also
|
|
47
|
-
|
|
48
|
-
[forEach](forEach.md),
|
|
49
|
-
[map](map.md),
|
|
50
|
-
[sort](sort.md)
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function fix
|
|
4
|
-
|
|
5
|
-
Round a value towards zero.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.fix(x)
|
|
13
|
-
math.fix(x,n)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | number | BigNumber | Fraction | Complex | Array | Matrix | Number to be rounded
|
|
21
|
-
`n` | number | BigNumber | Array | Number of decimals Default value: 0.
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Fraction | Complex | Array | Matrix | Rounded value
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.fix(3.2) // returns number 3
|
|
40
|
-
math.fix(3.8) // returns number 3
|
|
41
|
-
math.fix(-4.2) // returns number -4
|
|
42
|
-
math.fix(-4.7) // returns number -4
|
|
43
|
-
|
|
44
|
-
math.fix(3.12, 1) // returns number 3.1
|
|
45
|
-
math.fix(3.18, 1) // returns number 3.1
|
|
46
|
-
math.fix(-4.12, 1) // returns number -4.1
|
|
47
|
-
math.fix(-4.17, 1) // returns number -4.1
|
|
48
|
-
|
|
49
|
-
const c = math.complex(3.22, -2.78)
|
|
50
|
-
math.fix(c) // returns Complex 3 - 2i
|
|
51
|
-
math.fix(c, 1) // returns Complex 3.2 - 2.7i
|
|
52
|
-
|
|
53
|
-
math.fix([3.2, 3.8, -4.7]) // returns Array [3, 3, -4]
|
|
54
|
-
math.fix([3.2, 3.8, -4.7], 1) // returns Array [3.2, 3.8, -4.7]
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## See also
|
|
59
|
-
|
|
60
|
-
[ceil](ceil.md),
|
|
61
|
-
[floor](floor.md),
|
|
62
|
-
[round](round.md)
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function flatten
|
|
4
|
-
|
|
5
|
-
Flatten a multi dimensional matrix into a single dimensional matrix.
|
|
6
|
-
It is guaranteed to always return a clone of the argument.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.flatten(x)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`x` | Matrix | Array | Matrix to be flattened
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
Matrix | Array | Returns the flattened matrix
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.flatten([[1,2], [3,4]]) // returns [1, 2, 3, 4]
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## See also
|
|
42
|
-
|
|
43
|
-
[concat](concat.md),
|
|
44
|
-
[resize](resize.md),
|
|
45
|
-
[size](size.md),
|
|
46
|
-
[squeeze](squeeze.md)
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function floor
|
|
4
|
-
|
|
5
|
-
Round a value towards minus infinity.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.floor(x)
|
|
13
|
-
math.floor(x, n)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | number | BigNumber | Fraction | Complex | Array | Matrix | Number to be rounded
|
|
21
|
-
`n` | number | BigNumber | Array | Number of decimals Default value: 0.
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Fraction | Complex | Array | Matrix | Rounded value
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.floor(3.2) // returns number 3
|
|
40
|
-
math.floor(3.8) // returns number 3
|
|
41
|
-
math.floor(-4.2) // returns number -5
|
|
42
|
-
math.floor(-4.7) // returns number -5
|
|
43
|
-
|
|
44
|
-
math.floor(3.212, 2) // returns number 3.21
|
|
45
|
-
math.floor(3.288, 2) // returns number 3.28
|
|
46
|
-
math.floor(-4.212, 2) // returns number -4.22
|
|
47
|
-
math.floor(-4.782, 2) // returns number -4.79
|
|
48
|
-
|
|
49
|
-
const c = math.complex(3.24, -2.71)
|
|
50
|
-
math.floor(c) // returns Complex 3 - 3i
|
|
51
|
-
math.floor(c, 1) // returns Complex 3.2 - 2.8i
|
|
52
|
-
|
|
53
|
-
math.floor([3.2, 3.8, -4.7]) // returns Array [3, 3, -5]
|
|
54
|
-
math.floor([3.21, 3.82, -4.71], 1) // returns Array [3.2, 3.8, -4.8]
|
|
55
|
-
|
|
56
|
-
math.floor(math.tau, [2, 3]) // returns Array [6.28, 6.283]
|
|
57
|
-
|
|
58
|
-
// Note that floor(array, array) currently not implemented.
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## See also
|
|
63
|
-
|
|
64
|
-
[ceil](ceil.md),
|
|
65
|
-
[fix](fix.md),
|
|
66
|
-
[round](round.md)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function forEach
|
|
4
|
-
|
|
5
|
-
Iterate over all elements of a matrix/array, and executes the given callback function.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.forEach(x, callback)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`x` | Matrix | Array | The matrix to iterate on.
|
|
19
|
-
`callback` | Function | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix/array being traversed.
|
|
20
|
-
|
|
21
|
-
### Throws
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
math.forEach([1, 2, 3], function(value) {
|
|
31
|
-
console.log(value)
|
|
32
|
-
})
|
|
33
|
-
// outputs 1, 2, 3
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## See also
|
|
38
|
-
|
|
39
|
-
[filter](filter.md),
|
|
40
|
-
[map](map.md),
|
|
41
|
-
[sort](sort.md)
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function format
|
|
4
|
-
|
|
5
|
-
Format a value of any type into a string.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.format(value)
|
|
12
|
-
math.format(value, options)
|
|
13
|
-
math.format(value, precision)
|
|
14
|
-
math.format(value, callback)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Where
|
|
18
|
-
|
|
19
|
-
- `value: *`
|
|
20
|
-
The value to be formatted
|
|
21
|
-
- `options: Object`
|
|
22
|
-
An object with formatting options. Available options:
|
|
23
|
-
- `notation: string`
|
|
24
|
-
Number notation. Choose from:
|
|
25
|
-
- 'fixed'
|
|
26
|
-
Always use regular number notation.
|
|
27
|
-
For example '123.40' and '14000000'
|
|
28
|
-
- 'exponential'
|
|
29
|
-
Always use exponential notation.
|
|
30
|
-
For example '1.234e+2' and '1.4e+7'
|
|
31
|
-
- 'engineering'
|
|
32
|
-
Always use engineering notation: always have exponential notation,
|
|
33
|
-
and select the exponent to be a multiple of 3.
|
|
34
|
-
For example '123.4e+0' and '14.0e+6'
|
|
35
|
-
- 'auto' (default)
|
|
36
|
-
Regular number notation for numbers having an absolute value between
|
|
37
|
-
`lower` and `upper` bounds, and uses exponential notation elsewhere.
|
|
38
|
-
Lower bound is included, upper bound is excluded.
|
|
39
|
-
For example '123.4' and '1.4e7'.
|
|
40
|
-
- 'bin', 'oct, or 'hex'
|
|
41
|
-
Format the number using binary, octal, or hexadecimal notation.
|
|
42
|
-
For example '0b1101' and '0x10fe'.
|
|
43
|
-
- `wordSize: number`
|
|
44
|
-
The word size in bits to use for formatting in binary, octal, or
|
|
45
|
-
hexadecimal notation. To be used only with 'bin', 'oct', or 'hex'
|
|
46
|
-
values for 'notation' option. When this option is defined the value
|
|
47
|
-
is formatted as a signed twos complement integer of the given word
|
|
48
|
-
size and the size suffix is appended to the output.
|
|
49
|
-
For example format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'.
|
|
50
|
-
Default value is undefined.
|
|
51
|
-
- `precision: number`
|
|
52
|
-
Limit the number of digits of the formatted value.
|
|
53
|
-
For regular numbers, must be a number between 0 and 16.
|
|
54
|
-
For bignumbers, the maximum depends on the configured precision,
|
|
55
|
-
see function `config()`.
|
|
56
|
-
In case of notations 'exponential', 'engineering', and 'auto', `precision`
|
|
57
|
-
defines the total number of significant digits returned.
|
|
58
|
-
In case of notation 'fixed', `precision` defines the number of
|
|
59
|
-
significant digits after the decimal point.
|
|
60
|
-
`precision` is undefined by default.
|
|
61
|
-
- `lowerExp: number`
|
|
62
|
-
Exponent determining the lower boundary for formatting a value with
|
|
63
|
-
an exponent when `notation='auto`. Default value is `-3`.
|
|
64
|
-
- `upperExp: number`
|
|
65
|
-
Exponent determining the upper boundary for formatting a value with
|
|
66
|
-
an exponent when `notation='auto`. Default value is `5`.
|
|
67
|
-
- `fraction: string`. Available values: 'ratio' (default) or 'decimal'.
|
|
68
|
-
For example `format(fraction(1, 3))` will output '1/3' when 'ratio' is
|
|
69
|
-
configured, and will output `0.(3)` when 'decimal' is configured.
|
|
70
|
-
- `truncate: number`. Specifies the maximum allowed length of the
|
|
71
|
-
returned string. If it would have been longer, the excess characters
|
|
72
|
-
are deleted and replaced with `'...'`.
|
|
73
|
-
- `callback: function`
|
|
74
|
-
A custom formatting function, invoked for all numeric elements in `value`,
|
|
75
|
-
for example all elements of a matrix, or the real and imaginary
|
|
76
|
-
parts of a complex number. This callback can be used to override the
|
|
77
|
-
built-in numeric notation with any type of formatting. Function `callback`
|
|
78
|
-
is called with `value` as parameter and must return a string.
|
|
79
|
-
|
|
80
|
-
### Parameters
|
|
81
|
-
|
|
82
|
-
Parameter | Type | Description
|
|
83
|
-
--------- | ---- | -----------
|
|
84
|
-
`value` | * | Value to be stringified
|
|
85
|
-
`options` | Object | Function | number | Formatting options
|
|
86
|
-
|
|
87
|
-
### Returns
|
|
88
|
-
|
|
89
|
-
Type | Description
|
|
90
|
-
---- | -----------
|
|
91
|
-
string | The formatted value
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### Throws
|
|
95
|
-
|
|
96
|
-
Type | Description
|
|
97
|
-
---- | -----------
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
## Examples
|
|
101
|
-
|
|
102
|
-
```js
|
|
103
|
-
math.format(6.4) // returns '6.4'
|
|
104
|
-
math.format(1240000) // returns '1.24e6'
|
|
105
|
-
math.format(1/3) // returns '0.3333333333333333'
|
|
106
|
-
math.format(1/3, 3) // returns '0.333'
|
|
107
|
-
math.format(21385, 2) // returns '21000'
|
|
108
|
-
math.format(12e8, {notation: 'fixed'}) // returns '1200000000'
|
|
109
|
-
math.format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000'
|
|
110
|
-
math.format(52.8, {notation: 'exponential'}) // returns '5.28e+1'
|
|
111
|
-
math.format(12400,{notation: 'engineering'}) // returns '12.400e+3'
|
|
112
|
-
math.format(2000, {lowerExp: -2, upperExp: 2}) // returns '2e+3'
|
|
113
|
-
|
|
114
|
-
function formatCurrency(value) {
|
|
115
|
-
// return currency notation with two digits:
|
|
116
|
-
return '$' + value.toFixed(2)
|
|
117
|
-
|
|
118
|
-
// you could also use math.format inside the callback:
|
|
119
|
-
// return '$' + math.format(value, {notation: 'fixed', precision: 2})
|
|
120
|
-
}
|
|
121
|
-
math.format([2.1, 3, 0.016], formatCurrency) // returns '[$2.10, $3.00, $0.02]'
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
## See also
|
|
126
|
-
|
|
127
|
-
[print](print.md)
|
|
@@ -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 fraction
|
|
4
|
-
|
|
5
|
-
Create a fraction convert a value to a fraction.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.fraction(numerator, denominator)
|
|
12
|
-
math.fraction({n: numerator, d: denominator})
|
|
13
|
-
math.fraction(matrix: Array | Matrix) Turn all matrix entries
|
|
14
|
-
into fractions
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`args` | number | string | Fraction | BigNumber | Array | Matrix | Arguments specifying the numerator and denominator of the fraction
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
Fraction | Array | Matrix | Returns a fraction
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Examples
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
math.fraction(1, 3)
|
|
34
|
-
math.fraction('2/3')
|
|
35
|
-
math.fraction({n: 2, d: 3})
|
|
36
|
-
math.fraction([0.2, 0.25, 1.25])
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## See also
|
|
41
|
-
|
|
42
|
-
[bignumber](bignumber.md),
|
|
43
|
-
[number](number.md),
|
|
44
|
-
[string](string.md),
|
|
45
|
-
[unit](unit.md)
|