mathjs 13.0.3 → 13.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +30 -1
- package/bin/cli.js +24 -10
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/core/create.js +12 -9
- package/lib/cjs/core/function/typed.js +3 -4
- package/lib/cjs/entry/dependenciesAny/dependenciesFlatten.generated.js +0 -2
- package/lib/cjs/entry/dependenciesAny/dependenciesSqueeze.generated.js +0 -2
- package/lib/cjs/entry/impureFunctionsAny.generated.js +2 -2
- package/lib/cjs/entry/pureFunctionsAny.generated.js +6 -8
- package/lib/cjs/entry/typeChecks.js +18 -0
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +2 -2
- package/lib/cjs/expression/embeddedDocs/function/arithmetic/hypot.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/matrix/diff.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/matrix/fft.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/matrix/ifft.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/matrix/kron.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/matrix/map.js +3 -3
- package/lib/cjs/expression/embeddedDocs/function/special/zeta.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/statistics/quantileSeq.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/trigonometry/acoth.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/trigonometry/acsch.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/utils/clone.js +1 -1
- package/lib/cjs/expression/function/evaluate.js +5 -0
- package/lib/cjs/expression/node/FunctionNode.js +10 -2
- package/lib/cjs/expression/transform/filter.transform.js +2 -2
- package/lib/cjs/expression/transform/map.transform.js +104 -37
- package/lib/cjs/expression/transform/utils/dimToZeroBase.js +23 -0
- package/lib/cjs/expression/transform/utils/lastDimToZeroBase.js +3 -4
- package/lib/cjs/function/arithmetic/hypot.js +3 -3
- package/lib/cjs/function/matrix/apply.js +1 -1
- package/lib/cjs/function/matrix/fft.js +3 -3
- package/lib/cjs/function/matrix/filter.js +2 -2
- package/lib/cjs/function/matrix/flatten.js +5 -6
- package/lib/cjs/function/matrix/ifft.js +2 -2
- package/lib/cjs/function/matrix/kron.js +4 -4
- package/lib/cjs/function/matrix/map.js +109 -18
- package/lib/cjs/function/matrix/size.js +7 -7
- package/lib/cjs/function/matrix/squeeze.js +3 -4
- package/lib/cjs/function/probability/random.js +1 -1
- package/lib/cjs/function/probability/randomInt.js +1 -1
- package/lib/cjs/function/statistics/cumsum.js +2 -2
- package/lib/cjs/function/trigonometry/acoth.js +2 -2
- package/lib/cjs/function/trigonometry/acsch.js +2 -2
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/matrix/DenseMatrix.js +3 -28
- package/lib/cjs/type/matrix/SparseMatrix.js +5 -8
- package/lib/cjs/utils/array.js +27 -0
- package/lib/cjs/utils/collection.js +1 -1
- package/lib/cjs/utils/customs.js +5 -12
- package/lib/cjs/utils/function.js +0 -14
- package/lib/cjs/utils/is.js +27 -0
- package/lib/cjs/utils/map.js +7 -23
- package/lib/cjs/version.js +1 -1
- package/lib/esm/core/create.js +9 -6
- package/lib/esm/core/function/typed.js +2 -3
- package/lib/esm/entry/dependenciesAny/dependenciesFlatten.generated.js +0 -2
- package/lib/esm/entry/dependenciesAny/dependenciesSqueeze.generated.js +0 -2
- package/lib/esm/entry/impureFunctionsAny.generated.js +3 -3
- package/lib/esm/entry/pureFunctionsAny.generated.js +7 -9
- package/lib/esm/entry/typeChecks.js +1 -1
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +2 -2
- package/lib/esm/expression/embeddedDocs/function/arithmetic/hypot.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/matrix/diff.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/matrix/fft.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/matrix/ifft.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/matrix/kron.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/matrix/map.js +3 -3
- package/lib/esm/expression/embeddedDocs/function/special/zeta.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/statistics/quantileSeq.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/trigonometry/acoth.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/trigonometry/acsch.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/utils/clone.js +1 -1
- package/lib/esm/expression/function/compile.js +1 -1
- package/lib/esm/expression/function/evaluate.js +8 -3
- package/lib/esm/expression/node/FunctionNode.js +10 -2
- package/lib/esm/expression/parse.js +2 -2
- package/lib/esm/expression/transform/filter.transform.js +4 -4
- package/lib/esm/expression/transform/forEach.transform.js +4 -4
- package/lib/esm/expression/transform/map.transform.js +104 -37
- package/lib/esm/expression/transform/print.transform.js +2 -2
- package/lib/esm/expression/transform/utils/dimToZeroBase.js +16 -0
- package/lib/esm/expression/transform/utils/lastDimToZeroBase.js +4 -6
- package/lib/esm/function/algebra/decomposition/slu.js +1 -1
- package/lib/esm/function/algebra/derivative.js +15 -15
- package/lib/esm/function/algebra/lyap.js +4 -4
- package/lib/esm/function/algebra/simplify/util.js +3 -3
- package/lib/esm/function/algebra/simplifyConstant.js +9 -9
- package/lib/esm/function/algebra/solver/lsolve.js +3 -3
- package/lib/esm/function/algebra/solver/lsolveAll.js +3 -3
- package/lib/esm/function/algebra/solver/lusolve.js +5 -5
- package/lib/esm/function/algebra/solver/usolve.js +3 -3
- package/lib/esm/function/algebra/solver/usolveAll.js +3 -3
- package/lib/esm/function/algebra/sylvester.js +7 -7
- package/lib/esm/function/arithmetic/addScalar.js +4 -4
- package/lib/esm/function/arithmetic/ceil.js +6 -6
- package/lib/esm/function/arithmetic/divide.js +5 -5
- package/lib/esm/function/arithmetic/divideScalar.js +5 -5
- package/lib/esm/function/arithmetic/fix.js +5 -5
- package/lib/esm/function/arithmetic/floor.js +6 -6
- package/lib/esm/function/arithmetic/hypot.js +3 -3
- package/lib/esm/function/arithmetic/mod.js +3 -3
- package/lib/esm/function/arithmetic/multiply.js +7 -7
- package/lib/esm/function/arithmetic/multiplyScalar.js +4 -4
- package/lib/esm/function/arithmetic/norm.js +2 -2
- package/lib/esm/function/arithmetic/pow.js +6 -6
- package/lib/esm/function/arithmetic/round.js +7 -7
- package/lib/esm/function/arithmetic/subtractScalar.js +4 -4
- package/lib/esm/function/arithmetic/xgcd.js +1 -1
- package/lib/esm/function/combinatorics/bellNumbers.js +1 -1
- package/lib/esm/function/combinatorics/catalan.js +1 -1
- package/lib/esm/function/combinatorics/composition.js +1 -1
- package/lib/esm/function/combinatorics/stirlingS2.js +1 -1
- package/lib/esm/function/geometry/distance.js +4 -4
- package/lib/esm/function/geometry/intersect.js +2 -2
- package/lib/esm/function/logical/and.js +2 -2
- package/lib/esm/function/logical/or.js +2 -2
- package/lib/esm/function/logical/xor.js +2 -2
- package/lib/esm/function/matrix/apply.js +2 -2
- package/lib/esm/function/matrix/column.js +1 -1
- package/lib/esm/function/matrix/concat.js +1 -1
- package/lib/esm/function/matrix/count.js +1 -1
- package/lib/esm/function/matrix/cross.js +3 -3
- package/lib/esm/function/matrix/diag.js +10 -10
- package/lib/esm/function/matrix/diff.js +2 -2
- package/lib/esm/function/matrix/eigs.js +3 -3
- package/lib/esm/function/matrix/fft.js +3 -3
- package/lib/esm/function/matrix/filter.js +4 -4
- package/lib/esm/function/matrix/flatten.js +5 -6
- package/lib/esm/function/matrix/forEach.js +4 -4
- package/lib/esm/function/matrix/identity.js +6 -6
- package/lib/esm/function/matrix/ifft.js +3 -3
- package/lib/esm/function/matrix/inv.js +1 -1
- package/lib/esm/function/matrix/kron.js +7 -7
- package/lib/esm/function/matrix/map.js +110 -19
- package/lib/esm/function/matrix/matrixFromFunction.js +6 -6
- package/lib/esm/function/matrix/ones.js +2 -2
- package/lib/esm/function/matrix/partitionSelect.js +2 -2
- package/lib/esm/function/matrix/pinv.js +1 -1
- package/lib/esm/function/matrix/range.js +10 -10
- package/lib/esm/function/matrix/reshape.js +2 -2
- package/lib/esm/function/matrix/rotate.js +4 -4
- package/lib/esm/function/matrix/rotationMatrix.js +6 -6
- package/lib/esm/function/matrix/row.js +1 -1
- package/lib/esm/function/matrix/size.js +8 -8
- package/lib/esm/function/matrix/sort.js +4 -4
- package/lib/esm/function/matrix/sqrtm.js +1 -1
- package/lib/esm/function/matrix/squeeze.js +3 -4
- package/lib/esm/function/matrix/subset.js +2 -2
- package/lib/esm/function/matrix/zeros.js +2 -2
- package/lib/esm/function/probability/combinations.js +1 -1
- package/lib/esm/function/probability/combinationsWithRep.js +2 -2
- package/lib/esm/function/probability/kldivergence.js +4 -4
- package/lib/esm/function/probability/multinomial.js +1 -1
- package/lib/esm/function/probability/permutations.js +2 -2
- package/lib/esm/function/probability/pickRandom.js +6 -6
- package/lib/esm/function/probability/random.js +1 -1
- package/lib/esm/function/probability/randomInt.js +1 -1
- package/lib/esm/function/relational/compare.js +6 -6
- package/lib/esm/function/relational/deepEqual.js +1 -1
- package/lib/esm/function/relational/equal.js +1 -1
- package/lib/esm/function/relational/equalScalar.js +7 -7
- package/lib/esm/function/relational/equalText.js +1 -1
- package/lib/esm/function/relational/larger.js +3 -3
- package/lib/esm/function/relational/largerEq.js +4 -4
- package/lib/esm/function/relational/smaller.js +3 -3
- package/lib/esm/function/relational/smallerEq.js +3 -3
- package/lib/esm/function/relational/unequal.js +1 -1
- package/lib/esm/function/set/setCartesian.js +1 -1
- package/lib/esm/function/set/setDifference.js +1 -1
- package/lib/esm/function/set/setDistinct.js +1 -1
- package/lib/esm/function/set/setIntersect.js +1 -1
- package/lib/esm/function/set/setIsSubset.js +1 -1
- package/lib/esm/function/set/setMultiplicity.js +1 -1
- package/lib/esm/function/set/setPowerset.js +1 -1
- package/lib/esm/function/set/setSize.js +2 -2
- package/lib/esm/function/set/setSymDifference.js +1 -1
- package/lib/esm/function/set/setUnion.js +1 -1
- package/lib/esm/function/signal/freqz.js +6 -6
- package/lib/esm/function/statistics/corr.js +2 -2
- package/lib/esm/function/statistics/cumsum.js +3 -3
- package/lib/esm/function/statistics/max.js +1 -1
- package/lib/esm/function/statistics/median.js +3 -3
- package/lib/esm/function/statistics/min.js +1 -1
- package/lib/esm/function/statistics/prod.js +1 -1
- package/lib/esm/function/statistics/variance.js +2 -2
- package/lib/esm/function/string/bin.js +2 -2
- package/lib/esm/function/string/hex.js +2 -2
- package/lib/esm/function/string/oct.js +2 -2
- package/lib/esm/function/trigonometry/acoth.js +2 -2
- package/lib/esm/function/trigonometry/acsch.js +2 -2
- package/lib/esm/type/bigint.js +1 -1
- package/lib/esm/type/complex/function/complex.js +2 -2
- package/lib/esm/type/fraction/function/fraction.js +1 -1
- package/lib/esm/type/matrix/DenseMatrix.js +13 -38
- package/lib/esm/type/matrix/SparseMatrix.js +5 -8
- package/lib/esm/type/matrix/function/index.js +1 -1
- package/lib/esm/type/matrix/function/matrix.js +1 -1
- package/lib/esm/type/matrix/function/sparse.js +2 -2
- package/lib/esm/type/number.js +1 -1
- package/lib/esm/type/unit/function/createUnit.js +3 -3
- package/lib/esm/type/unit/function/splitUnit.js +1 -1
- package/lib/esm/type/unit/function/unit.js +2 -2
- package/lib/esm/utils/array.js +26 -0
- package/lib/esm/utils/collection.js +1 -1
- package/lib/esm/utils/customs.js +5 -12
- package/lib/esm/utils/function.js +0 -13
- package/lib/esm/utils/is.js +24 -0
- package/lib/esm/utils/map.js +7 -22
- package/lib/esm/version.js +1 -1
- package/package.json +13 -13
- package/types/index.d.ts +57 -18
package/lib/esm/utils/is.js
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
// for security reasons, so these functions are not exposed in the expression
|
13
13
|
// parser.
|
14
14
|
|
15
|
+
import { ObjectWrappingMap } from './map.js';
|
15
16
|
export function isNumber(x) {
|
16
17
|
return typeof x === 'number';
|
17
18
|
}
|
@@ -88,6 +89,29 @@ export function isRegExp(x) {
|
|
88
89
|
export function isObject(x) {
|
89
90
|
return !!(x && typeof x === 'object' && x.constructor === Object && !isComplex(x) && !isFraction(x));
|
90
91
|
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Returns `true` if the passed object appears to be a Map (i.e. duck typing).
|
95
|
+
*
|
96
|
+
* Methods looked for are `get`, `set`, `keys` and `has`.
|
97
|
+
*
|
98
|
+
* @param {Map | object} object
|
99
|
+
* @returns
|
100
|
+
*/
|
101
|
+
export function isMap(object) {
|
102
|
+
// We can use the fast instanceof, or a slower duck typing check.
|
103
|
+
// The duck typing method needs to cover enough methods to not be confused with DenseMatrix.
|
104
|
+
if (!object) {
|
105
|
+
return false;
|
106
|
+
}
|
107
|
+
return object instanceof Map || object instanceof ObjectWrappingMap || typeof object.set === 'function' && typeof object.get === 'function' && typeof object.keys === 'function' && typeof object.has === 'function';
|
108
|
+
}
|
109
|
+
export function isPartitionedMap(object) {
|
110
|
+
return isMap(object) && isMap(object.a) && isMap(object.b);
|
111
|
+
}
|
112
|
+
export function isObjectWrappingMap(object) {
|
113
|
+
return isMap(object) && isObject(object.wrappedObject);
|
114
|
+
}
|
91
115
|
export function isNull(x) {
|
92
116
|
return x === null;
|
93
117
|
}
|
package/lib/esm/utils/map.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import { isObject } from './is.js';
|
1
|
+
import { getSafeProperty, isSafeProperty, setSafeProperty } from './customs.js';
|
2
|
+
import { isMap, isObject } from './is.js';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* A map facade on a bare object.
|
@@ -15,7 +15,7 @@ export class ObjectWrappingMap {
|
|
15
15
|
this[Symbol.iterator] = this.entries;
|
16
16
|
}
|
17
17
|
keys() {
|
18
|
-
return Object.keys(this.wrappedObject).values();
|
18
|
+
return Object.keys(this.wrappedObject).filter(key => this.has(key)).values();
|
19
19
|
}
|
20
20
|
get(key) {
|
21
21
|
return getSafeProperty(this.wrappedObject, key);
|
@@ -25,7 +25,7 @@ export class ObjectWrappingMap {
|
|
25
25
|
return this;
|
26
26
|
}
|
27
27
|
has(key) {
|
28
|
-
return
|
28
|
+
return isSafeProperty(this.wrappedObject, key) && key in this.wrappedObject;
|
29
29
|
}
|
30
30
|
entries() {
|
31
31
|
return mapIterator(this.keys(), key => [key, this.get(key)]);
|
@@ -36,7 +36,9 @@ export class ObjectWrappingMap {
|
|
36
36
|
}
|
37
37
|
}
|
38
38
|
delete(key) {
|
39
|
-
|
39
|
+
if (isSafeProperty(this.wrappedObject, key)) {
|
40
|
+
delete this.wrappedObject[key];
|
41
|
+
}
|
40
42
|
}
|
41
43
|
clear() {
|
42
44
|
for (var key of this.keys()) {
|
@@ -172,23 +174,6 @@ export function toObject(map) {
|
|
172
174
|
return object;
|
173
175
|
}
|
174
176
|
|
175
|
-
/**
|
176
|
-
* Returns `true` if the passed object appears to be a Map (i.e. duck typing).
|
177
|
-
*
|
178
|
-
* Methods looked for are `get`, `set`, `keys` and `has`.
|
179
|
-
*
|
180
|
-
* @param {Map | object} object
|
181
|
-
* @returns
|
182
|
-
*/
|
183
|
-
export function isMap(object) {
|
184
|
-
// We can use the fast instanceof, or a slower duck typing check.
|
185
|
-
// The duck typing method needs to cover enough methods to not be confused with DenseMatrix.
|
186
|
-
if (!object) {
|
187
|
-
return false;
|
188
|
-
}
|
189
|
-
return object instanceof Map || object instanceof ObjectWrappingMap || typeof object.set === 'function' && typeof object.get === 'function' && typeof object.keys === 'function' && typeof object.has === 'function';
|
190
|
-
}
|
191
|
-
|
192
177
|
/**
|
193
178
|
* Copies the contents of key-value pairs from each `objects` in to `map`.
|
194
179
|
*
|
package/lib/esm/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "13.
|
3
|
+
"version": "13.1.1",
|
4
4
|
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
|
5
5
|
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
|
6
6
|
"homepage": "https://mathjs.org",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"unit"
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
|
-
"@babel/runtime": "^7.
|
28
|
+
"@babel/runtime": "^7.25.4",
|
29
29
|
"complex.js": "^2.1.1",
|
30
30
|
"decimal.js": "^10.4.3",
|
31
31
|
"escape-latex": "^1.2.0",
|
@@ -36,11 +36,11 @@
|
|
36
36
|
"typed-function": "^4.2.1"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.
|
39
|
+
"@babel/core": "7.25.2",
|
40
40
|
"@babel/plugin-transform-object-assign": "7.24.7",
|
41
41
|
"@babel/plugin-transform-optional-catch-binding": "7.24.7",
|
42
|
-
"@babel/plugin-transform-runtime": "7.
|
43
|
-
"@babel/preset-env": "7.
|
42
|
+
"@babel/plugin-transform-runtime": "7.25.4",
|
43
|
+
"@babel/preset-env": "7.25.4",
|
44
44
|
"@babel/register": "7.24.6",
|
45
45
|
"@types/assert": "1.5.10",
|
46
46
|
"@types/mocha": "10.0.7",
|
@@ -51,18 +51,18 @@
|
|
51
51
|
"benchmark": "2.1.4",
|
52
52
|
"c8": "10.1.2",
|
53
53
|
"codecov": "3.8.3",
|
54
|
-
"core-js": "3.
|
54
|
+
"core-js": "3.38.1",
|
55
55
|
"del": "7.1.0",
|
56
56
|
"dtslint": "4.2.1",
|
57
57
|
"eslint": "8.57.0",
|
58
58
|
"eslint-config-prettier": "9.1.0",
|
59
59
|
"eslint-config-standard": "17.1.0",
|
60
60
|
"eslint-plugin-import": "2.29.1",
|
61
|
-
"eslint-plugin-mocha": "10.
|
61
|
+
"eslint-plugin-mocha": "10.5.0",
|
62
62
|
"eslint-plugin-n": "16.6.2",
|
63
63
|
"eslint-plugin-prettier": "5.2.1",
|
64
|
-
"eslint-plugin-promise": "6.
|
65
|
-
"expect-type": "0.
|
64
|
+
"eslint-plugin-promise": "6.6.0",
|
65
|
+
"expect-type": "0.20.0",
|
66
66
|
"expr-eval": "2.0.2",
|
67
67
|
"fancy-log": "2.0.0",
|
68
68
|
"glob": "11.0.0",
|
@@ -70,14 +70,14 @@
|
|
70
70
|
"gulp-babel": "8.0.0",
|
71
71
|
"handlebars": "4.7.8",
|
72
72
|
"jsep": "1.3.9",
|
73
|
-
"karma": "6.4.
|
73
|
+
"karma": "6.4.4",
|
74
74
|
"karma-browserstack-launcher": "1.6.0",
|
75
75
|
"karma-firefox-launcher": "2.1.3",
|
76
76
|
"karma-mocha": "2.0.1",
|
77
77
|
"karma-mocha-reporter": "2.2.5",
|
78
78
|
"karma-webpack": "5.0.1",
|
79
79
|
"mkdirp": "3.0.1",
|
80
|
-
"mocha": "10.
|
80
|
+
"mocha": "10.7.3",
|
81
81
|
"mocha-junit-reporter": "2.2.1",
|
82
82
|
"ndarray": "1.0.19",
|
83
83
|
"ndarray-determinant": "1.0.0",
|
@@ -91,8 +91,8 @@
|
|
91
91
|
"sinon": "18.0.0",
|
92
92
|
"sylvester": "0.0.21",
|
93
93
|
"ts-node": "10.9.2",
|
94
|
-
"typescript": "5.5.
|
95
|
-
"webpack": "5.
|
94
|
+
"typescript": "5.5.4",
|
95
|
+
"webpack": "5.94.0",
|
96
96
|
"zeros": "1.0.0"
|
97
97
|
},
|
98
98
|
"type": "module",
|
package/types/index.d.ts
CHANGED
@@ -1245,9 +1245,9 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1245
1245
|
gcd<T extends number | BigNumber | Fraction | Matrix>(args: T[]): T
|
1246
1246
|
|
1247
1247
|
/**
|
1248
|
-
* Calculate the
|
1248
|
+
* Calculate the hypotenuse of a list with values. The hypotenuse is
|
1249
1249
|
* defined as: hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) For
|
1250
|
-
* matrix input, the
|
1250
|
+
* matrix input, the hypotenuse is calculated for all values in the
|
1251
1251
|
* matrix.
|
1252
1252
|
* @param args A list with numeric values or an Array or Matrix. Matrix
|
1253
1253
|
* and Array input is flattened and returns a single number for the
|
@@ -1948,10 +1948,10 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1948
1948
|
inv<T extends number | Complex | MathCollection>(x: T): NoLiteralType<T>
|
1949
1949
|
|
1950
1950
|
/**
|
1951
|
-
* Calculate the
|
1951
|
+
* Calculate the Kronecker product of two matrices or vectors
|
1952
1952
|
* @param x First vector
|
1953
1953
|
* @param y Second vector
|
1954
|
-
* @returns Returns the
|
1954
|
+
* @returns Returns the Kronecker product of x and y
|
1955
1955
|
*/
|
1956
1956
|
kron(x: MathCollection, y: MathCollection): Matrix
|
1957
1957
|
|
@@ -1967,7 +1967,29 @@ export interface MathJsInstance extends MathJsFactory {
|
|
1967
1967
|
map<T extends MathCollection>(
|
1968
1968
|
x: T,
|
1969
1969
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1970
|
-
callback: (value: any, index:
|
1970
|
+
callback: (value: any, index: number[], matrix: T) => MathType | string
|
1971
|
+
): T
|
1972
|
+
|
1973
|
+
/**
|
1974
|
+
* Iterate over all elements of multiple matrices/arrays, and executes the given
|
1975
|
+
* callback function.
|
1976
|
+
* @param x The first matrix to iterate on.
|
1977
|
+
* @param args The rest of the matrices and at the end the callback function is invoked with multiple
|
1978
|
+
* parameters: the values of the elements, the indices of the elements, and
|
1979
|
+
* the matrices/arrays being traversed.
|
1980
|
+
* @returns Transformed map of matrices
|
1981
|
+
*/
|
1982
|
+
map<T extends MathCollection>(
|
1983
|
+
x: T,
|
1984
|
+
...args: Array<
|
1985
|
+
| T
|
1986
|
+
| ((
|
1987
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1988
|
+
value: any,
|
1989
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1990
|
+
...args: Array<any | number[] | T>
|
1991
|
+
) => MathType | string)
|
1992
|
+
>
|
1971
1993
|
): T
|
1972
1994
|
|
1973
1995
|
/**
|
@@ -2241,16 +2263,16 @@ export interface MathJsInstance extends MathJsFactory {
|
|
2241
2263
|
**/
|
2242
2264
|
|
2243
2265
|
/**
|
2244
|
-
* Calculate N-dimensional
|
2266
|
+
* Calculate N-dimensional Fourier transform
|
2245
2267
|
* @param {Array | Matrix} arr An array or matrix
|
2246
|
-
* @return {Array | Matrix} N-dimensional
|
2268
|
+
* @return {Array | Matrix} N-dimensional Fourier transformation of the array
|
2247
2269
|
*/
|
2248
2270
|
fft<T extends MathCollection>(arr: T): T
|
2249
2271
|
|
2250
2272
|
/**
|
2251
|
-
* Calculate N-dimensional inverse
|
2273
|
+
* Calculate N-dimensional inverse Fourier transform
|
2252
2274
|
* @param {Array | Matrix} arr An array or matrix
|
2253
|
-
* @return {Array | Matrix} N-dimensional
|
2275
|
+
* @return {Array | Matrix} N-dimensional Fourier transformation of the array
|
2254
2276
|
*/
|
2255
2277
|
ifft<T extends MathCollection>(arr: T): T
|
2256
2278
|
|
@@ -3136,10 +3158,10 @@ export interface MathJsInstance extends MathJsFactory {
|
|
3136
3158
|
acot<T extends BigNumber | Complex>(x: T): T
|
3137
3159
|
|
3138
3160
|
/**
|
3139
|
-
* Calculate the hyperbolic
|
3161
|
+
* Calculate the inverse hyperbolic tangent of a value, defined as acoth(x)
|
3140
3162
|
* = (ln((x+1)/x) + ln(x/(x-1))) / 2.
|
3141
3163
|
* @param x Function input
|
3142
|
-
* @returns The hyperbolic
|
3164
|
+
* @returns The inverse hyperbolic tangent of x
|
3143
3165
|
*/
|
3144
3166
|
acoth(x: number): number
|
3145
3167
|
acoth<T extends BigNumber | Complex>(x: T): T
|
@@ -3153,10 +3175,10 @@ export interface MathJsInstance extends MathJsFactory {
|
|
3153
3175
|
acsc<T extends BigNumber | Complex>(x: T): T
|
3154
3176
|
|
3155
3177
|
/**
|
3156
|
-
* Calculate the hyperbolic
|
3178
|
+
* Calculate the inverse hyperbolic cosecant of a value, defined as acsch(x)
|
3157
3179
|
* = ln(1/x + sqrt(1/x^2 + 1)).
|
3158
3180
|
* @param x Function input
|
3159
|
-
* @returns The hyperbolic
|
3181
|
+
* @returns The inverse hyperbolic cosecant of x
|
3160
3182
|
*/
|
3161
3183
|
acsch(x: number): number
|
3162
3184
|
acsch<T extends BigNumber | Complex>(x: T): T
|
@@ -3381,6 +3403,14 @@ export interface MathJsInstance extends MathJsFactory {
|
|
3381
3403
|
|
3382
3404
|
isObject(x: unknown): boolean
|
3383
3405
|
|
3406
|
+
isMap<T, U>(x: unknown): x is Map<T, U>
|
3407
|
+
|
3408
|
+
isPartitionedMap<T, U>(x: unknown): x is PartitionedMap<T, U>
|
3409
|
+
|
3410
|
+
isObjectWrappingMap<T extends string | number | symbol, U>(
|
3411
|
+
x: unknown
|
3412
|
+
): x is ObjectWrappingMap<T, U>
|
3413
|
+
|
3384
3414
|
isNull(x: unknown): x is null
|
3385
3415
|
|
3386
3416
|
isUndefined(x: unknown): x is undefined
|
@@ -4157,6 +4187,15 @@ export interface UnitDefinition {
|
|
4157
4187
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
4158
4188
|
export interface Index {}
|
4159
4189
|
|
4190
|
+
export interface PartitionedMap<T, U> {
|
4191
|
+
a: Map<T, U>
|
4192
|
+
b: Map<T, U>
|
4193
|
+
}
|
4194
|
+
|
4195
|
+
export interface ObjectWrappingMap<T extends string | number | symbol, U> {
|
4196
|
+
wrappedObject: Record<T, U>
|
4197
|
+
}
|
4198
|
+
|
4160
4199
|
export interface EvalFunction {
|
4161
4200
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
4162
4201
|
evaluate(scope?: any): any
|
@@ -5059,9 +5098,9 @@ export interface MathJsChain<TValue> {
|
|
5059
5098
|
): MathJsChain<T>
|
5060
5099
|
|
5061
5100
|
/**
|
5062
|
-
* Calculate the
|
5101
|
+
* Calculate the hypotenuse of a list with values. The hypotenuse is
|
5063
5102
|
* defined as: hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) For
|
5064
|
-
* matrix input, the
|
5103
|
+
* matrix input, the hypotenuse is calculated for all values in the
|
5065
5104
|
* matrix.
|
5066
5105
|
*/
|
5067
5106
|
hypot<T extends number | BigNumber>(this: MathJsChain<T[]>): MathJsChain<T>
|
@@ -5670,7 +5709,7 @@ export interface MathJsChain<TValue> {
|
|
5670
5709
|
): MathJsChain<NoLiteralType<T>>
|
5671
5710
|
|
5672
5711
|
/**
|
5673
|
-
* Calculate the
|
5712
|
+
* Calculate the Kronecker product of two matrices or vectors
|
5674
5713
|
* @param y Second vector
|
5675
5714
|
*/
|
5676
5715
|
kron(
|
@@ -6528,7 +6567,7 @@ export interface MathJsChain<TValue> {
|
|
6528
6567
|
): MathJsChain<T>
|
6529
6568
|
|
6530
6569
|
/**
|
6531
|
-
* Calculate the hyperbolic
|
6570
|
+
* Calculate the inverse hyperbolic tangent of a value, defined as acoth(x)
|
6532
6571
|
* = (ln((x+1)/x) + ln(x/(x-1))) / 2. For matrices, the function is
|
6533
6572
|
* evaluated element wise.
|
6534
6573
|
*/
|
@@ -6547,7 +6586,7 @@ export interface MathJsChain<TValue> {
|
|
6547
6586
|
): MathJsChain<T>
|
6548
6587
|
|
6549
6588
|
/**
|
6550
|
-
* Calculate the hyperbolic
|
6589
|
+
* Calculate the inverse hyperbolic cosecant of a value, defined as acsch(x)
|
6551
6590
|
* = ln(1/x + sqrt(1/x^2 + 1)). For matrices, the function is evaluated
|
6552
6591
|
* element wise.
|
6553
6592
|
*/
|