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,68 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function rationalize
|
|
4
|
-
|
|
5
|
-
Transform a rationalizable expression in a rational fraction.
|
|
6
|
-
If rational fraction is one variable polynomial then converts
|
|
7
|
-
the numerator and denominator in canonical form, with decreasing
|
|
8
|
-
exponents, returning the coefficients of numerator.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
rationalize(expr)
|
|
15
|
-
rationalize(expr, detailed)
|
|
16
|
-
rationalize(expr, scope)
|
|
17
|
-
rationalize(expr, scope, detailed)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Parameters
|
|
21
|
-
|
|
22
|
-
Parameter | Type | Description
|
|
23
|
-
--------- | ---- | -----------
|
|
24
|
-
`expr` | Node | string | The expression to check if is a polynomial expression
|
|
25
|
-
`optional` | Object | boolean | scope of expression or true for already evaluated rational expression at input
|
|
26
|
-
`detailed` | Boolean | optional True if return an object, false if return expression node (default)
|
|
27
|
-
|
|
28
|
-
### Returns
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
Object | Node | The rational polynomial of `expr` or an object `{expression, numerator, denominator, variables, coefficients}`, where `expression` is a `Node` with the node simplified expression, `numerator` is a `Node` with the simplified numerator of expression, `denominator` is a `Node` or `boolean` with the simplified denominator or `false` (if there is no denominator), `variables` is an array with variable names, and `coefficients` is an array with coefficients of numerator sorted by increased exponent {Expression Node} node simplified expression
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Throws
|
|
36
|
-
|
|
37
|
-
Type | Description
|
|
38
|
-
---- | -----------
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Examples
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
math.rationalize('sin(x)+y')
|
|
45
|
-
// Error: There is an unsolved function call
|
|
46
|
-
math.rationalize('2x/y - y/(x+1)')
|
|
47
|
-
// (2*x^2-y^2+2*x)/(x*y+y)
|
|
48
|
-
math.rationalize('(2x+1)^6')
|
|
49
|
-
// 64*x^6+192*x^5+240*x^4+160*x^3+60*x^2+12*x+1
|
|
50
|
-
math.rationalize('2x/( (2x-1) / (3x+2) ) - 5x/ ( (3x+4) / (2x^2-5) ) + 3')
|
|
51
|
-
// -20*x^4+28*x^3+104*x^2+6*x-12)/(6*x^2+5*x-4)
|
|
52
|
-
math.rationalize('x/(1-x)/(x-2)/(x-3)/(x-4) + 2x/ ( (1-2x)/(2-3x) )/ ((3-4x)/(4-5x) )') =
|
|
53
|
-
// (-30*x^7+344*x^6-1506*x^5+3200*x^4-3472*x^3+1846*x^2-381*x)/
|
|
54
|
-
// (-8*x^6+90*x^5-383*x^4+780*x^3-797*x^2+390*x-72)
|
|
55
|
-
|
|
56
|
-
math.rationalize('x+x+x+y',{y:1}) // 3*x+1
|
|
57
|
-
math.rationalize('x+x+x+y',{}) // 3*x+y
|
|
58
|
-
|
|
59
|
-
const ret = math.rationalize('x+x+x+y',{},true)
|
|
60
|
-
// ret.expression=3*x+y, ret.variables = ["x","y"]
|
|
61
|
-
const ret = math.rationalize('-2+5x^2',{},true)
|
|
62
|
-
// ret.expression=5*x^2-2, ret.variables = ["x"], ret.coefficients=[-2,0,5]
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
## See also
|
|
67
|
-
|
|
68
|
-
[simplify](simplify.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 re
|
|
4
|
-
|
|
5
|
-
Get the real part of a complex number.
|
|
6
|
-
For a complex number `a + bi`, the function returns `a`.
|
|
7
|
-
|
|
8
|
-
For matrices, the function is evaluated element wise.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.re(x)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Parameters
|
|
18
|
-
|
|
19
|
-
Parameter | Type | Description
|
|
20
|
-
--------- | ---- | -----------
|
|
21
|
-
`x` | number | BigNumber | Complex | Array | Matrix | A complex number or array with complex numbers
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Array | Matrix | The real part of x
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const a = math.complex(2, 3)
|
|
40
|
-
math.re(a) // returns number 2
|
|
41
|
-
math.im(a) // returns number 3
|
|
42
|
-
|
|
43
|
-
math.re(math.complex('-5.2i')) // returns number 0
|
|
44
|
-
math.re(math.complex(2.4)) // returns number 2.4
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## See also
|
|
49
|
-
|
|
50
|
-
[im](im.md),
|
|
51
|
-
[conj](conj.md),
|
|
52
|
-
[abs](abs.md),
|
|
53
|
-
[arg](arg.md)
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
2
|
-
|
|
3
|
-
# Function reshape
|
|
4
|
-
|
|
5
|
-
Reshape a multi dimensional array to fit the specified dimensions
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.reshape(x, sizes)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`x` | Array | Matrix | * | Matrix to be reshaped
|
|
19
|
-
`sizes` | number[] | One dimensional array with integral sizes for each dimension. One -1 is allowed as wildcard, which calculates this dimension automatically.
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
* | Array | Matrix | A reshaped clone of matrix `x`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
TypeError | If `sizes` does not contain solely integers
|
|
33
|
-
DimensionError | If the product of the new dimension sizes does not equal that of the old ones
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.reshape([1, 2, 3, 4, 5, 6], [2, 3])
|
|
39
|
-
// returns Array [[1, 2, 3], [4, 5, 6]]
|
|
40
|
-
|
|
41
|
-
math.reshape([[1, 2], [3, 4]], [1, 4])
|
|
42
|
-
// returns Array [[1, 2, 3, 4]]
|
|
43
|
-
|
|
44
|
-
math.reshape([[1, 2], [3, 4]], [4])
|
|
45
|
-
// returns Array [1, 2, 3, 4]
|
|
46
|
-
|
|
47
|
-
const x = math.matrix([1, 2, 3, 4, 5, 6, 7, 8])
|
|
48
|
-
math.reshape(x, [2, 2, 2])
|
|
49
|
-
// returns Matrix [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
|
|
50
|
-
|
|
51
|
-
math.reshape([1, 2, 3, 4], [-1, 2])
|
|
52
|
-
// returns Matrix [[1, 2], [3, 4]]
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## See also
|
|
57
|
-
|
|
58
|
-
[size](size.md),
|
|
59
|
-
[squeeze](squeeze.md),
|
|
60
|
-
[resize](resize.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 resize
|
|
4
|
-
|
|
5
|
-
Resize a matrix
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.resize(x, size)
|
|
12
|
-
math.resize(x, size, defaultValue)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Parameters
|
|
16
|
-
|
|
17
|
-
Parameter | Type | Description
|
|
18
|
-
--------- | ---- | -----------
|
|
19
|
-
`x` | Array | Matrix | * | Matrix to be resized
|
|
20
|
-
`size` | Array | Matrix | One dimensional array with numbers
|
|
21
|
-
`defaultValue` | number | string | Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0.
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
* | Array | Matrix | A resized clone of matrix `x`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.resize([1, 2, 3, 4, 5], [3]) // returns Array [1, 2, 3]
|
|
40
|
-
math.resize([1, 2, 3], [5], 0) // returns Array [1, 2, 3, 0, 0]
|
|
41
|
-
math.resize(2, [2, 3], 0) // returns Matrix [[2, 0, 0], [0, 0, 0]]
|
|
42
|
-
math.resize("hello", [8], "!") // returns string 'hello!!!'
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## See also
|
|
47
|
-
|
|
48
|
-
[size](size.md),
|
|
49
|
-
[squeeze](squeeze.md),
|
|
50
|
-
[subset](subset.md),
|
|
51
|
-
[reshape](reshape.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 resolve
|
|
4
|
-
|
|
5
|
-
resolve(expr, scope) replaces variable nodes with their scoped values
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
resolve(expr, scope)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`node` | Node | Node[] | The expression tree (or trees) to be simplified
|
|
19
|
-
`scope` | Object | Scope specifying variables to be resolved
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
Node | Node[] | Returns `node` with variables recursively substituted.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
ReferenceError | If there is a cyclic dependency among the variables in `scope`, resolution is impossible and a ReferenceError is thrown.
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
math.resolve('x + y', {x:1, y:2}) // Node {1 + 2}
|
|
38
|
-
math.resolve(math.parse('x+y'), {x:1, y:2}) // Node {1 + 2}
|
|
39
|
-
math.simplify('x+y', {x:2, y:'x+x'}).toString() // "6"
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[simplify](simplify.md),
|
|
46
|
-
[evaluate](evaluate.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 rightArithShift
|
|
4
|
-
|
|
5
|
-
Bitwise right arithmetic shift of a value x by y number of bits, `x >> y`.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
For units, the function is evaluated on the best prefix base.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.rightArithShift(x, y)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | number | BigNumber | Array | Matrix | Value to be shifted
|
|
21
|
-
`y` | number | BigNumber | Amount of shifts
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Array | Matrix | `x` sign-filled shifted right `y` times
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.rightArithShift(4, 2) // returns number 1
|
|
40
|
-
|
|
41
|
-
math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 3]
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[bitAnd](bitAnd.md),
|
|
48
|
-
[bitNot](bitNot.md),
|
|
49
|
-
[bitOr](bitOr.md),
|
|
50
|
-
[bitXor](bitXor.md),
|
|
51
|
-
[rightArithShift](rightArithShift.md),
|
|
52
|
-
[rightLogShift](rightLogShift.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 rightLogShift
|
|
4
|
-
|
|
5
|
-
Bitwise right logical shift of value x by y number of bits, `x >>> y`.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
For units, the function is evaluated on the best prefix base.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.rightLogShift(x, y)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | number | Array | Matrix | Value to be shifted
|
|
21
|
-
`y` | number | Amount of shifts
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | Array | Matrix | `x` zero-filled shifted right `y` times
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.rightLogShift(4, 2) // returns number 1
|
|
40
|
-
|
|
41
|
-
math.rightLogShift([16, -32, 64], 4) // returns Array [1, 2, 3]
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[bitAnd](bitAnd.md),
|
|
48
|
-
[bitNot](bitNot.md),
|
|
49
|
-
[bitOr](bitOr.md),
|
|
50
|
-
[bitXor](bitXor.md),
|
|
51
|
-
[leftShift](leftShift.md),
|
|
52
|
-
[rightLogShift](rightLogShift.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 rotate
|
|
4
|
-
|
|
5
|
-
Rotate a vector of size 1x2 counter-clockwise by a given angle
|
|
6
|
-
Rotate a vector of size 1x3 counter-clockwise by a given angle around the given axis
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.rotate(w, theta)
|
|
13
|
-
math.rotate(w, theta, v)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`w` | Array | Matrix | Vector to rotate
|
|
21
|
-
`theta` | number | BigNumber | Complex | Unit | Rotation angle
|
|
22
|
-
`v` | Array | Matrix | Rotation axis
|
|
23
|
-
|
|
24
|
-
### Returns
|
|
25
|
-
|
|
26
|
-
Type | Description
|
|
27
|
-
---- | -----------
|
|
28
|
-
Array | Matrix | Multiplication of the rotation matrix and w
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### Throws
|
|
32
|
-
|
|
33
|
-
Type | Description
|
|
34
|
-
---- | -----------
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Examples
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
math.rotate([11, 12], math.pi / 2) // returns matrix([-12, 11])
|
|
41
|
-
math.rotate(matrix([11, 12]), math.pi / 2) // returns matrix([-12, 11])
|
|
42
|
-
|
|
43
|
-
math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1]) // returns matrix([0, 1, 0])
|
|
44
|
-
math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1]) // returns matrix([0, 1, 0])
|
|
45
|
-
|
|
46
|
-
math.rotate([1, 0], math.complex(1 + i)) // returns matrix([cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)])
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## See also
|
|
51
|
-
|
|
52
|
-
[matrix](matrix.md),
|
|
53
|
-
[rotationMatrix](rotationMatrix.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 rotationMatrix
|
|
4
|
-
|
|
5
|
-
Create a 2-dimensional counter-clockwise rotation matrix (2x2) for a given angle (expressed in radians).
|
|
6
|
-
Create a 2-dimensional counter-clockwise rotation matrix (3x3) by a given angle (expressed in radians) around a given axis (1x3).
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.rotationMatrix(theta)
|
|
13
|
-
math.rotationMatrix(theta, format)
|
|
14
|
-
math.rotationMatrix(theta, [v])
|
|
15
|
-
math.rotationMatrix(theta, [v], format)
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Parameters
|
|
19
|
-
|
|
20
|
-
Parameter | Type | Description
|
|
21
|
-
--------- | ---- | -----------
|
|
22
|
-
`theta` | number | BigNumber | Complex | Unit | Rotation angle
|
|
23
|
-
`v` | Array | Matrix | Rotation axis
|
|
24
|
-
`format` | string | Result Matrix storage format
|
|
25
|
-
|
|
26
|
-
### Returns
|
|
27
|
-
|
|
28
|
-
Type | Description
|
|
29
|
-
---- | -----------
|
|
30
|
-
Array | Matrix | Rotation matrix
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Throws
|
|
34
|
-
|
|
35
|
-
Type | Description
|
|
36
|
-
---- | -----------
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Examples
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
math.rotationMatrix(math.pi / 2) // returns [[0, -1], [1, 0]]
|
|
43
|
-
math.rotationMatrix(math.bignumber(1)) // returns [[bignumber(cos(1)), bignumber(-sin(1))], [bignumber(sin(1)), bignumber(cos(1))]]
|
|
44
|
-
math.rotationMatrix(math.complex(1 + i)) // returns [[cos(1 + i), -sin(1 + i)], [sin(1 + i), cos(1 + i)]]
|
|
45
|
-
math.rotationMatrix(math.unit('1rad')) // returns [[cos(1), -sin(1)], [sin(1), cos(1)]]
|
|
46
|
-
|
|
47
|
-
math.rotationMatrix(math.pi / 2, [0, 1, 0]) // returns [[0, 0, 1], [0, 1, 0], [-1, 0, 0]]
|
|
48
|
-
math.rotationMatrix(math.pi / 2, matrix([0, 1, 0])) // returns matrix([[0, 0, 1], [0, 1, 0], [-1, 0, 0]])
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## See also
|
|
54
|
-
|
|
55
|
-
[matrix](matrix.md),
|
|
56
|
-
[cos](cos.md),
|
|
57
|
-
[sin](sin.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 round
|
|
4
|
-
|
|
5
|
-
Round a value towards the nearest integer.
|
|
6
|
-
For matrices, the function is evaluated element wise.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Syntax
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
math.round(x)
|
|
13
|
-
math.round(x, n)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Parameters
|
|
17
|
-
|
|
18
|
-
Parameter | Type | Description
|
|
19
|
-
--------- | ---- | -----------
|
|
20
|
-
`x` | number | BigNumber | Fraction | Complex | Array | Matrix | Number to be rounded
|
|
21
|
-
`n` | number | BigNumber | Array | Number of decimals Default value: 0.
|
|
22
|
-
|
|
23
|
-
### Returns
|
|
24
|
-
|
|
25
|
-
Type | Description
|
|
26
|
-
---- | -----------
|
|
27
|
-
number | BigNumber | Fraction | Complex | Array | Matrix | Rounded value
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
math.round(3.22) // returns number 3
|
|
40
|
-
math.round(3.82) // returns number 4
|
|
41
|
-
math.round(-4.2) // returns number -4
|
|
42
|
-
math.round(-4.7) // returns number -5
|
|
43
|
-
math.round(3.22, 1) // returns number 3.2
|
|
44
|
-
math.round(3.88, 1) // returns number 3.9
|
|
45
|
-
math.round(-4.21, 1) // returns number -4.2
|
|
46
|
-
math.round(-4.71, 1) // returns number -4.7
|
|
47
|
-
math.round(math.pi, 3) // returns number 3.142
|
|
48
|
-
math.round(123.45678, 2) // returns number 123.46
|
|
49
|
-
|
|
50
|
-
const c = math.complex(3.2, -2.7)
|
|
51
|
-
math.round(c) // returns Complex 3 - 3i
|
|
52
|
-
|
|
53
|
-
math.round([3.2, 3.8, -4.7]) // returns Array [3, 4, -5]
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## See also
|
|
58
|
-
|
|
59
|
-
[ceil](ceil.md),
|
|
60
|
-
[fix](fix.md),
|
|
61
|
-
[floor](floor.md)
|
|
@@ -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 row
|
|
4
|
-
|
|
5
|
-
Return a row from a Matrix.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Syntax
|
|
9
|
-
|
|
10
|
-
```js
|
|
11
|
-
math.row(value, index)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Parameters
|
|
15
|
-
|
|
16
|
-
Parameter | Type | Description
|
|
17
|
-
--------- | ---- | -----------
|
|
18
|
-
`value` | Array | Matrix | An array or matrix
|
|
19
|
-
`row` | number | The index of the row
|
|
20
|
-
|
|
21
|
-
### Returns
|
|
22
|
-
|
|
23
|
-
Type | Description
|
|
24
|
-
---- | -----------
|
|
25
|
-
Array | Matrix | The retrieved row
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Throws
|
|
29
|
-
|
|
30
|
-
Type | Description
|
|
31
|
-
---- | -----------
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
// get a row
|
|
38
|
-
const d = [[1, 2], [3, 4]]
|
|
39
|
-
math.row(d, 1) // returns [[3, 4]]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[column](column.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 sec
|
|
4
|
-
|
|
5
|
-
Calculate the secant of a value, defined as `sec(x) = 1/cos(x)`.
|
|
6
|
-
|
|
7
|
-
For matrices, the function is evaluated element wise.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Syntax
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
math.sec(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 | Secant of x
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Throws
|
|
30
|
-
|
|
31
|
-
Type | Description
|
|
32
|
-
---- | -----------
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
math.sec(2) // returns number -2.4029979617223822
|
|
39
|
-
1 / math.cos(2) // returns number -2.4029979617223822
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## See also
|
|
44
|
-
|
|
45
|
-
[cos](cos.md),
|
|
46
|
-
[csc](csc.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 sech
|
|
4
|
-
|
|
5
|
-
Calculate the hyperbolic secant of a value,
|
|
6
|
-
defined as `sech(x) = 1 / cosh(x)`.
|
|
7
|
-
|
|
8
|
-
For matrices, the function is evaluated element wise.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Syntax
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
math.sech(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 secant of x
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Throws
|
|
31
|
-
|
|
32
|
-
Type | Description
|
|
33
|
-
---- | -----------
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Examples
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
// sech(x) = 1/ cosh(x)
|
|
40
|
-
math.sech(0.5) // returns 0.886818883970074
|
|
41
|
-
1 / math.cosh(0.5) // returns 0.886818883970074
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## See also
|
|
46
|
-
|
|
47
|
-
[cosh](cosh.md),
|
|
48
|
-
[csch](csch.md),
|
|
49
|
-
[coth](coth.md)
|