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 setCartesian
|
|
4
|
-
|
|
5
|
-
Create the cartesian product of two (multi)sets.
|
|
6
|
-
Multi-dimension arrays will be converted to single-dimension arrays
|
|
7
|
-
and the values will be sorted in ascending order before the operation.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.setCartesian(set1, set2)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`a1` | Array | Matrix | A (multi)set
|
|
21
|
-
`a2` | Array | Matrix | A (multi)set
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
Array | Matrix | The cartesian product of two (multi)sets
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.setCartesian([1, 2], [3, 4]) // returns [[1, 3], [1, 4], [2, 3], [2, 4]]
|
|
40
|
-
math.setCartesian([4, 3], [2, 1]) // returns [[3, 1], [3, 2], [4, 1], [4, 2]]
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## See also
|
|
45
|
-
|
|
46
|
-
[setUnion](setUnion.md),
|
|
47
|
-
[setIntersect](setIntersect.md),
|
|
48
|
-
[setDifference](setDifference.md),
|
|
49
|
-
[setPowerset](setPowerset.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 setDifference
|
|
4
|
-
|
|
5
|
-
Create the difference of two (multi)sets: every element of set1, that is not the element of set2.
|
|
6
|
-
Multi-dimension arrays will be converted to single-dimension arrays before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setDifference(set1, set2)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`a1` | Array | Matrix | A (multi)set
|
|
20
|
-
`a2` | Array | Matrix | A (multi)set
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
Array | Matrix | The difference of two (multi)sets
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.setDifference([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2]
|
|
39
|
-
math.setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[setUnion](setUnion.md),
|
|
46
|
-
[setIntersect](setIntersect.md),
|
|
47
|
-
[setSymDifference](setSymDifference.md)
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function setDistinct
|
|
4
|
-
|
|
5
|
-
Collect the distinct elements of a multiset.
|
|
6
|
-
A multi-dimension array will be converted to a single-dimension array before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setDistinct(set)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`a` | Array | Matrix | A multiset
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
Array | Matrix | A set containing the distinc elements of the multiset
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.setDistinct([1, 1, 1, 2, 2, 3]) // returns [1, 2, 3]
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## See also
|
|
42
|
-
|
|
43
|
-
[setMultiplicity](setMultiplicity.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 setIntersect
|
|
4
|
-
|
|
5
|
-
Create the intersection of two (multi)sets.
|
|
6
|
-
Multi-dimension arrays will be converted to single-dimension arrays before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setIntersect(set1, set2)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`a1` | Array | Matrix | A (multi)set
|
|
20
|
-
`a2` | Array | Matrix | A (multi)set
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
Array | Matrix | The intersection of two (multi)sets
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.setIntersect([1, 2, 3, 4], [3, 4, 5, 6]) // returns [3, 4]
|
|
39
|
-
math.setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [3, 4]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[setUnion](setUnion.md),
|
|
46
|
-
[setDifference](setDifference.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 setIsSubset
|
|
4
|
-
|
|
5
|
-
Check whether a (multi)set is a subset of another (multi)set. (Every element of set1 is the element of set2.)
|
|
6
|
-
Multi-dimension arrays will be converted to single-dimension arrays before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setIsSubset(set1, set2)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`a1` | Array | Matrix | A (multi)set
|
|
20
|
-
`a2` | Array | Matrix | A (multi)set
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
boolean | true | false
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.setIsSubset([1, 2], [3, 4, 5, 6]) // returns false
|
|
39
|
-
math.setIsSubset([3, 4], [3, 4, 5, 6]) // returns true
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[setUnion](setUnion.md),
|
|
46
|
-
[setIntersect](setIntersect.md),
|
|
47
|
-
[setDifference](setDifference.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 setMultiplicity
|
|
4
|
-
|
|
5
|
-
Count the multiplicity of an element in a multiset.
|
|
6
|
-
A multi-dimension array will be converted to a single-dimension array before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setMultiplicity(element, set)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`e` | number | BigNumber | Fraction | Complex | An element in the multiset
|
|
20
|
-
`a` | Array | Matrix | A multiset
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
number | The number of how many times the multiset contains the element
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.setMultiplicity(1, [1, 2, 2, 4]) // returns 1
|
|
39
|
-
math.setMultiplicity(2, [1, 2, 2, 4]) // returns 2
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[setDistinct](setDistinct.md),
|
|
46
|
-
[setSize](setSize.md)
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function setPowerset
|
|
4
|
-
|
|
5
|
-
Create the powerset of a (multi)set. (The powerset contains very possible subsets of a (multi)set.)
|
|
6
|
-
A multi-dimension array will be converted to a single-dimension array before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setPowerset(set)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`a` | Array | Matrix | A (multi)set
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
Array | The powerset of the (multi)set
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.setPowerset([1, 2, 3]) // returns [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## See also
|
|
42
|
-
|
|
43
|
-
[setCartesian](setCartesian.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 setSize
|
|
4
|
-
|
|
5
|
-
Count the number of elements of a (multi)set. When a second parameter is 'true', count only the unique values.
|
|
6
|
-
A multi-dimension array will be converted to a single-dimension array before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setSize(set)
|
|
13
|
-
math.setSize(set, unique)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`a` | Array | Matrix | A multiset
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
number | The number of elements of the (multi)set
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.setSize([1, 2, 2, 4]) // returns 4
|
|
39
|
-
math.setSize([1, 2, 2, 4], true) // returns 3
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[setUnion](setUnion.md),
|
|
46
|
-
[setIntersect](setIntersect.md),
|
|
47
|
-
[setDifference](setDifference.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 setSymDifference
|
|
4
|
-
|
|
5
|
-
Create the symmetric difference of two (multi)sets.
|
|
6
|
-
Multi-dimension arrays will be converted to single-dimension arrays before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setSymDifference(set1, set2)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`a1` | Array | Matrix | A (multi)set
|
|
20
|
-
`a2` | Array | Matrix | A (multi)set
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
Array | Matrix | The symmetric difference of two (multi)sets
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.setSymDifference([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2, 5, 6]
|
|
39
|
-
math.setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2, 5, 6]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[setUnion](setUnion.md),
|
|
46
|
-
[setIntersect](setIntersect.md),
|
|
47
|
-
[setDifference](setDifference.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 setUnion
|
|
4
|
-
|
|
5
|
-
Create the union of two (multi)sets.
|
|
6
|
-
Multi-dimension arrays will be converted to single-dimension arrays before the operation.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.setUnion(set1, set2)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`a1` | Array | Matrix | A (multi)set
|
|
20
|
-
`a2` | Array | Matrix | A (multi)set
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
Array | Matrix | The union of two (multi)sets
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.setUnion([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2, 3, 4, 5, 6]
|
|
39
|
-
math.setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2, 3, 4, 5, 6]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[setIntersect](setIntersect.md),
|
|
46
|
-
[setDifference](setDifference.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 sign
|
|
4
|
-
|
|
5
|
-
Compute the sign of a value. The sign of a value x is:
|
|
6
|
-
|
|
7
|
-
- 1 when x > 0
|
|
8
|
-
- -1 when x < 0
|
|
9
|
-
- 0 when x == 0
|
|
10
|
-
|
|
11
|
-
For matrices, the function is evaluated element wise.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Syntax
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
math.sign(x)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Parameters
|
|
21
|
-
|
|
22
|
-
Parameter | Type | Description
|
|
23
|
-
--------- | ---- | -----------
|
|
24
|
-
`x` | number | BigNumber | Fraction | Complex | Array | Matrix | Unit | The number for which to determine the sign
|
|
25
|
-
|
|
26
|
-
### Returns
|
|
27
|
-
|
|
28
|
-
Type | Description
|
|
29
|
-
---- | -----------
|
|
30
|
-
number | BigNumber | Fraction | Complex | Array | Matrix | Unit | e The sign of `x`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Throws
|
|
34
|
-
|
|
35
|
-
Type | Description
|
|
36
|
-
---- | -----------
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Examples
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
math.sign(3.5) // returns 1
|
|
43
|
-
math.sign(-4.2) // returns -1
|
|
44
|
-
math.sign(0) // returns 0
|
|
45
|
-
|
|
46
|
-
math.sign([3, 5, -2, 0, 2]) // returns [1, 1, -1, 0, 1]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## See also
|
|
51
|
-
|
|
52
|
-
[abs](abs.md)
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function simplify
|
|
4
|
-
|
|
5
|
-
Simplify an expression tree.
|
|
6
|
-
|
|
7
|
-
A list of rules are applied to an expression, repeating over the list until
|
|
8
|
-
no further changes are made.
|
|
9
|
-
It's possible to pass a custom set of rules to the function as second
|
|
10
|
-
argument. A rule can be specified as an object, string, or function:
|
|
11
|
-
|
|
12
|
-
const rules = [
|
|
13
|
-
{ l: 'n1*n3 + n2*n3', r: '(n1+n2)*n3' },
|
|
14
|
-
'n1*n3 + n2*n3 -> (n1+n2)*n3',
|
|
15
|
-
function (node) {
|
|
16
|
-
// ... return a new node or return the node unchanged
|
|
17
|
-
return node
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
String and object rules consist of a left and right pattern. The left is
|
|
22
|
-
used to match against the expression and the right determines what matches
|
|
23
|
-
are replaced with. The main difference between a pattern and a normal
|
|
24
|
-
expression is that variables starting with the following characters are
|
|
25
|
-
interpreted as wildcards:
|
|
26
|
-
|
|
27
|
-
- 'n' - matches any Node
|
|
28
|
-
- 'c' - matches any ConstantNode
|
|
29
|
-
- 'v' - matches any Node that is not a ConstantNode
|
|
30
|
-
|
|
31
|
-
The default list of rules is exposed on the function as `simplify.rules`
|
|
32
|
-
and can be used as a basis to built a set of custom rules.
|
|
33
|
-
|
|
34
|
-
To specify a rule as a string, separate the left and right pattern by '->'
|
|
35
|
-
When specifying a rule as an object, the following keys are meaningful:
|
|
36
|
-
- l - the left pattern
|
|
37
|
-
- r - the right pattern
|
|
38
|
-
- s - in lieu of l and r, the string form that is broken at -> to give them
|
|
39
|
-
- repeat - whether to repeat this rule until the expression stabilizes
|
|
40
|
-
- assuming - gives a context object, as in the 'context' option to
|
|
41
|
-
simplify. Every property in the context object must match the current
|
|
42
|
-
context in order, or else the rule will not be applied.
|
|
43
|
-
- imposeContext - gives a context object, as in the 'context' option to
|
|
44
|
-
simplify. Any settings specified will override the incoming context
|
|
45
|
-
for all matches of this rule.
|
|
46
|
-
|
|
47
|
-
For more details on the theory, see:
|
|
48
|
-
|
|
49
|
-
- [Strategies for simplifying math expressions (Stackoverflow)](https://stackoverflow.com/questions/7540227/strategies-for-simplifying-math-expressions)
|
|
50
|
-
- [Symbolic computation - Simplification (Wikipedia)](https://en.wikipedia.org/wiki/Symbolic_computation#Simplification)
|
|
51
|
-
|
|
52
|
-
An optional `options` argument can be passed as last argument of `simplify`.
|
|
53
|
-
Currently available options (defaults in parentheses):
|
|
54
|
-
- `consoleDebug` (false): whether to write the expression being simplified
|
|
55
|
-
and any changes to it, along with the rule responsible, to console
|
|
56
|
-
- `context` (simplify.defaultContext): an object giving properties of
|
|
57
|
-
each operator, which determine what simplifications are allowed. The
|
|
58
|
-
currently meaningful properties are commutative, associative,
|
|
59
|
-
total (whether the operation is defined for all arguments), and
|
|
60
|
-
trivial (whether the operation applied to a single argument leaves
|
|
61
|
-
that argument unchanged). The default context is very permissive and
|
|
62
|
-
allows almost all simplifications. Only properties differing from
|
|
63
|
-
the default need to be specified; the default context is used as a
|
|
64
|
-
fallback. Additional contexts `simplify.realContext` and
|
|
65
|
-
`simplify.positiveContext` are supplied to cause simplify to perform
|
|
66
|
-
just simplifications guaranteed to preserve all values of the expression
|
|
67
|
-
assuming all variables and subexpressions are real numbers or
|
|
68
|
-
positive real numbers, respectively. (Note that these are in some cases
|
|
69
|
-
more restrictive than the default context; for example, the default
|
|
70
|
-
context will allow `x/x` to simplify to 1, whereas
|
|
71
|
-
`simplify.realContext` will not, as `0/0` is not equal to 1.)
|
|
72
|
-
- `exactFractions` (true): whether to try to convert all constants to
|
|
73
|
-
exact rational numbers.
|
|
74
|
-
- `fractionsLimit` (10000): when `exactFractions` is true, constants will
|
|
75
|
-
be expressed as fractions only when both numerator and denominator
|
|
76
|
-
are smaller than `fractionsLimit`.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## Syntax
|
|
80
|
-
|
|
81
|
-
```js
|
|
82
|
-
simplify(expr)
|
|
83
|
-
simplify(expr, rules)
|
|
84
|
-
simplify(expr, rules)
|
|
85
|
-
simplify(expr, rules, scope)
|
|
86
|
-
simplify(expr, rules, scope, options)
|
|
87
|
-
simplify(expr, scope)
|
|
88
|
-
simplify(expr, scope, options)
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Parameters
|
|
92
|
-
|
|
93
|
-
Parameter | Type | Description
|
|
94
|
-
--------- | ---- | -----------
|
|
95
|
-
`expr` | Node | string | The expression to be simplified
|
|
96
|
-
`rules` | Array<{l:string, r: string} | string | function> | Optional list with custom rules
|
|
97
|
-
|
|
98
|
-
### Returns
|
|
99
|
-
|
|
100
|
-
Type | Description
|
|
101
|
-
---- | -----------
|
|
102
|
-
Node | Returns the simplified form of `expr`
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### Throws
|
|
106
|
-
|
|
107
|
-
Type | Description
|
|
108
|
-
---- | -----------
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
## Examples
|
|
112
|
-
|
|
113
|
-
```js
|
|
114
|
-
math.simplify('2 * 1 * x ^ (2 - 1)') // Node "2 * x"
|
|
115
|
-
math.simplify('2 * 3 * x', {x: 4}) // Node "24"
|
|
116
|
-
const f = math.parse('2 * 1 * x ^ (2 - 1)')
|
|
117
|
-
math.simplify(f) // Node "2 * x"
|
|
118
|
-
math.simplify('0.4 * x', {}, {exactFractions: true}) // Node "x * 2 / 5"
|
|
119
|
-
math.simplify('0.4 * x', {}, {exactFractions: false}) // Node "0.4 * x"
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
## See also
|
|
124
|
-
|
|
125
|
-
[simplifyCore](simplifyCore.md),
|
|
126
|
-
[derivative](derivative.md),
|
|
127
|
-
[evaluate](evaluate.md),
|
|
128
|
-
[parse](parse.md),
|
|
129
|
-
[rationalize](rationalize.md),
|
|
130
|
-
[resolve](resolve.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 simplifyConstant
|
|
4
|
-
|
|
5
|
-
simplifyConstant() takes a mathjs expression (either a Node representing
|
|
6
|
-
a parse tree or a string which it parses to produce a node), and replaces
|
|
7
|
-
any subexpression of it consisting entirely of constants with the computed
|
|
8
|
-
value of that subexpression.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
simplifyConstant(expr)
|
|
15
|
-
simplifyConstant(expr, options)
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Parameters
|
|
19
|
-
|
|
20
|
-
Parameter | Type | Description
|
|
21
|
-
--------- | ---- | -----------
|
|
22
|
-
`node` | Node | string | The expression to be simplified
|
|
23
|
-
`options` | Object | Simplification options, as per simplify()
|
|
24
|
-
|
|
25
|
-
### Returns
|
|
26
|
-
|
|
27
|
-
Type | Description
|
|
28
|
-
---- | -----------
|
|
29
|
-
Node | Returns expression with constant subexpressions evaluated
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Throws
|
|
33
|
-
|
|
34
|
-
Type | Description
|
|
35
|
-
---- | -----------
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Examples
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
math.simplifyConstant('x + 4*3/6') // Node "x + 2"
|
|
42
|
-
math.simplifyConstant('z cos(0)') // Node "z 1"
|
|
43
|
-
math.simplifyConstant('(5.2 + 1.08)t', {exactFractions: false}) // Node "6.28 t"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## See also
|
|
48
|
-
|
|
49
|
-
[simplify](simplify.md),
|
|
50
|
-
[simplifyCore](simplifyCore.md),
|
|
51
|
-
[resolve](resolve.md),
|
|
52
|
-
[derivative](derivative.md)
|