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,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 squeeze
|
|
4
|
-
|
|
5
|
-
Squeeze a matrix, remove inner and outer singleton dimensions from a matrix.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.squeeze(x)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`x` | Matrix | Array | Matrix to be squeezed
|
|
19
|
-
|
|
20
|
-
### Returns
|
|
21
|
-
|
|
22
|
-
Type | Description
|
|
23
|
-
---- | -----------
|
|
24
|
-
Matrix | Array | Squeezed matrix
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Throws
|
|
28
|
-
|
|
29
|
-
Type | Description
|
|
30
|
-
---- | -----------
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## Examples
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
math.squeeze([3]) // returns 3
|
|
37
|
-
math.squeeze([[3]]) // returns 3
|
|
38
|
-
|
|
39
|
-
const A = math.zeros(3, 1) // returns [[0], [0], [0]] (size 3x1)
|
|
40
|
-
math.squeeze(A) // returns [0, 0, 0] (size 3)
|
|
41
|
-
|
|
42
|
-
const B = math.zeros(1, 3) // returns [[0, 0, 0]] (size 1x3)
|
|
43
|
-
math.squeeze(B) // returns [0, 0, 0] (size 3)
|
|
44
|
-
|
|
45
|
-
// only inner and outer dimensions are removed
|
|
46
|
-
const C = math.zeros(2, 1, 3) // returns [[[0, 0, 0]], [[0, 0, 0]]] (size 2x1x3)
|
|
47
|
-
math.squeeze(C) // returns [[[0, 0, 0]], [[0, 0, 0]]] (size 2x1x3)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## See also
|
|
52
|
-
|
|
53
|
-
[subset](subset.md)
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function std
|
|
4
|
-
|
|
5
|
-
Compute the standard deviation of a matrix or a list with values.
|
|
6
|
-
The standard deviations is defined as the square root of the variance:
|
|
7
|
-
`std(A) = sqrt(variance(A))`.
|
|
8
|
-
In case of a (multi dimensional) array or matrix, the standard deviation
|
|
9
|
-
over all elements will be calculated by default, unless an axis is specified
|
|
10
|
-
in which case the standard deviation will be computed along that axis.
|
|
11
|
-
|
|
12
|
-
Additionally, it is possible to compute the standard deviation along the rows
|
|
13
|
-
or columns of a matrix by specifying the dimension as the second argument.
|
|
14
|
-
|
|
15
|
-
Optionally, the type of normalization can be specified as the final
|
|
16
|
-
parameter. The parameter `normalization` can be one of the following values:
|
|
17
|
-
|
|
18
|
-
- 'unbiased' (default) The sum of squared errors is divided by (n - 1)
|
|
19
|
-
- 'uncorrected' The sum of squared errors is divided by n
|
|
20
|
-
- 'biased' The sum of squared errors is divided by (n + 1)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Syntax
|
|
24
|
-
|
|
25
|
-
```js
|
|
26
|
-
math.std(a, b, c, ...)
|
|
27
|
-
math.std(A)
|
|
28
|
-
math.std(A, normalization)
|
|
29
|
-
math.std(A, dimension)
|
|
30
|
-
math.std(A, dimension, normalization)
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Parameters
|
|
34
|
-
|
|
35
|
-
Parameter | Type | Description
|
|
36
|
-
--------- | ---- | -----------
|
|
37
|
-
`array` | Array | Matrix | A single matrix or or multiple scalar values
|
|
38
|
-
`normalization` | string | Determines how to normalize the variance. Choose 'unbiased' (default), 'uncorrected', or 'biased'. Default value: 'unbiased'.
|
|
39
|
-
|
|
40
|
-
### Returns
|
|
41
|
-
|
|
42
|
-
Type | Description
|
|
43
|
-
---- | -----------
|
|
44
|
-
* | The standard deviation
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Throws
|
|
48
|
-
|
|
49
|
-
Type | Description
|
|
50
|
-
---- | -----------
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## Examples
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
math.std(2, 4, 6) // returns 2
|
|
57
|
-
math.std([2, 4, 6, 8]) // returns 2.581988897471611
|
|
58
|
-
math.std([2, 4, 6, 8], 'uncorrected') // returns 2.23606797749979
|
|
59
|
-
math.std([2, 4, 6, 8], 'biased') // returns 2
|
|
60
|
-
|
|
61
|
-
math.std([[1, 2, 3], [4, 5, 6]]) // returns 1.8708286933869707
|
|
62
|
-
math.std([[1, 2, 3], [4, 6, 8]], 0) // returns [2.1213203435596424, 2.8284271247461903, 3.5355339059327378]
|
|
63
|
-
math.std([[1, 2, 3], [4, 6, 8]], 1) // returns [1, 2]
|
|
64
|
-
math.std([[1, 2, 3], [4, 6, 8]], 1, 'biased') // returns [0.7071067811865476, 1.4142135623730951]
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
## See also
|
|
69
|
-
|
|
70
|
-
[mean](mean.md),
|
|
71
|
-
[median](median.md),
|
|
72
|
-
[max](max.md),
|
|
73
|
-
[min](min.md),
|
|
74
|
-
[prod](prod.md),
|
|
75
|
-
[sum](sum.md),
|
|
76
|
-
[variance](variance.md)
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function stirlingS2
|
|
4
|
-
|
|
5
|
-
The Stirling numbers of the second kind, counts the number of ways to partition
|
|
6
|
-
a set of n labelled objects into k nonempty unlabelled subsets.
|
|
7
|
-
stirlingS2 only takes integer arguments.
|
|
8
|
-
The following condition must be enforced: k <= n.
|
|
9
|
-
|
|
10
|
-
If n = k or k = 1 <= n, then s(n,k) = 1
|
|
11
|
-
If k = 0 < n, then s(n,k) = 0
|
|
12
|
-
|
|
13
|
-
Note that if either n or k is supplied as a BigNumber, the result will be
|
|
14
|
-
as well.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Syntax
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
math.stirlingS2(n, k)
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Parameters
|
|
24
|
-
|
|
25
|
-
Parameter | Type | Description
|
|
26
|
-
--------- | ---- | -----------
|
|
27
|
-
`n` | Number | BigNumber | Total number of objects in the set
|
|
28
|
-
`k` | Number | BigNumber | Number of objects in the subset
|
|
29
|
-
|
|
30
|
-
### Returns
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
Number | BigNumber | S(n,k)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Throws
|
|
38
|
-
|
|
39
|
-
Type | Description
|
|
40
|
-
---- | -----------
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Examples
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
math.stirlingS2(5, 3) //returns 25
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## See also
|
|
51
|
-
|
|
52
|
-
[bellNumbers](bellNumbers.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 string
|
|
4
|
-
|
|
5
|
-
Create a string or convert any object into a string.
|
|
6
|
-
Elements of Arrays and Matrices are processed element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.string(value)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`value` | * | Array | Matrix | null | A value to convert to a string
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
string | Array | Matrix | The created string
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## Examples
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
math.string(4.2) // returns string '4.2'
|
|
32
|
-
math.string(math.complex(3, 2) // returns string '3 + 2i'
|
|
33
|
-
|
|
34
|
-
const u = math.unit(5, 'km')
|
|
35
|
-
math.string(u.to('m')) // returns string '5000 m'
|
|
36
|
-
|
|
37
|
-
math.string([true, false]) // returns ['true', 'false']
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## See also
|
|
42
|
-
|
|
43
|
-
[bignumber](bignumber.md),
|
|
44
|
-
[boolean](boolean.md),
|
|
45
|
-
[complex](complex.md),
|
|
46
|
-
[index](index.md),
|
|
47
|
-
[matrix](matrix.md),
|
|
48
|
-
[number](number.md),
|
|
49
|
-
[unit](unit.md)
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function subset
|
|
4
|
-
|
|
5
|
-
Get or set a subset of a matrix or string.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.subset(value, index) // retrieve a subset
|
|
12
|
-
math.subset(value, index, replacement [, defaultValue]) // replace a subset
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`matrix` | Array | Matrix | string | An array, matrix, or string
|
|
20
|
-
`index` | Index | For each dimension of the target, specifies an index or a list of indices to fetch or set. `subset` uses the cartesian product of the indices specified in each dimension.
|
|
21
|
-
`replacement` | * | An array, matrix, or scalar. If provided, the subset is replaced with replacement. If not provided, the subset is returned
|
|
22
|
-
`defaultValue` | * | Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined.
|
|
23
|
-
|
|
24
|
-
### Returns
|
|
25
|
-
|
|
26
|
-
Type | Description
|
|
27
|
-
---- | -----------
|
|
28
|
-
Array | Matrix | string | Either the retrieved subset or the updated matrix.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### Throws
|
|
32
|
-
|
|
33
|
-
Type | Description
|
|
34
|
-
---- | -----------
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Examples
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
// get a subset
|
|
41
|
-
const d = [[1, 2], [3, 4]]
|
|
42
|
-
math.subset(d, math.index(1, 0)) // returns 3
|
|
43
|
-
math.subset(d, math.index([0, 1], 1)) // returns [[2], [4]]
|
|
44
|
-
|
|
45
|
-
// replace a subset
|
|
46
|
-
const e = []
|
|
47
|
-
const f = math.subset(e, math.index(0, [0, 2]), [5, 6]) // f = [[5, 6]] and e = [[5, 0, 6]]
|
|
48
|
-
const g = math.subset(f, math.index(1, 1), 7, 0) // g = [[5, 6], [0, 7]]
|
|
49
|
-
|
|
50
|
-
// get submatrix using ranges
|
|
51
|
-
const M = [
|
|
52
|
-
[1,2,3],
|
|
53
|
-
[4,5,6],
|
|
54
|
-
[7,8,9]
|
|
55
|
-
]
|
|
56
|
-
math.subset(M, math.index(math.range(0,2), math.range(0,3))) // [[1,2,3],[4,5,6]]
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
## See also
|
|
61
|
-
|
|
62
|
-
[size](size.md),
|
|
63
|
-
[resize](resize.md),
|
|
64
|
-
[squeeze](squeeze.md),
|
|
65
|
-
[index](index.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 subtract
|
|
4
|
-
|
|
5
|
-
Subtract two values, `x - y`.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.subtract(x, y)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Initial value
|
|
20
|
-
`y` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Value to subtract from `x`
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Subtraction of `x` and `y`
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.subtract(5.3, 2) // returns number 3.3
|
|
39
|
-
|
|
40
|
-
const a = math.complex(2, 3)
|
|
41
|
-
const b = math.complex(4, 1)
|
|
42
|
-
math.subtract(a, b) // returns Complex -2 + 2i
|
|
43
|
-
|
|
44
|
-
math.subtract([5, 7, 4], 4) // returns Array [1, 3, 0]
|
|
45
|
-
|
|
46
|
-
const c = math.unit('2.1 km')
|
|
47
|
-
const d = math.unit('500m')
|
|
48
|
-
math.subtract(c, d) // returns Unit 1.6 km
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## See also
|
|
53
|
-
|
|
54
|
-
[add](add.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 sum
|
|
4
|
-
|
|
5
|
-
Compute the sum of a matrix or a list with values.
|
|
6
|
-
In case of a (multi dimensional) array or matrix, the sum of all
|
|
7
|
-
elements will be calculated.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.sum(a, b, c, ...)
|
|
14
|
-
math.sum(A)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`args` | ... * | A single matrix or or multiple scalar values
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
* | The sum of all values
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.sum(2, 1, 4, 3) // returns 10
|
|
40
|
-
math.sum([2, 1, 4, 3]) // returns 10
|
|
41
|
-
math.sum([[2, 5], [4, 3], [1, 7]]) // returns 22
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[mean](mean.md),
|
|
48
|
-
[median](median.md),
|
|
49
|
-
[min](min.md),
|
|
50
|
-
[max](max.md),
|
|
51
|
-
[prod](prod.md),
|
|
52
|
-
[std](std.md),
|
|
53
|
-
[variance](variance.md),
|
|
54
|
-
[cumsum](cumsum.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 symbolicEqual
|
|
4
|
-
|
|
5
|
-
Attempts to determine if two expressions are symbolically equal, i.e.
|
|
6
|
-
one is the result of valid algebraic manipulations on the other.
|
|
7
|
-
Currently, this simply checks if the difference of the two expressions
|
|
8
|
-
simplifies down to 0. So there are two important caveats:
|
|
9
|
-
1. whether two expressions are symbolically equal depends on the
|
|
10
|
-
manipulations allowed. Therefore, this function takes an optional
|
|
11
|
-
third argument, which are the options that control the behavior
|
|
12
|
-
as documented for the `simplify()` function.
|
|
13
|
-
2. it is in general intractable to find the minimal simplification of
|
|
14
|
-
an arbitrarily complicated expression. So while a `true` value
|
|
15
|
-
of `symbolicEqual` ensures that the two expressions can be manipulated
|
|
16
|
-
to match each other, a `false` value does not absolutely rule this out.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Syntax
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
symbolicEqual(expr1, expr2)
|
|
23
|
-
symbolicEqual(expr1, expr2, options)
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Parameters
|
|
27
|
-
|
|
28
|
-
Parameter | Type | Description
|
|
29
|
-
--------- | ---- | -----------
|
|
30
|
-
`expr1` | Node | string | The first expression to compare
|
|
31
|
-
`expr2` | Node | string | The second expression to compare
|
|
32
|
-
`options` | Object | Optional option object, passed to simplify
|
|
33
|
-
|
|
34
|
-
### Returns
|
|
35
|
-
|
|
36
|
-
Type | Description
|
|
37
|
-
---- | -----------
|
|
38
|
-
boolean | Returns true if a valid manipulation making the expressions equal is found.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Throws
|
|
42
|
-
|
|
43
|
-
Type | Description
|
|
44
|
-
---- | -----------
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## Examples
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
symbolicEqual('x*y', 'y*x') // true
|
|
51
|
-
symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}})
|
|
52
|
-
//false
|
|
53
|
-
symbolicEqual('x/y', '(y*x^(-1))^(-1)') // true
|
|
54
|
-
symbolicEqual('abs(x)','x') // false
|
|
55
|
-
symbolicEqual('abs(x)','x', simplify.positiveContext) // true
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## See also
|
|
60
|
-
|
|
61
|
-
[simplify](simplify.md),
|
|
62
|
-
[evaluate](evaluate.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 tan
|
|
4
|
-
|
|
5
|
-
Calculate the tangent of a value. `tan(x)` is equal to `sin(x) / cos(x)`.
|
|
6
|
-
|
|
7
|
-
For matrices, the function is evaluated element wise.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.tan(x)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | number | BigNumber | Complex | Unit | Array | Matrix | Function input
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
number | BigNumber | Complex | Array | Matrix | Tangent of x
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.tan(0.5) // returns number 0.5463024898437905
|
|
39
|
-
math.sin(0.5) / math.cos(0.5) // returns number 0.5463024898437905
|
|
40
|
-
math.tan(math.pi / 4) // returns number 1
|
|
41
|
-
math.tan(math.unit(45, 'deg')) // returns number 1
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[atan](atan.md),
|
|
48
|
-
[sin](sin.md),
|
|
49
|
-
[cos](cos.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 tanh
|
|
4
|
-
|
|
5
|
-
Calculate the hyperbolic tangent of a value,
|
|
6
|
-
defined as `tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1)`.
|
|
7
|
-
|
|
8
|
-
For matrices, the function is evaluated element wise.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.tanh(x)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`x` | number | BigNumber | Complex | Unit | Array | Matrix | Function input
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Complex | Array | Matrix | Hyperbolic tangent of x
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
// tanh(x) = sinh(x) / cosh(x) = 1 / coth(x)
|
|
40
|
-
math.tanh(0.5) // returns 0.46211715726000974
|
|
41
|
-
math.sinh(0.5) / math.cosh(0.5) // returns 0.46211715726000974
|
|
42
|
-
1 / math.coth(0.5) // returns 0.46211715726000974
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## See also
|
|
47
|
-
|
|
48
|
-
[sinh](sinh.md),
|
|
49
|
-
[cosh](cosh.md),
|
|
50
|
-
[coth](coth.md)
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function to
|
|
4
|
-
|
|
5
|
-
Change the unit of a value.
|
|
6
|
-
|
|
7
|
-
For matrices, the function is evaluated element wise.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.to(x, unit)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | Unit | Array | Matrix | The unit to be converted.
|
|
21
|
-
`unit` | Unit | Array | Matrix | New unit. Can be a string like "cm" or a unit without value.
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
Unit | Array | Matrix | value with changed, fixed unit.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.to(math.unit('2 inch'), 'cm') // returns Unit 5.08 cm
|
|
40
|
-
math.to(math.unit('2 inch'), math.unit(null, 'cm')) // returns Unit 5.08 cm
|
|
41
|
-
math.to(math.unit(16, 'bytes'), 'bits') // returns Unit 128 bits
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[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 trace
|
|
4
|
-
|
|
5
|
-
Calculate the trace of a matrix: the sum of the elements on the main
|
|
6
|
-
diagonal of a square matrix.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.trace(x)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`x` | Array | Matrix | A matrix
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
number | The trace of `x`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.trace([[1, 2], [3, 4]]) // returns 5
|
|
38
|
-
|
|
39
|
-
const A = [
|
|
40
|
-
[1, 2, 3],
|
|
41
|
-
[-1, 2, 3],
|
|
42
|
-
[2, 0, 3]
|
|
43
|
-
]
|
|
44
|
-
math.trace(A) // returns 6
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## See also
|
|
49
|
-
|
|
50
|
-
[diag](diag.md)
|