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,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 count
|
|
4
|
-
|
|
5
|
-
Count the number of elements of a matrix, array or string.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.count(x)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`x` | string | Array | Matrix | A matrix or string
|
|
19
|
-
|
|
20
|
-
### Returns
|
|
21
|
-
|
|
22
|
-
Type | Description
|
|
23
|
-
---- | -----------
|
|
24
|
-
number | An integer with the elements in `x`.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Throws
|
|
28
|
-
|
|
29
|
-
Type | Description
|
|
30
|
-
---- | -----------
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## Examples
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
math.count('hello world') // returns 11
|
|
37
|
-
const A = [[1, 2, 3], [4, 5, 6]]
|
|
38
|
-
math.count(A) // returns 6
|
|
39
|
-
math.count(math.range(1,6)) // returns 5
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[size](size.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 createUnit
|
|
4
|
-
|
|
5
|
-
Create a user-defined unit and register it with the Unit type.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.createUnit({
|
|
12
|
-
baseUnit1: {
|
|
13
|
-
aliases: [string, ...]
|
|
14
|
-
prefixes: object
|
|
15
|
-
},
|
|
16
|
-
unit2: {
|
|
17
|
-
definition: string,
|
|
18
|
-
aliases: [string, ...]
|
|
19
|
-
prefixes: object,
|
|
20
|
-
offset: number
|
|
21
|
-
},
|
|
22
|
-
unit3: string // Shortcut
|
|
23
|
-
})
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Parameters
|
|
27
|
-
|
|
28
|
-
Parameter | Type | Description
|
|
29
|
-
--------- | ---- | -----------
|
|
30
|
-
`name` | string | The name of the new unit. Must be unique. Example: 'knot'
|
|
31
|
-
`definition` | string, Unit | Definition of the unit in terms of existing units. For example, '0.514444444 m / s'.
|
|
32
|
-
`options` | Object | (optional) An object containing any of the following properties:</br>- `prefixes {string}` "none", "short", "long", "binary_short", or "binary_long". The default is "none".</br>- `aliases {Array}` Array of strings. Example: ['knots', 'kt', 'kts']</br>- `offset {Numeric}` An offset to apply when converting from the unit. For example, the offset for celsius is 273.15. Default is 0.
|
|
33
|
-
|
|
34
|
-
### Returns
|
|
35
|
-
|
|
36
|
-
Type | Description
|
|
37
|
-
---- | -----------
|
|
38
|
-
Unit | The new unit
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Examples
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
math.createUnit('foo')
|
|
45
|
-
math.createUnit('knot', {definition: '0.514444444 m/s', aliases: ['knots', 'kt', 'kts']})
|
|
46
|
-
math.createUnit('mph', '1 mile/hour')
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## See also
|
|
51
|
-
|
|
52
|
-
[unit](unit.md)
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function cross
|
|
4
|
-
|
|
5
|
-
Calculate the cross product for two vectors in three dimensional space.
|
|
6
|
-
The cross product of `A = [a1, a2, a3]` and `B = [b1, b2, b3]` is defined
|
|
7
|
-
as:
|
|
8
|
-
|
|
9
|
-
cross(A, B) = [
|
|
10
|
-
a2 * b3 - a3 * b2,
|
|
11
|
-
a3 * b1 - a1 * b3,
|
|
12
|
-
a1 * b2 - a2 * b1
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
If one of the input vectors has a dimension greater than 1, the output
|
|
16
|
-
vector will be a 1x3 (2-dimensional) matrix.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Syntax
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
math.cross(x, y)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Parameters
|
|
26
|
-
|
|
27
|
-
Parameter | Type | Description
|
|
28
|
-
--------- | ---- | -----------
|
|
29
|
-
`x` | Array | Matrix | First vector
|
|
30
|
-
`y` | Array | Matrix | Second vector
|
|
31
|
-
|
|
32
|
-
### Returns
|
|
33
|
-
|
|
34
|
-
Type | Description
|
|
35
|
-
---- | -----------
|
|
36
|
-
Array | Matrix | Returns the cross product of `x` and `y`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Throws
|
|
40
|
-
|
|
41
|
-
Type | Description
|
|
42
|
-
---- | -----------
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## Examples
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
math.cross([1, 1, 0], [0, 1, 1]) // Returns [1, -1, 1]
|
|
49
|
-
math.cross([3, -3, 1], [4, 9, 2]) // Returns [-15, -2, 39]
|
|
50
|
-
math.cross([2, 3, 4], [5, 6, 7]) // Returns [-3, 6, -3]
|
|
51
|
-
math.cross([[1, 2, 3]], [[4], [5], [6]]) // Returns [[-3, 6, -3]]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## See also
|
|
56
|
-
|
|
57
|
-
[dot](dot.md),
|
|
58
|
-
[multiply](multiply.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 csc
|
|
4
|
-
|
|
5
|
-
Calculate the cosecant of a value, defined as `csc(x) = 1/sin(x)`.
|
|
6
|
-
|
|
7
|
-
For matrices, the function is evaluated element wise.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.csc(x)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | number | Complex | Unit | Array | Matrix | Function input
|
|
21
|
-
|
|
22
|
-
### Returns
|
|
23
|
-
|
|
24
|
-
Type | Description
|
|
25
|
-
---- | -----------
|
|
26
|
-
number | Complex | Array | Matrix | Cosecant of x
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.csc(2) // returns number 1.099750170294617
|
|
39
|
-
1 / math.sin(2) // returns number 1.099750170294617
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[sin](sin.md),
|
|
46
|
-
[sec](sec.md),
|
|
47
|
-
[cot](cot.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 csch
|
|
4
|
-
|
|
5
|
-
Calculate the hyperbolic cosecant of a value,
|
|
6
|
-
defined as `csch(x) = 1 / sinh(x)`.
|
|
7
|
-
|
|
8
|
-
For matrices, the function is evaluated element wise.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.csch(x)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`x` | number | Complex | Unit | Array | Matrix | Function input
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | Complex | Array | Matrix | Hyperbolic cosecant of x
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
// csch(x) = 1/ sinh(x)
|
|
40
|
-
math.csch(0.5) // returns 1.9190347513349437
|
|
41
|
-
1 / math.sinh(0.5) // returns 1.9190347513349437
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[sinh](sinh.md),
|
|
48
|
-
[sech](sech.md),
|
|
49
|
-
[coth](coth.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 ctranspose
|
|
4
|
-
|
|
5
|
-
Transpose and complex conjugate a matrix. All values of the matrix are
|
|
6
|
-
reflected over its main diagonal and then the complex conjugate is
|
|
7
|
-
taken. This is equivalent to complex conjugation for scalars and
|
|
8
|
-
vectors.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.ctranspose(x)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`x` | Array | Matrix | Matrix to be ctransposed
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
Array | Matrix | The ctransposed matrix
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const A = [[1, 2, 3], [4, 5, math.complex(6,7)]]
|
|
40
|
-
math.ctranspose(A) // returns [[1, 4], [2, 5], [3, {re:6,im:7}]]
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## See also
|
|
45
|
-
|
|
46
|
-
[transpose](transpose.md),
|
|
47
|
-
[diag](diag.md),
|
|
48
|
-
[inv](inv.md),
|
|
49
|
-
[subset](subset.md),
|
|
50
|
-
[squeeze](squeeze.md)
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function cube
|
|
4
|
-
|
|
5
|
-
Compute the cube of a value, `x * x * x`.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.cube(x)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`x` | number | BigNumber | Fraction | Complex | Array | Matrix | Unit | Number for which to calculate the cube
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
number | BigNumber | Fraction | Complex | Array | Matrix | Unit | Cube of x
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.cube(2) // returns number 8
|
|
38
|
-
math.pow(2, 3) // returns number 8
|
|
39
|
-
math.cube(4) // returns number 64
|
|
40
|
-
4 * 4 * 4 // returns number 64
|
|
41
|
-
|
|
42
|
-
math.cube([1, 2, 3, 4]) // returns Array [1, 8, 27, 64]
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## See also
|
|
47
|
-
|
|
48
|
-
[multiply](multiply.md),
|
|
49
|
-
[square](square.md),
|
|
50
|
-
[pow](pow.md),
|
|
51
|
-
[cbrt](cbrt.md)
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function cumsum
|
|
4
|
-
|
|
5
|
-
Compute the cumulative sum of a matrix or a list with values.
|
|
6
|
-
In case of a (multi dimensional) array or matrix, the cumulative sums
|
|
7
|
-
along a specified dimension (defaulting to the first) will be calculated.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.cumsum(a, b, c, ...)
|
|
14
|
-
math.cumsum(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 cumulative sum of all values
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.cumsum(2, 1, 4, 3) // returns [2, 3, 7, 10]
|
|
40
|
-
math.cumsum([2, 1, 4, 3]) // returns [2, 3, 7, 10]
|
|
41
|
-
math.cumsum([[1, 2], [3, 4]]) // returns [[1, 2], [4, 6]]
|
|
42
|
-
math.cumsum([[1, 2], [3, 4]], 0) // returns [[1, 2], [4, 6]]
|
|
43
|
-
math.cumsum([[1, 2], [3, 4]], 1) // returns [[1, 3], [3, 7]]
|
|
44
|
-
math.cumsum([[2, 5], [4, 3], [1, 7]]) // returns [[2, 5], [6, 8], [7, 15]]
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## See also
|
|
49
|
-
|
|
50
|
-
[mean](mean.md),
|
|
51
|
-
[median](median.md),
|
|
52
|
-
[min](min.md),
|
|
53
|
-
[max](max.md),
|
|
54
|
-
[prod](prod.md),
|
|
55
|
-
[std](std.md),
|
|
56
|
-
[variance](variance.md),
|
|
57
|
-
[sum](sum.md)
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function deepEqual
|
|
4
|
-
|
|
5
|
-
Test element wise whether two matrices are equal.
|
|
6
|
-
The function accepts both matrices and scalar values.
|
|
7
|
-
|
|
8
|
-
Strings are compared by their numerical value.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.deepEqual(x, y)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | First matrix to compare
|
|
22
|
-
`y` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Second matrix to compare
|
|
23
|
-
|
|
24
|
-
### Returns
|
|
25
|
-
|
|
26
|
-
Type | Description
|
|
27
|
-
---- | -----------
|
|
28
|
-
number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Returns true when the input matrices have the same size and each of their elements is equal.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### Throws
|
|
32
|
-
|
|
33
|
-
Type | Description
|
|
34
|
-
---- | -----------
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Examples
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
math.deepEqual(2, 4) // returns false
|
|
41
|
-
|
|
42
|
-
a = [2, 5, 1]
|
|
43
|
-
b = [2, 7, 1]
|
|
44
|
-
|
|
45
|
-
math.deepEqual(a, b) // returns false
|
|
46
|
-
math.equal(a, b) // returns [true, false, true]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## See also
|
|
51
|
-
|
|
52
|
-
[equal](equal.md),
|
|
53
|
-
[unequal](unequal.md)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function derivative
|
|
4
|
-
|
|
5
|
-
Takes the derivative of an expression expressed in parser Nodes.
|
|
6
|
-
The derivative will be taken over the supplied variable in the
|
|
7
|
-
second parameter. If there are multiple variables in the expression,
|
|
8
|
-
it will return a partial derivative.
|
|
9
|
-
|
|
10
|
-
This uses rules of differentiation which can be found here:
|
|
11
|
-
|
|
12
|
-
- [Differentiation rules (Wikipedia)](https://en.wikipedia.org/wiki/Differentiation_rules)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Syntax
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
derivative(expr, variable)
|
|
19
|
-
derivative(expr, variable, options)
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Parameters
|
|
23
|
-
|
|
24
|
-
Parameter | Type | Description
|
|
25
|
-
--------- | ---- | -----------
|
|
26
|
-
`expr` | Node | string | The expression to differentiate
|
|
27
|
-
`variable` | SymbolNode | string | The variable over which to differentiate
|
|
28
|
-
`options` | {simplify: boolean} | There is one option available, `simplify`, which is true by default. When false, output will not be simplified.
|
|
29
|
-
|
|
30
|
-
### Returns
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode | The derivative of `expr`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Throws
|
|
38
|
-
|
|
39
|
-
Type | Description
|
|
40
|
-
---- | -----------
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Examples
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
math.derivative('x^2', 'x') // Node {2 * x}
|
|
47
|
-
math.derivative('x^2', 'x', {simplify: false}) // Node {2 * 1 * x ^ (2 - 1)
|
|
48
|
-
math.derivative('sin(2x)', 'x')) // Node {2 * cos(2 * x)}
|
|
49
|
-
math.derivative('2*x', 'x').evaluate() // number 2
|
|
50
|
-
math.derivative('x^2', 'x').evaluate({x: 4}) // number 8
|
|
51
|
-
const f = math.parse('x^2')
|
|
52
|
-
const x = math.parse('x')
|
|
53
|
-
math.derivative(f, x) // Node {2 * x}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## See also
|
|
58
|
-
|
|
59
|
-
[simplify](simplify.md),
|
|
60
|
-
[parse](parse.md),
|
|
61
|
-
[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 det
|
|
4
|
-
|
|
5
|
-
Calculate the determinant of a matrix.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.det(x)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`x` | Array | Matrix | A matrix
|
|
19
|
-
|
|
20
|
-
### Returns
|
|
21
|
-
|
|
22
|
-
Type | Description
|
|
23
|
-
---- | -----------
|
|
24
|
-
number | The determinant of `x`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Throws
|
|
28
|
-
|
|
29
|
-
Type | Description
|
|
30
|
-
---- | -----------
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## Examples
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
math.det([[1, 2], [3, 4]]) // returns -2
|
|
37
|
-
|
|
38
|
-
const A = [
|
|
39
|
-
[-2, 2, 3],
|
|
40
|
-
[-1, 1, 3],
|
|
41
|
-
[2, 0, -1]
|
|
42
|
-
]
|
|
43
|
-
math.det(A) // returns 6
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## See also
|
|
48
|
-
|
|
49
|
-
[inv](inv.md)
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function diag
|
|
4
|
-
|
|
5
|
-
Create a diagonal matrix or retrieve the diagonal of a matrix
|
|
6
|
-
|
|
7
|
-
When `x` is a vector, a matrix with vector `x` on the diagonal will be returned.
|
|
8
|
-
When `x` is a two dimensional matrix, the matrixes `k`th diagonal will be returned as vector.
|
|
9
|
-
When k is positive, the values are placed on the super diagonal.
|
|
10
|
-
When k is negative, the values are placed on the sub diagonal.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Syntax
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
math.diag(X)
|
|
17
|
-
math.diag(X, format)
|
|
18
|
-
math.diag(X, k)
|
|
19
|
-
math.diag(X, k, format)
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Parameters
|
|
23
|
-
|
|
24
|
-
Parameter | Type | Description
|
|
25
|
-
--------- | ---- | -----------
|
|
26
|
-
`x` | Matrix | Array | A two dimensional matrix or a vector
|
|
27
|
-
`k` | number | BigNumber | The diagonal where the vector will be filled in or retrieved. Default value: 0.
|
|
28
|
-
`format` | string | The matrix storage format. Default value: 'dense'.
|
|
29
|
-
|
|
30
|
-
### Returns
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
Matrix | Array | Diagonal matrix from input vector, or diagonal from input matrix.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Throws
|
|
38
|
-
|
|
39
|
-
Type | Description
|
|
40
|
-
---- | -----------
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Examples
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
// create a diagonal matrix
|
|
47
|
-
math.diag([1, 2, 3]) // returns [[1, 0, 0], [0, 2, 0], [0, 0, 3]]
|
|
48
|
-
math.diag([1, 2, 3], 1) // returns [[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 3]]
|
|
49
|
-
math.diag([1, 2, 3], -1) // returns [[0, 0, 0], [1, 0, 0], [0, 2, 0], [0, 0, 3]]
|
|
50
|
-
|
|
51
|
-
// retrieve the diagonal from a matrix
|
|
52
|
-
const a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
53
|
-
math.diag(a) // returns [1, 5, 9]
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## See also
|
|
58
|
-
|
|
59
|
-
[ones](ones.md),
|
|
60
|
-
[zeros](zeros.md),
|
|
61
|
-
[identity](identity.md)
|