mathjs 10.5.2 → 10.5.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,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 map
|
4
|
-
|
5
|
-
Create a new matrix or array with the results of a callback function executed on
|
6
|
-
each entry of a given matrix/array.
|
7
|
-
|
8
|
-
For each entry of the input, the callback is invoked with three arguments:
|
9
|
-
the value of the entry, the index at which that entry occurs, and the full
|
10
|
-
matrix/array being traversed. Note that because the matrix/array might be
|
11
|
-
multidimensional, the "index" argument is always an array of numbers giving
|
12
|
-
the index in each dimension. This is true even for vectors: the "index"
|
13
|
-
argument is an array of length 1, rather than simply a number.
|
14
|
-
|
15
|
-
|
16
|
-
## Syntax
|
17
|
-
|
18
|
-
```js
|
19
|
-
math.map(x, callback)
|
20
|
-
```
|
21
|
-
|
22
|
-
### Parameters
|
23
|
-
|
24
|
-
Parameter | Type | Description
|
25
|
-
--------- | ---- | -----------
|
26
|
-
`x` | Matrix | Array | The input to iterate on.
|
27
|
-
`callback` | Function | The function to call (as described above) on each entry of the input
|
28
|
-
|
29
|
-
### Returns
|
30
|
-
|
31
|
-
Type | Description
|
32
|
-
---- | -----------
|
33
|
-
Matrix | array | Transformed map of x; always has the same type and shape as x
|
34
|
-
|
35
|
-
|
36
|
-
### Throws
|
37
|
-
|
38
|
-
Type | Description
|
39
|
-
---- | -----------
|
40
|
-
|
41
|
-
|
42
|
-
## Examples
|
43
|
-
|
44
|
-
```js
|
45
|
-
math.map([1, 2, 3], function(value) {
|
46
|
-
return value * value
|
47
|
-
}) // returns [1, 4, 9]
|
48
|
-
|
49
|
-
// The calling convention for the callback can cause subtleties:
|
50
|
-
math.map([1, 2, 3], math.format)
|
51
|
-
// throws TypeError: map attempted to call 'format(1,[0])' but argument 2 of type Array does not match expected type number or function or Object or string or boolean
|
52
|
-
// [This happens because `format` _can_ take a second argument,
|
53
|
-
// but its semantics don't match that of the 2nd argument `map` provides]
|
54
|
-
|
55
|
-
// To avoid this error, use a function that takes exactly the
|
56
|
-
// desired arguments:
|
57
|
-
math.map([1, 2, 3], x => math.format(x)) // returns ['1', '2', '3']
|
58
|
-
```
|
59
|
-
|
60
|
-
|
61
|
-
## See also
|
62
|
-
|
63
|
-
[filter](filter.md),
|
64
|
-
[forEach](forEach.md),
|
65
|
-
[sort](sort.md)
|
@@ -1,56 +0,0 @@
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
-
|
3
|
-
# Function matrix
|
4
|
-
|
5
|
-
Create a Matrix. The function creates a new `math.Matrix` object from
|
6
|
-
an `Array`. A Matrix has utility functions to manipulate the data in the
|
7
|
-
matrix, like getting the size and getting or setting values in the matrix.
|
8
|
-
Supported storage formats are 'dense' and 'sparse'.
|
9
|
-
|
10
|
-
|
11
|
-
## Syntax
|
12
|
-
|
13
|
-
```js
|
14
|
-
math.matrix() // creates an empty matrix using default storage format (dense).
|
15
|
-
math.matrix(data) // creates a matrix with initial data using default storage format (dense).
|
16
|
-
math.matrix('dense') // creates an empty matrix using the given storage format.
|
17
|
-
math.matrix(data, 'dense') // creates a matrix with initial data using the given storage format.
|
18
|
-
math.matrix(data, 'sparse') // creates a sparse matrix with initial data.
|
19
|
-
math.matrix(data, 'sparse', 'number') // creates a sparse matrix with initial data, number data type.
|
20
|
-
```
|
21
|
-
|
22
|
-
### Parameters
|
23
|
-
|
24
|
-
Parameter | Type | Description
|
25
|
-
--------- | ---- | -----------
|
26
|
-
`data` | Array | Matrix | A multi dimensional array
|
27
|
-
`format` | string | The Matrix storage format
|
28
|
-
|
29
|
-
### Returns
|
30
|
-
|
31
|
-
Type | Description
|
32
|
-
---- | -----------
|
33
|
-
Matrix | The created matrix
|
34
|
-
|
35
|
-
|
36
|
-
## Examples
|
37
|
-
|
38
|
-
```js
|
39
|
-
let m = math.matrix([[1, 2], [3, 4]])
|
40
|
-
m.size() // Array [2, 2]
|
41
|
-
m.resize([3, 2], 5)
|
42
|
-
m.valueOf() // Array [[1, 2], [3, 4], [5, 5]]
|
43
|
-
m.get([1, 0]) // number 3
|
44
|
-
```
|
45
|
-
|
46
|
-
|
47
|
-
## See also
|
48
|
-
|
49
|
-
[bignumber](bignumber.md),
|
50
|
-
[boolean](boolean.md),
|
51
|
-
[complex](complex.md),
|
52
|
-
[index](index.md),
|
53
|
-
[number](number.md),
|
54
|
-
[string](string.md),
|
55
|
-
[unit](unit.md),
|
56
|
-
[sparse](sparse.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 matrixFromColumns
|
4
|
-
|
5
|
-
Create a dense matrix from vectors as individual columns.
|
6
|
-
If you pass row vectors, they will be transposed (but not conjugated!)
|
7
|
-
|
8
|
-
|
9
|
-
## Syntax
|
10
|
-
|
11
|
-
```js
|
12
|
-
math.matrixFromColumns(...arr)
|
13
|
-
math.matrixFromColumns(col1, col2)
|
14
|
-
math.matrixFromColumns(col1, col2, col3)
|
15
|
-
```
|
16
|
-
|
17
|
-
### Parameters
|
18
|
-
|
19
|
-
Parameter | Type | Description
|
20
|
-
--------- | ---- | -----------
|
21
|
-
`cols` | ... Array | Matrix | Multiple columns
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
number[][] | Matrix | if at least one of the arguments is an array, an array will be returned
|
28
|
-
|
29
|
-
|
30
|
-
### Throws
|
31
|
-
|
32
|
-
Type | Description
|
33
|
-
---- | -----------
|
34
|
-
|
35
|
-
|
36
|
-
## Examples
|
37
|
-
|
38
|
-
```js
|
39
|
-
math.matrixFromColumns([1, 2, 3], [[4],[5],[6]])
|
40
|
-
math.matrixFromColumns(...vectors)
|
41
|
-
```
|
42
|
-
|
43
|
-
|
44
|
-
## See also
|
45
|
-
|
46
|
-
[matrix](matrix.md),
|
47
|
-
[matrixFromRows](matrixFromRows.md),
|
48
|
-
[matrixFromFunction](matrixFromFunction.md),
|
49
|
-
[zeros](zeros.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 matrixFromFunction
|
4
|
-
|
5
|
-
Create a matrix by evaluating a generating function at each index.
|
6
|
-
The simplest overload returns a multi-dimensional array as long as `size` is an array.
|
7
|
-
Passing `size` as a Matrix or specifying a `format` will result in returning a Matrix.
|
8
|
-
|
9
|
-
|
10
|
-
## Syntax
|
11
|
-
|
12
|
-
```js
|
13
|
-
math.matrixFromFunction(size, fn)
|
14
|
-
math.matrixFromFunction(size, fn, format)
|
15
|
-
math.matrixFromFunction(size, fn, format, datatype)
|
16
|
-
math.matrixFromFunction(size, format, fn)
|
17
|
-
math.matrixFromFunction(size, format, datatype, fn)
|
18
|
-
```
|
19
|
-
|
20
|
-
### Parameters
|
21
|
-
|
22
|
-
Parameter | Type | Description
|
23
|
-
--------- | ---- | -----------
|
24
|
-
`size` | Array | Matrix | The size of the matrix to be created
|
25
|
-
`fn` | function | Callback function invoked for every entry in the matrix
|
26
|
-
`format` | string | The Matrix storage format, either `'dense'` or `'sparse'`
|
27
|
-
`datatype` | string | Type of the values
|
28
|
-
|
29
|
-
### Returns
|
30
|
-
|
31
|
-
Type | Description
|
32
|
-
---- | -----------
|
33
|
-
Array | Matrix | Returns the created matrix
|
34
|
-
|
35
|
-
|
36
|
-
### Throws
|
37
|
-
|
38
|
-
Type | Description
|
39
|
-
---- | -----------
|
40
|
-
|
41
|
-
|
42
|
-
## Examples
|
43
|
-
|
44
|
-
```js
|
45
|
-
math.matrixFromFunction([3,3], i => i[0] - i[1]) // an antisymmetric matrix
|
46
|
-
math.matrixFromFunction([100, 100], 'sparse', i => i[0] - i[1] === 1 ? 4 : 0) // a sparse subdiagonal matrix
|
47
|
-
math.matrixFromFunction([5], i => math.random()) // a random vector
|
48
|
-
```
|
49
|
-
|
50
|
-
|
51
|
-
## See also
|
52
|
-
|
53
|
-
[matrix](matrix.md),
|
54
|
-
[zeros](zeros.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 matrixFromRows
|
4
|
-
|
5
|
-
Create a dense matrix from vectors as individual rows.
|
6
|
-
If you pass column vectors, they will be transposed (but not conjugated!)
|
7
|
-
|
8
|
-
|
9
|
-
## Syntax
|
10
|
-
|
11
|
-
```js
|
12
|
-
math.matrixFromRows(...arr)
|
13
|
-
math.matrixFromRows(row1, row2)
|
14
|
-
math.matrixFromRows(row1, row2, row3)
|
15
|
-
```
|
16
|
-
|
17
|
-
### Parameters
|
18
|
-
|
19
|
-
Parameter | Type | Description
|
20
|
-
--------- | ---- | -----------
|
21
|
-
`rows` | ... Array | Matrix | Multiple rows
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
number[][] | Matrix | if at least one of the arguments is an array, an array will be returned
|
28
|
-
|
29
|
-
|
30
|
-
### Throws
|
31
|
-
|
32
|
-
Type | Description
|
33
|
-
---- | -----------
|
34
|
-
|
35
|
-
|
36
|
-
## Examples
|
37
|
-
|
38
|
-
```js
|
39
|
-
math.matrixFromRows([1, 2, 3], [[4],[5],[6]])
|
40
|
-
math.matrixFromRows(...vectors)
|
41
|
-
```
|
42
|
-
|
43
|
-
|
44
|
-
## See also
|
45
|
-
|
46
|
-
[matrix](matrix.md),
|
47
|
-
[matrixFromColumns](matrixFromColumns.md),
|
48
|
-
[matrixFromFunction](matrixFromFunction.md),
|
49
|
-
[zeros](zeros.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 max
|
4
|
-
|
5
|
-
Compute the maximum value of a matrix or a list with values.
|
6
|
-
In case of a multi dimensional array, the maximum of the flattened array
|
7
|
-
will be calculated. When `dim` is provided, the maximum over the selected
|
8
|
-
dimension will be calculated. Parameter `dim` is zero-based.
|
9
|
-
|
10
|
-
|
11
|
-
## Syntax
|
12
|
-
|
13
|
-
```js
|
14
|
-
math.max(a, b, c, ...)
|
15
|
-
math.max(A)
|
16
|
-
math.max(A, dim)
|
17
|
-
```
|
18
|
-
|
19
|
-
### Parameters
|
20
|
-
|
21
|
-
Parameter | Type | Description
|
22
|
-
--------- | ---- | -----------
|
23
|
-
`args` | ... * | A single matrix or or multiple scalar values
|
24
|
-
|
25
|
-
### Returns
|
26
|
-
|
27
|
-
Type | Description
|
28
|
-
---- | -----------
|
29
|
-
* | The maximum value
|
30
|
-
|
31
|
-
|
32
|
-
### Throws
|
33
|
-
|
34
|
-
Type | Description
|
35
|
-
---- | -----------
|
36
|
-
|
37
|
-
|
38
|
-
## Examples
|
39
|
-
|
40
|
-
```js
|
41
|
-
math.max(2, 1, 4, 3) // returns 4
|
42
|
-
math.max([2, 1, 4, 3]) // returns 4
|
43
|
-
|
44
|
-
// maximum over a specified dimension (zero-based)
|
45
|
-
math.max([[2, 5], [4, 3], [1, 7]], 0) // returns [4, 7]
|
46
|
-
math.max([[2, 5], [4, 3]], [1, 7], 1) // returns [5, 4, 7]
|
47
|
-
|
48
|
-
math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1
|
49
|
-
math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5
|
50
|
-
```
|
51
|
-
|
52
|
-
|
53
|
-
## See also
|
54
|
-
|
55
|
-
[mean](mean.md),
|
56
|
-
[median](median.md),
|
57
|
-
[min](min.md),
|
58
|
-
[prod](prod.md),
|
59
|
-
[std](std.md),
|
60
|
-
[sum](sum.md),
|
61
|
-
[variance](variance.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 mean
|
4
|
-
|
5
|
-
Compute the mean value of matrix or a list with values.
|
6
|
-
In case of a multi dimensional array, the mean of the flattened array
|
7
|
-
will be calculated. When `dim` is provided, the maximum over the selected
|
8
|
-
dimension will be calculated. Parameter `dim` is zero-based.
|
9
|
-
|
10
|
-
|
11
|
-
## Syntax
|
12
|
-
|
13
|
-
```js
|
14
|
-
math.mean(a, b, c, ...)
|
15
|
-
math.mean(A)
|
16
|
-
math.mean(A, dim)
|
17
|
-
```
|
18
|
-
|
19
|
-
### Parameters
|
20
|
-
|
21
|
-
Parameter | Type | Description
|
22
|
-
--------- | ---- | -----------
|
23
|
-
`args` | ... * | A single matrix or or multiple scalar values
|
24
|
-
|
25
|
-
### Returns
|
26
|
-
|
27
|
-
Type | Description
|
28
|
-
---- | -----------
|
29
|
-
* | The mean of all values
|
30
|
-
|
31
|
-
|
32
|
-
### Throws
|
33
|
-
|
34
|
-
Type | Description
|
35
|
-
---- | -----------
|
36
|
-
|
37
|
-
|
38
|
-
## Examples
|
39
|
-
|
40
|
-
```js
|
41
|
-
math.mean(2, 1, 4, 3) // returns 2.5
|
42
|
-
math.mean([1, 2.7, 3.2, 4]) // returns 2.725
|
43
|
-
|
44
|
-
math.mean([[2, 5], [6, 3], [1, 7]], 0) // returns [3, 5]
|
45
|
-
math.mean([[2, 5], [6, 3], [1, 7]], 1) // returns [3.5, 4.5, 4]
|
46
|
-
```
|
47
|
-
|
48
|
-
|
49
|
-
## See also
|
50
|
-
|
51
|
-
[median](median.md),
|
52
|
-
[min](min.md),
|
53
|
-
[max](max.md),
|
54
|
-
[sum](sum.md),
|
55
|
-
[prod](prod.md),
|
56
|
-
[std](std.md),
|
57
|
-
[variance](variance.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 median
|
4
|
-
|
5
|
-
Compute the median of a matrix or a list with values. The values are
|
6
|
-
sorted and the middle value is returned. In case of an even number of
|
7
|
-
values, the average of the two middle values is returned.
|
8
|
-
Supported types of values are: Number, BigNumber, Unit
|
9
|
-
|
10
|
-
In case of a (multi dimensional) array or matrix, the median of all
|
11
|
-
elements will be calculated.
|
12
|
-
|
13
|
-
|
14
|
-
## Syntax
|
15
|
-
|
16
|
-
```js
|
17
|
-
math.median(a, b, c, ...)
|
18
|
-
math.median(A)
|
19
|
-
```
|
20
|
-
|
21
|
-
### Parameters
|
22
|
-
|
23
|
-
Parameter | Type | Description
|
24
|
-
--------- | ---- | -----------
|
25
|
-
`args` | ... * | A single matrix or or multiple scalar values
|
26
|
-
|
27
|
-
### Returns
|
28
|
-
|
29
|
-
Type | Description
|
30
|
-
---- | -----------
|
31
|
-
* | The median
|
32
|
-
|
33
|
-
|
34
|
-
### Throws
|
35
|
-
|
36
|
-
Type | Description
|
37
|
-
---- | -----------
|
38
|
-
|
39
|
-
|
40
|
-
## Examples
|
41
|
-
|
42
|
-
```js
|
43
|
-
math.median(5, 2, 7) // returns 5
|
44
|
-
math.median([3, -1, 5, 7]) // returns 4
|
45
|
-
```
|
46
|
-
|
47
|
-
|
48
|
-
## See also
|
49
|
-
|
50
|
-
[mean](mean.md),
|
51
|
-
[min](min.md),
|
52
|
-
[max](max.md),
|
53
|
-
[sum](sum.md),
|
54
|
-
[prod](prod.md),
|
55
|
-
[std](std.md),
|
56
|
-
[variance](variance.md),
|
57
|
-
[quantileSeq](quantileSeq.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 min
|
4
|
-
|
5
|
-
Compute the minimum value of a matrix or a list of values.
|
6
|
-
In case of a multi dimensional array, the minimum of the flattened array
|
7
|
-
will be calculated. When `dim` is provided, the minimum over the selected
|
8
|
-
dimension will be calculated. Parameter `dim` is zero-based.
|
9
|
-
|
10
|
-
|
11
|
-
## Syntax
|
12
|
-
|
13
|
-
```js
|
14
|
-
math.min(a, b, c, ...)
|
15
|
-
math.min(A)
|
16
|
-
math.min(A, dim)
|
17
|
-
```
|
18
|
-
|
19
|
-
### Parameters
|
20
|
-
|
21
|
-
Parameter | Type | Description
|
22
|
-
--------- | ---- | -----------
|
23
|
-
`args` | ... * | A single matrix or or multiple scalar values
|
24
|
-
|
25
|
-
### Returns
|
26
|
-
|
27
|
-
Type | Description
|
28
|
-
---- | -----------
|
29
|
-
* | The minimum value
|
30
|
-
|
31
|
-
|
32
|
-
### Throws
|
33
|
-
|
34
|
-
Type | Description
|
35
|
-
---- | -----------
|
36
|
-
|
37
|
-
|
38
|
-
## Examples
|
39
|
-
|
40
|
-
```js
|
41
|
-
math.min(2, 1, 4, 3) // returns 1
|
42
|
-
math.min([2, 1, 4, 3]) // returns 1
|
43
|
-
|
44
|
-
// minimum over a specified dimension (zero-based)
|
45
|
-
math.min([[2, 5], [4, 3], [1, 7]], 0) // returns [1, 3]
|
46
|
-
math.min([[2, 5], [4, 3], [1, 7]], 1) // returns [2, 3, 1]
|
47
|
-
|
48
|
-
math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1
|
49
|
-
math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5
|
50
|
-
```
|
51
|
-
|
52
|
-
|
53
|
-
## See also
|
54
|
-
|
55
|
-
[mean](mean.md),
|
56
|
-
[median](median.md),
|
57
|
-
[max](max.md),
|
58
|
-
[prod](prod.md),
|
59
|
-
[std](std.md),
|
60
|
-
[sum](sum.md),
|
61
|
-
[variance](variance.md)
|
@@ -1,59 +0,0 @@
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
-
|
3
|
-
# Function mod
|
4
|
-
|
5
|
-
Calculates the modulus, the remainder of an integer division.
|
6
|
-
|
7
|
-
For matrices, the function is evaluated element wise.
|
8
|
-
|
9
|
-
The modulus is defined as:
|
10
|
-
|
11
|
-
x - y * floor(x / y)
|
12
|
-
|
13
|
-
See https://en.wikipedia.org/wiki/Modulo_operation.
|
14
|
-
|
15
|
-
|
16
|
-
## Syntax
|
17
|
-
|
18
|
-
```js
|
19
|
-
math.mod(x, y)
|
20
|
-
```
|
21
|
-
|
22
|
-
### Parameters
|
23
|
-
|
24
|
-
Parameter | Type | Description
|
25
|
-
--------- | ---- | -----------
|
26
|
-
`x` | number | BigNumber | Fraction | Array | Matrix | Dividend
|
27
|
-
`y` | number | BigNumber | Fraction | Array | Matrix | Divisor
|
28
|
-
|
29
|
-
### Returns
|
30
|
-
|
31
|
-
Type | Description
|
32
|
-
---- | -----------
|
33
|
-
number | BigNumber | Fraction | Array | Matrix | Returns the remainder of `x` divided by `y`.
|
34
|
-
|
35
|
-
|
36
|
-
### Throws
|
37
|
-
|
38
|
-
Type | Description
|
39
|
-
---- | -----------
|
40
|
-
|
41
|
-
|
42
|
-
## Examples
|
43
|
-
|
44
|
-
```js
|
45
|
-
math.mod(8, 3) // returns 2
|
46
|
-
math.mod(11, 2) // returns 1
|
47
|
-
|
48
|
-
function isOdd(x) {
|
49
|
-
return math.mod(x, 2) != 0
|
50
|
-
}
|
51
|
-
|
52
|
-
isOdd(2) // returns false
|
53
|
-
isOdd(3) // returns true
|
54
|
-
```
|
55
|
-
|
56
|
-
|
57
|
-
## See also
|
58
|
-
|
59
|
-
[divide](divide.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 mode
|
4
|
-
|
5
|
-
Computes the mode of a set of numbers or a list with values(numbers or characters).
|
6
|
-
If there are more than one modes, it returns a list of those values.
|
7
|
-
|
8
|
-
|
9
|
-
## Syntax
|
10
|
-
|
11
|
-
```js
|
12
|
-
math.mode(a, b, c, ...)
|
13
|
-
math.mode(A)
|
14
|
-
```
|
15
|
-
|
16
|
-
### Parameters
|
17
|
-
|
18
|
-
Parameter | Type | Description
|
19
|
-
--------- | ---- | -----------
|
20
|
-
`args` | ... * | A single matrix
|
21
|
-
|
22
|
-
### Returns
|
23
|
-
|
24
|
-
Type | Description
|
25
|
-
---- | -----------
|
26
|
-
* | The mode of all values
|
27
|
-
|
28
|
-
|
29
|
-
### Throws
|
30
|
-
|
31
|
-
Type | Description
|
32
|
-
---- | -----------
|
33
|
-
|
34
|
-
|
35
|
-
## Examples
|
36
|
-
|
37
|
-
```js
|
38
|
-
math.mode(2, 1, 4, 3, 1) // returns [1]
|
39
|
-
math.mode([1, 2.7, 3.2, 4, 2.7]) // returns [2.7]
|
40
|
-
math.mode(1, 4, 6, 1, 6) // returns [1, 6]
|
41
|
-
math.mode('a','a','b','c') // returns ["a"]
|
42
|
-
math.mode(1, 1.5, 'abc') // returns [1, 1.5, "abc"]
|
43
|
-
```
|
44
|
-
|
45
|
-
|
46
|
-
## See also
|
47
|
-
|
48
|
-
[median](median.md),
|
49
|
-
[](.md),
|
50
|
-
[mean](mean.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 multinomial
|
4
|
-
|
5
|
-
Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities.
|
6
|
-
|
7
|
-
multinomial takes one array of integers as an argument.
|
8
|
-
The following condition must be enforced: every ai <= 0
|
9
|
-
|
10
|
-
|
11
|
-
## Syntax
|
12
|
-
|
13
|
-
```js
|
14
|
-
math.multinomial(a) // a is an array type
|
15
|
-
```
|
16
|
-
|
17
|
-
### Parameters
|
18
|
-
|
19
|
-
Parameter | Type | Description
|
20
|
-
--------- | ---- | -----------
|
21
|
-
`a` | number[] | BigNumber[] | Integer numbers of objects in the subset
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
Number | BigNumber | Multinomial coefficient.
|
28
|
-
|
29
|
-
|
30
|
-
### Throws
|
31
|
-
|
32
|
-
Type | Description
|
33
|
-
---- | -----------
|
34
|
-
|
35
|
-
|
36
|
-
## Examples
|
37
|
-
|
38
|
-
```js
|
39
|
-
math.multinomial([1,2,1]) // returns 12
|
40
|
-
```
|
41
|
-
|
42
|
-
|
43
|
-
## See also
|
44
|
-
|
45
|
-
[combinations](combinations.md),
|
46
|
-
[factorial](factorial.md)
|