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,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 transpose
|
4
|
-
|
5
|
-
Transpose a matrix. All values of the matrix are reflected over its
|
6
|
-
main diagonal. Only applicable to two dimensional matrices containing
|
7
|
-
a vector (i.e. having size `[1,n]` or `[n,1]`). One dimensional
|
8
|
-
vectors and scalars return the input unchanged.
|
9
|
-
|
10
|
-
|
11
|
-
## Syntax
|
12
|
-
|
13
|
-
```js
|
14
|
-
math.transpose(x)
|
15
|
-
```
|
16
|
-
|
17
|
-
### Parameters
|
18
|
-
|
19
|
-
Parameter | Type | Description
|
20
|
-
--------- | ---- | -----------
|
21
|
-
`x` | Array | Matrix | Matrix to be transposed
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
Array | Matrix | The transposed 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, 6]]
|
40
|
-
math.transpose(A) // returns [[1, 4], [2, 5], [3, 6]]
|
41
|
-
```
|
42
|
-
|
43
|
-
|
44
|
-
## See also
|
45
|
-
|
46
|
-
[diag](diag.md),
|
47
|
-
[inv](inv.md),
|
48
|
-
[subset](subset.md),
|
49
|
-
[squeeze](squeeze.md)
|
@@ -1,81 +0,0 @@
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
-
|
3
|
-
# Function typeOf
|
4
|
-
|
5
|
-
Determine the type of a variable.
|
6
|
-
|
7
|
-
Function `typeOf` recognizes the following types of objects:
|
8
|
-
|
9
|
-
Object | Returns | Example
|
10
|
-
---------------------- | ------------- | ------------------------------------------
|
11
|
-
null | `'null'` | `math.typeOf(null)`
|
12
|
-
number | `'number'` | `math.typeOf(3.5)`
|
13
|
-
boolean | `'boolean'` | `math.typeOf(true)`
|
14
|
-
string | `'string'` | `math.typeOf('hello world')`
|
15
|
-
Array | `'Array'` | `math.typeOf([1, 2, 3])`
|
16
|
-
Date | `'Date'` | `math.typeOf(new Date())`
|
17
|
-
Function | `'Function'` | `math.typeOf(function () {})`
|
18
|
-
Object | `'Object'` | `math.typeOf({a: 2, b: 3})`
|
19
|
-
RegExp | `'RegExp'` | `math.typeOf(/a regexp/)`
|
20
|
-
undefined | `'undefined'` | `math.typeOf(undefined)`
|
21
|
-
math.BigNumber | `'BigNumber'` | `math.typeOf(math.bignumber('2.3e500'))`
|
22
|
-
math.Chain | `'Chain'` | `math.typeOf(math.chain(2))`
|
23
|
-
math.Complex | `'Complex'` | `math.typeOf(math.complex(2, 3))`
|
24
|
-
math.Fraction | `'Fraction'` | `math.typeOf(math.fraction(1, 3))`
|
25
|
-
math.Help | `'Help'` | `math.typeOf(math.help('sqrt'))`
|
26
|
-
math.Help | `'Help'` | `math.typeOf(math.help('sqrt'))`
|
27
|
-
math.Index | `'Index'` | `math.typeOf(math.index(1, 3))`
|
28
|
-
math.Matrix | `'Matrix'` | `math.typeOf(math.matrix([[1,2], [3, 4]]))`
|
29
|
-
math.Range | `'Range'` | `math.typeOf(math.range(0, 10))`
|
30
|
-
math.ResultSet | `'ResultSet'` | `math.typeOf(math.evaluate('a=2\nb=3'))`
|
31
|
-
math.Unit | `'Unit'` | `math.typeOf(math.unit('45 deg'))`
|
32
|
-
math.AccessorNode | `'AccessorNode'` | `math.typeOf(math.parse('A[2]'))`
|
33
|
-
math.ArrayNode | `'ArrayNode'` | `math.typeOf(math.parse('[1,2,3]'))`
|
34
|
-
math.AssignmentNode | `'AssignmentNode'` | `math.typeOf(math.parse('x=2'))`
|
35
|
-
math.BlockNode | `'BlockNode'` | `math.typeOf(math.parse('a=2; b=3'))`
|
36
|
-
math.ConditionalNode | `'ConditionalNode'` | `math.typeOf(math.parse('x<0 ? -x : x'))`
|
37
|
-
math.ConstantNode | `'ConstantNode'` | `math.typeOf(math.parse('2.3'))`
|
38
|
-
math.FunctionAssignmentNode | `'FunctionAssignmentNode'` | `math.typeOf(math.parse('f(x)=x^2'))`
|
39
|
-
math.FunctionNode | `'FunctionNode'` | `math.typeOf(math.parse('sqrt(4)'))`
|
40
|
-
math.IndexNode | `'IndexNode'` | `math.typeOf(math.parse('A[2]').index)`
|
41
|
-
math.ObjectNode | `'ObjectNode'` | `math.typeOf(math.parse('{a:2}'))`
|
42
|
-
math.ParenthesisNode | `'ParenthesisNode'` | `math.typeOf(math.parse('(2+3)'))`
|
43
|
-
math.RangeNode | `'RangeNode'` | `math.typeOf(math.parse('1:10'))`
|
44
|
-
math.SymbolNode | `'SymbolNode'` | `math.typeOf(math.parse('x'))`
|
45
|
-
|
46
|
-
|
47
|
-
## Syntax
|
48
|
-
|
49
|
-
```js
|
50
|
-
math.typeOf(x)
|
51
|
-
```
|
52
|
-
|
53
|
-
### Parameters
|
54
|
-
|
55
|
-
Parameter | Type | Description
|
56
|
-
--------- | ---- | -----------
|
57
|
-
`x` | * | The variable for which to test the type.
|
58
|
-
|
59
|
-
### Returns
|
60
|
-
|
61
|
-
Type | Description
|
62
|
-
---- | -----------
|
63
|
-
string | Returns the name of the type. Primitive types are lower case, non-primitive types are upper-camel-case. For example 'number', 'string', 'Array', 'Date'.
|
64
|
-
|
65
|
-
|
66
|
-
### Throws
|
67
|
-
|
68
|
-
Type | Description
|
69
|
-
---- | -----------
|
70
|
-
|
71
|
-
|
72
|
-
## Examples
|
73
|
-
|
74
|
-
```js
|
75
|
-
math.typeOf(3.5) // returns 'number'
|
76
|
-
math.typeOf(math.complex('2-4i')) // returns 'Complex'
|
77
|
-
math.typeOf(math.unit('45 deg')) // returns 'Unit'
|
78
|
-
math.typeOf('hello world') // returns 'string'
|
79
|
-
```
|
80
|
-
|
81
|
-
|
@@ -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 typed
|
4
|
-
|
5
|
-
Create a typed-function which checks the types of the arguments and
|
6
|
-
can match them against multiple provided signatures. The typed-function
|
7
|
-
automatically converts inputs in order to find a matching signature.
|
8
|
-
Typed functions throw informative errors in case of wrong input arguments.
|
9
|
-
|
10
|
-
See the library [typed-function](https://github.com/josdejong/typed-function)
|
11
|
-
for detailed documentation.
|
12
|
-
|
13
|
-
|
14
|
-
## Syntax
|
15
|
-
|
16
|
-
```js
|
17
|
-
math.typed(name, signatures) : function
|
18
|
-
math.typed(signatures) : function
|
19
|
-
```
|
20
|
-
|
21
|
-
### Parameters
|
22
|
-
|
23
|
-
Parameter | Type | Description
|
24
|
-
--------- | ---- | -----------
|
25
|
-
`name` | string | Optional name for the typed-function
|
26
|
-
`signatures` | Object<string, function> | Object with one or multiple function signatures
|
27
|
-
|
28
|
-
### Returns
|
29
|
-
|
30
|
-
Type | Description
|
31
|
-
---- | -----------
|
32
|
-
function | The created typed-function.
|
33
|
-
|
34
|
-
|
35
|
-
## Examples
|
36
|
-
|
37
|
-
```js
|
38
|
-
// create a typed function with multiple types per argument (type union)
|
39
|
-
const fn2 = typed({
|
40
|
-
'number | boolean': function (b) {
|
41
|
-
return 'b is a number or boolean'
|
42
|
-
},
|
43
|
-
'string, number | boolean': function (a, b) {
|
44
|
-
return 'a is a string, b is a number or boolean'
|
45
|
-
}
|
46
|
-
})
|
47
|
-
|
48
|
-
// create a typed function with an any type argument
|
49
|
-
const log = typed({
|
50
|
-
'string, any': function (event, data) {
|
51
|
-
console.log('event: ' + event + ', data: ' + JSON.stringify(data))
|
52
|
-
}
|
53
|
-
})
|
54
|
-
```
|
55
|
-
|
56
|
-
|
@@ -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 unaryMinus
|
4
|
-
|
5
|
-
Inverse the sign of a value, apply a unary minus operation.
|
6
|
-
|
7
|
-
For matrices, the function is evaluated element wise. Boolean values and
|
8
|
-
strings will be converted to a number. For complex numbers, both real and
|
9
|
-
complex value are inverted.
|
10
|
-
|
11
|
-
|
12
|
-
## Syntax
|
13
|
-
|
14
|
-
```js
|
15
|
-
math.unaryMinus(x)
|
16
|
-
```
|
17
|
-
|
18
|
-
### Parameters
|
19
|
-
|
20
|
-
Parameter | Type | Description
|
21
|
-
--------- | ---- | -----------
|
22
|
-
`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Number to be inverted.
|
23
|
-
|
24
|
-
### Returns
|
25
|
-
|
26
|
-
Type | Description
|
27
|
-
---- | -----------
|
28
|
-
number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Returns the value with inverted sign.
|
29
|
-
|
30
|
-
|
31
|
-
### Throws
|
32
|
-
|
33
|
-
Type | Description
|
34
|
-
---- | -----------
|
35
|
-
|
36
|
-
|
37
|
-
## Examples
|
38
|
-
|
39
|
-
```js
|
40
|
-
math.unaryMinus(3.5) // returns -3.5
|
41
|
-
math.unaryMinus(-4.2) // returns 4.2
|
42
|
-
```
|
43
|
-
|
44
|
-
|
45
|
-
## See also
|
46
|
-
|
47
|
-
[add](add.md),
|
48
|
-
[subtract](subtract.md),
|
49
|
-
[unaryPlus](unaryPlus.md)
|
@@ -1,48 +0,0 @@
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
-
|
3
|
-
# Function unaryPlus
|
4
|
-
|
5
|
-
Unary plus operation.
|
6
|
-
Boolean values and strings will be converted to a number, numeric values will be returned as is.
|
7
|
-
|
8
|
-
For matrices, the function is evaluated element wise.
|
9
|
-
|
10
|
-
|
11
|
-
## Syntax
|
12
|
-
|
13
|
-
```js
|
14
|
-
math.unaryPlus(x)
|
15
|
-
```
|
16
|
-
|
17
|
-
### Parameters
|
18
|
-
|
19
|
-
Parameter | Type | Description
|
20
|
-
--------- | ---- | -----------
|
21
|
-
`x` | number | BigNumber | Fraction | string | Complex | Unit | Array | Matrix | Input value
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Returns the input value when numeric, converts to a number when input is non-numeric.
|
28
|
-
|
29
|
-
|
30
|
-
### Throws
|
31
|
-
|
32
|
-
Type | Description
|
33
|
-
---- | -----------
|
34
|
-
|
35
|
-
|
36
|
-
## Examples
|
37
|
-
|
38
|
-
```js
|
39
|
-
math.unaryPlus(3.5) // returns 3.5
|
40
|
-
math.unaryPlus(1) // returns 1
|
41
|
-
```
|
42
|
-
|
43
|
-
|
44
|
-
## See also
|
45
|
-
|
46
|
-
[unaryMinus](unaryMinus.md),
|
47
|
-
[add](add.md),
|
48
|
-
[subtract](subtract.md)
|
@@ -1,74 +0,0 @@
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
-
|
3
|
-
# Function unequal
|
4
|
-
|
5
|
-
Test whether two values are unequal.
|
6
|
-
|
7
|
-
The function tests whether the relative difference between x and y is
|
8
|
-
larger than the configured epsilon. The function cannot be used to compare
|
9
|
-
values smaller than approximately 2.22e-16.
|
10
|
-
|
11
|
-
For matrices, the function is evaluated element wise.
|
12
|
-
In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im.
|
13
|
-
Strings are compared by their numerical value.
|
14
|
-
|
15
|
-
Values `null` and `undefined` are compared strictly, thus `null` is unequal
|
16
|
-
with everything except `null`, and `undefined` is unequal with everything
|
17
|
-
except `undefined`.
|
18
|
-
|
19
|
-
|
20
|
-
## Syntax
|
21
|
-
|
22
|
-
```js
|
23
|
-
math.unequal(x, y)
|
24
|
-
```
|
25
|
-
|
26
|
-
### Parameters
|
27
|
-
|
28
|
-
Parameter | Type | Description
|
29
|
-
--------- | ---- | -----------
|
30
|
-
`x` | number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined | First value to compare
|
31
|
-
`y` | number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined | Second value to compare
|
32
|
-
|
33
|
-
### Returns
|
34
|
-
|
35
|
-
Type | Description
|
36
|
-
---- | -----------
|
37
|
-
boolean | Array | Matrix | Returns true when the compared values are unequal, else returns false
|
38
|
-
|
39
|
-
|
40
|
-
### Throws
|
41
|
-
|
42
|
-
Type | Description
|
43
|
-
---- | -----------
|
44
|
-
|
45
|
-
|
46
|
-
## Examples
|
47
|
-
|
48
|
-
```js
|
49
|
-
math.unequal(2 + 2, 3) // returns true
|
50
|
-
math.unequal(2 + 2, 4) // returns false
|
51
|
-
|
52
|
-
const a = math.unit('50 cm')
|
53
|
-
const b = math.unit('5 m')
|
54
|
-
math.unequal(a, b) // returns false
|
55
|
-
|
56
|
-
const c = [2, 5, 1]
|
57
|
-
const d = [2, 7, 1]
|
58
|
-
|
59
|
-
math.unequal(c, d) // returns [false, true, false]
|
60
|
-
math.deepEqual(c, d) // returns false
|
61
|
-
|
62
|
-
math.unequal(0, null) // returns true
|
63
|
-
```
|
64
|
-
|
65
|
-
|
66
|
-
## See also
|
67
|
-
|
68
|
-
[equal](equal.md),
|
69
|
-
[deepEqual](deepEqual.md),
|
70
|
-
[smaller](smaller.md),
|
71
|
-
[smallerEq](smallerEq.md),
|
72
|
-
[larger](larger.md),
|
73
|
-
[largerEq](largerEq.md),
|
74
|
-
[compare](compare.md)
|
@@ -1,48 +0,0 @@
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
-
|
3
|
-
# Function unit
|
4
|
-
|
5
|
-
Create a unit. Depending on the passed arguments, the function
|
6
|
-
will create and return a new math.Unit object.
|
7
|
-
When a matrix is provided, all elements will be converted to units.
|
8
|
-
|
9
|
-
|
10
|
-
## Syntax
|
11
|
-
|
12
|
-
```js
|
13
|
-
math.unit(unit : string)
|
14
|
-
math.unit(value : number, unit : string)
|
15
|
-
```
|
16
|
-
|
17
|
-
### Parameters
|
18
|
-
|
19
|
-
Parameter | Type | Description
|
20
|
-
--------- | ---- | -----------
|
21
|
-
`args` | * | Array | Matrix | A number and unit.
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
Unit | Array | Matrix | The created unit
|
28
|
-
|
29
|
-
|
30
|
-
## Examples
|
31
|
-
|
32
|
-
```js
|
33
|
-
const a = math.unit(5, 'cm') // returns Unit 50 mm
|
34
|
-
const b = math.unit('23 kg') // returns Unit 23 kg
|
35
|
-
a.to('m') // returns Unit 0.05 m
|
36
|
-
```
|
37
|
-
|
38
|
-
|
39
|
-
## See also
|
40
|
-
|
41
|
-
[bignumber](bignumber.md),
|
42
|
-
[boolean](boolean.md),
|
43
|
-
[complex](complex.md),
|
44
|
-
[index](index.md),
|
45
|
-
[matrix](matrix.md),
|
46
|
-
[number](number.md),
|
47
|
-
[string](string.md),
|
48
|
-
[createUnit](createUnit.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 usolve
|
4
|
-
|
5
|
-
Finds one solution of a linear equation system by backward substitution. Matrix must be an upper triangular matrix. Throws an error if there's no solution.
|
6
|
-
|
7
|
-
`U * x = b`
|
8
|
-
|
9
|
-
|
10
|
-
## Syntax
|
11
|
-
|
12
|
-
```js
|
13
|
-
math.usolve(U, b)
|
14
|
-
```
|
15
|
-
|
16
|
-
### Parameters
|
17
|
-
|
18
|
-
Parameter | Type | Description
|
19
|
-
--------- | ---- | -----------
|
20
|
-
`U` | Matrix, Array | A N x N matrix or array (U)
|
21
|
-
`b` | Matrix, Array | A column vector with the b values
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
DenseMatrix | Array | A column vector with the linear system solution (x)
|
28
|
-
|
29
|
-
|
30
|
-
### Throws
|
31
|
-
|
32
|
-
Type | Description
|
33
|
-
---- | -----------
|
34
|
-
|
35
|
-
|
36
|
-
## Examples
|
37
|
-
|
38
|
-
```js
|
39
|
-
const a = [[-2, 3], [2, 1]]
|
40
|
-
const b = [11, 9]
|
41
|
-
const x = usolve(a, b) // [[8], [9]]
|
42
|
-
```
|
43
|
-
|
44
|
-
|
45
|
-
## See also
|
46
|
-
|
47
|
-
[usolveAll](usolveAll.md),
|
48
|
-
[lup](lup.md),
|
49
|
-
[slu](slu.md),
|
50
|
-
[usolve](usolve.md),
|
51
|
-
[lusolve](lusolve.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 usolveAll
|
4
|
-
|
5
|
-
Finds all solutions of a linear equation system by backward substitution. Matrix must be an upper triangular matrix.
|
6
|
-
|
7
|
-
`U * x = b`
|
8
|
-
|
9
|
-
|
10
|
-
## Syntax
|
11
|
-
|
12
|
-
```js
|
13
|
-
math.usolveAll(U, b)
|
14
|
-
```
|
15
|
-
|
16
|
-
### Parameters
|
17
|
-
|
18
|
-
Parameter | Type | Description
|
19
|
-
--------- | ---- | -----------
|
20
|
-
`U` | Matrix, Array | A N x N matrix or array (U)
|
21
|
-
`b` | Matrix, Array | A column vector with the b values
|
22
|
-
|
23
|
-
### Returns
|
24
|
-
|
25
|
-
Type | Description
|
26
|
-
---- | -----------
|
27
|
-
DenseMatrix[] | Array[] | An array of affine-independent column vectors (x) that solve the linear system
|
28
|
-
|
29
|
-
|
30
|
-
### Throws
|
31
|
-
|
32
|
-
Type | Description
|
33
|
-
---- | -----------
|
34
|
-
|
35
|
-
|
36
|
-
## Examples
|
37
|
-
|
38
|
-
```js
|
39
|
-
const a = [[-2, 3], [2, 1]]
|
40
|
-
const b = [11, 9]
|
41
|
-
const x = usolveAll(a, b) // [ [[8], [9]] ]
|
42
|
-
```
|
43
|
-
|
44
|
-
|
45
|
-
## See also
|
46
|
-
|
47
|
-
[usolve](usolve.md),
|
48
|
-
[lup](lup.md),
|
49
|
-
[slu](slu.md),
|
50
|
-
[usolve](usolve.md),
|
51
|
-
[lusolve](lusolve.md)
|
@@ -1,78 +0,0 @@
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
-
|
3
|
-
# Function variance
|
4
|
-
|
5
|
-
Compute the variance of a matrix or a list with values.
|
6
|
-
In case of a (multi dimensional) array or matrix, the variance over all
|
7
|
-
elements will be calculated.
|
8
|
-
|
9
|
-
Additionally, it is possible to compute the variance along the rows
|
10
|
-
or columns of a matrix by specifying the dimension as the second argument.
|
11
|
-
|
12
|
-
Optionally, the type of normalization can be specified as the final
|
13
|
-
parameter. The parameter `normalization` can be one of the following values:
|
14
|
-
|
15
|
-
- 'unbiased' (default) The sum of squared errors is divided by (n - 1)
|
16
|
-
- 'uncorrected' The sum of squared errors is divided by n
|
17
|
-
- 'biased' The sum of squared errors is divided by (n + 1)
|
18
|
-
|
19
|
-
|
20
|
-
Note that older browser may not like the variable name `var`. In that
|
21
|
-
case, the function can be called as `math['var'](...)` instead of
|
22
|
-
`math.var(...)`.
|
23
|
-
|
24
|
-
|
25
|
-
## Syntax
|
26
|
-
|
27
|
-
```js
|
28
|
-
math.variance(a, b, c, ...)
|
29
|
-
math.variance(A)
|
30
|
-
math.variance(A, normalization)
|
31
|
-
math.variance(A, dimension)
|
32
|
-
math.variance(A, dimension, normalization)
|
33
|
-
```
|
34
|
-
|
35
|
-
### Parameters
|
36
|
-
|
37
|
-
Parameter | Type | Description
|
38
|
-
--------- | ---- | -----------
|
39
|
-
`array` | Array | Matrix | A single matrix or or multiple scalar values
|
40
|
-
`normalization` | string | Determines how to normalize the variance. Choose 'unbiased' (default), 'uncorrected', or 'biased'. Default value: 'unbiased'.
|
41
|
-
|
42
|
-
### Returns
|
43
|
-
|
44
|
-
Type | Description
|
45
|
-
---- | -----------
|
46
|
-
* | The variance
|
47
|
-
|
48
|
-
|
49
|
-
### Throws
|
50
|
-
|
51
|
-
Type | Description
|
52
|
-
---- | -----------
|
53
|
-
|
54
|
-
|
55
|
-
## Examples
|
56
|
-
|
57
|
-
```js
|
58
|
-
math.variance(2, 4, 6) // returns 4
|
59
|
-
math.variance([2, 4, 6, 8]) // returns 6.666666666666667
|
60
|
-
math.variance([2, 4, 6, 8], 'uncorrected') // returns 5
|
61
|
-
math.variance([2, 4, 6, 8], 'biased') // returns 4
|
62
|
-
|
63
|
-
math.variance([[1, 2, 3], [4, 5, 6]]) // returns 3.5
|
64
|
-
math.variance([[1, 2, 3], [4, 6, 8]], 0) // returns [4.5, 8, 12.5]
|
65
|
-
math.variance([[1, 2, 3], [4, 6, 8]], 1) // returns [1, 4]
|
66
|
-
math.variance([[1, 2, 3], [4, 6, 8]], 1, 'biased') // returns [0.5, 2]
|
67
|
-
```
|
68
|
-
|
69
|
-
|
70
|
-
## See also
|
71
|
-
|
72
|
-
[mean](mean.md),
|
73
|
-
[median](median.md),
|
74
|
-
[max](max.md),
|
75
|
-
[min](min.md),
|
76
|
-
[prod](prod.md),
|
77
|
-
[std](std.md),
|
78
|
-
[sum](sum.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 xgcd
|
4
|
-
|
5
|
-
Calculate the extended greatest common divisor for two values.
|
6
|
-
See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm.
|
7
|
-
|
8
|
-
|
9
|
-
## Syntax
|
10
|
-
|
11
|
-
```js
|
12
|
-
math.xgcd(a, b)
|
13
|
-
```
|
14
|
-
|
15
|
-
### Parameters
|
16
|
-
|
17
|
-
Parameter | Type | Description
|
18
|
-
--------- | ---- | -----------
|
19
|
-
`a` | number | BigNumber | An integer number
|
20
|
-
`b` | number | BigNumber | An integer number
|
21
|
-
|
22
|
-
### Returns
|
23
|
-
|
24
|
-
Type | Description
|
25
|
-
---- | -----------
|
26
|
-
Array | Returns an array containing 3 integers `[div, m, n]` where `div = gcd(a, b)` and `a*m + b*n = div`
|
27
|
-
|
28
|
-
|
29
|
-
### Throws
|
30
|
-
|
31
|
-
Type | Description
|
32
|
-
---- | -----------
|
33
|
-
|
34
|
-
|
35
|
-
## Examples
|
36
|
-
|
37
|
-
```js
|
38
|
-
math.xgcd(8, 12) // returns [4, -1, 1]
|
39
|
-
math.gcd(8, 12) // returns 4
|
40
|
-
math.xgcd(36163, 21199) // returns [1247, -7, 12]
|
41
|
-
```
|
42
|
-
|
43
|
-
|
44
|
-
## See also
|
45
|
-
|
46
|
-
[gcd](gcd.md),
|
47
|
-
[lcm](lcm.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 xor
|
4
|
-
|
5
|
-
Logical `xor`. Test whether one and only one value is defined with a nonzero/nonempty value.
|
6
|
-
For matrices, the function is evaluated element wise.
|
7
|
-
|
8
|
-
|
9
|
-
## Syntax
|
10
|
-
|
11
|
-
```js
|
12
|
-
math.xor(x, y)
|
13
|
-
```
|
14
|
-
|
15
|
-
### Parameters
|
16
|
-
|
17
|
-
Parameter | Type | Description
|
18
|
-
--------- | ---- | -----------
|
19
|
-
`x` | number | BigNumber | Complex | Unit | Array | Matrix | First value to check
|
20
|
-
`y` | number | BigNumber | Complex | Unit | Array | Matrix | Second value to check
|
21
|
-
|
22
|
-
### Returns
|
23
|
-
|
24
|
-
Type | Description
|
25
|
-
---- | -----------
|
26
|
-
boolean | Array | Matrix | Returns true when one and only one input is defined with a nonzero/nonempty value.
|
27
|
-
|
28
|
-
|
29
|
-
### Throws
|
30
|
-
|
31
|
-
Type | Description
|
32
|
-
---- | -----------
|
33
|
-
|
34
|
-
|
35
|
-
## Examples
|
36
|
-
|
37
|
-
```js
|
38
|
-
math.xor(2, 4) // returns false
|
39
|
-
|
40
|
-
a = [2, 0, 0]
|
41
|
-
b = [2, 7, 0]
|
42
|
-
c = 0
|
43
|
-
|
44
|
-
math.xor(a, b) // returns [false, true, false]
|
45
|
-
math.xor(a, c) // returns [true, false, false]
|
46
|
-
```
|
47
|
-
|
48
|
-
|
49
|
-
## See also
|
50
|
-
|
51
|
-
[and](and.md),
|
52
|
-
[not](not.md),
|
53
|
-
[or](or.md)
|