mathjs 13.0.3 → 13.1.0
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 +17 -1
- 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 +1 -1
- 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/function.js +0 -14
- package/lib/cjs/utils/is.js +27 -0
- package/lib/cjs/utils/map.js +2 -20
- 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 +1 -1
- 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/function.js +0 -13
- package/lib/esm/utils/is.js +24 -0
- package/lib/esm/utils/map.js +2 -19
- package/lib/esm/version.js +1 -1
- package/package.json +13 -13
- package/types/index.d.ts +57 -18
package/lib/cjs/utils/is.js
CHANGED
|
@@ -25,14 +25,17 @@ exports.isFunctionNode = isFunctionNode;
|
|
|
25
25
|
exports.isHelp = isHelp;
|
|
26
26
|
exports.isIndex = isIndex;
|
|
27
27
|
exports.isIndexNode = isIndexNode;
|
|
28
|
+
exports.isMap = isMap;
|
|
28
29
|
exports.isMatrix = isMatrix;
|
|
29
30
|
exports.isNode = isNode;
|
|
30
31
|
exports.isNull = isNull;
|
|
31
32
|
exports.isNumber = isNumber;
|
|
32
33
|
exports.isObject = isObject;
|
|
33
34
|
exports.isObjectNode = isObjectNode;
|
|
35
|
+
exports.isObjectWrappingMap = isObjectWrappingMap;
|
|
34
36
|
exports.isOperatorNode = isOperatorNode;
|
|
35
37
|
exports.isParenthesisNode = isParenthesisNode;
|
|
38
|
+
exports.isPartitionedMap = isPartitionedMap;
|
|
36
39
|
exports.isRange = isRange;
|
|
37
40
|
exports.isRangeNode = isRangeNode;
|
|
38
41
|
exports.isRegExp = isRegExp;
|
|
@@ -45,6 +48,7 @@ exports.isUndefined = isUndefined;
|
|
|
45
48
|
exports.isUnit = isUnit;
|
|
46
49
|
exports.rule2Node = rule2Node;
|
|
47
50
|
exports.typeOf = typeOf;
|
|
51
|
+
var _map = require("./map.js");
|
|
48
52
|
// type checks for all known types
|
|
49
53
|
//
|
|
50
54
|
// note that:
|
|
@@ -135,6 +139,29 @@ function isRegExp(x) {
|
|
|
135
139
|
function isObject(x) {
|
|
136
140
|
return !!(x && typeof x === 'object' && x.constructor === Object && !isComplex(x) && !isFraction(x));
|
|
137
141
|
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Returns `true` if the passed object appears to be a Map (i.e. duck typing).
|
|
145
|
+
*
|
|
146
|
+
* Methods looked for are `get`, `set`, `keys` and `has`.
|
|
147
|
+
*
|
|
148
|
+
* @param {Map | object} object
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
function isMap(object) {
|
|
152
|
+
// We can use the fast instanceof, or a slower duck typing check.
|
|
153
|
+
// The duck typing method needs to cover enough methods to not be confused with DenseMatrix.
|
|
154
|
+
if (!object) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
return object instanceof Map || object instanceof _map.ObjectWrappingMap || typeof object.set === 'function' && typeof object.get === 'function' && typeof object.keys === 'function' && typeof object.has === 'function';
|
|
158
|
+
}
|
|
159
|
+
function isPartitionedMap(object) {
|
|
160
|
+
return isMap(object) && isMap(object.a) && isMap(object.b);
|
|
161
|
+
}
|
|
162
|
+
function isObjectWrappingMap(object) {
|
|
163
|
+
return isMap(object) && isObject(object.wrappedObject);
|
|
164
|
+
}
|
|
138
165
|
function isNull(x) {
|
|
139
166
|
return x === null;
|
|
140
167
|
}
|
package/lib/cjs/utils/map.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.PartitionedMap = exports.ObjectWrappingMap = void 0;
|
|
|
7
7
|
exports.assign = assign;
|
|
8
8
|
exports.createEmptyMap = createEmptyMap;
|
|
9
9
|
exports.createMap = createMap;
|
|
10
|
-
exports.isMap = isMap;
|
|
11
10
|
exports.toObject = toObject;
|
|
12
11
|
var _customs = require("./customs.js");
|
|
13
12
|
var _is = require("./is.js");
|
|
@@ -157,7 +156,7 @@ function createMap(mapOrObject) {
|
|
|
157
156
|
if (!mapOrObject) {
|
|
158
157
|
return createEmptyMap();
|
|
159
158
|
}
|
|
160
|
-
if (isMap(mapOrObject)) {
|
|
159
|
+
if ((0, _is.isMap)(mapOrObject)) {
|
|
161
160
|
return mapOrObject;
|
|
162
161
|
}
|
|
163
162
|
if ((0, _is.isObject)(mapOrObject)) {
|
|
@@ -184,23 +183,6 @@ function toObject(map) {
|
|
|
184
183
|
return object;
|
|
185
184
|
}
|
|
186
185
|
|
|
187
|
-
/**
|
|
188
|
-
* Returns `true` if the passed object appears to be a Map (i.e. duck typing).
|
|
189
|
-
*
|
|
190
|
-
* Methods looked for are `get`, `set`, `keys` and `has`.
|
|
191
|
-
*
|
|
192
|
-
* @param {Map | object} object
|
|
193
|
-
* @returns
|
|
194
|
-
*/
|
|
195
|
-
function isMap(object) {
|
|
196
|
-
// We can use the fast instanceof, or a slower duck typing check.
|
|
197
|
-
// The duck typing method needs to cover enough methods to not be confused with DenseMatrix.
|
|
198
|
-
if (!object) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
return object instanceof Map || object instanceof ObjectWrappingMap || typeof object.set === 'function' && typeof object.get === 'function' && typeof object.keys === 'function' && typeof object.has === 'function';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
186
|
/**
|
|
205
187
|
* Copies the contents of key-value pairs from each `objects` in to `map`.
|
|
206
188
|
*
|
|
@@ -216,7 +198,7 @@ function assign(map) {
|
|
|
216
198
|
if (!args) {
|
|
217
199
|
continue;
|
|
218
200
|
}
|
|
219
|
-
if (isMap(args)) {
|
|
201
|
+
if ((0, _is.isMap)(args)) {
|
|
220
202
|
for (const key of args.keys()) {
|
|
221
203
|
map.set(key, args.get(key));
|
|
222
204
|
}
|
package/lib/cjs/version.js
CHANGED
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.version = void 0;
|
|
7
|
-
const version = exports.version = '13.0
|
|
7
|
+
const version = exports.version = '13.1.0';
|
|
8
8
|
// Note: This file is automatically generated when building math.js.
|
|
9
9
|
// Changes made in this file will be overwritten.
|
package/lib/esm/core/create.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import typedFunction from 'typed-function';
|
|
3
|
-
import { deepFlatten, isLegacyFactory } from '../utils/object.js';
|
|
4
|
-
import * as emitter from './../utils/emitter.js';
|
|
5
|
-
import { importFactory } from './function/import.js';
|
|
6
|
-
import { configFactory } from './function/config.js';
|
|
7
|
-
import { factory, isFactory } from '../utils/factory.js';
|
|
8
|
-
import { isAccessorNode, isArray, isArrayNode, isAssignmentNode, isBigNumber, isBlockNode, isBoolean, isChain, isCollection, isComplex, isConditionalNode, isConstantNode, isDate, isDenseMatrix, isFraction, isFunction, isFunctionAssignmentNode, isFunctionNode, isHelp, isIndex, isIndexNode, isMatrix, isNode, isNull, isNumber, isObject, isObjectNode, isOperatorNode, isParenthesisNode, isRange, isRangeNode, isRelationalNode, isRegExp, isResultSet, isSparseMatrix, isString, isSymbolNode, isUndefined, isUnit, isBigInt } from '../utils/is.js';
|
|
9
3
|
import { ArgumentsError } from '../error/ArgumentsError.js';
|
|
10
4
|
import { DimensionError } from '../error/DimensionError.js';
|
|
11
5
|
import { IndexError } from '../error/IndexError.js';
|
|
6
|
+
import { factory, isFactory } from '../utils/factory.js';
|
|
7
|
+
import { isAccessorNode, isArray, isArrayNode, isAssignmentNode, isBigInt, isBigNumber, isBlockNode, isBoolean, isChain, isCollection, isComplex, isConditionalNode, isConstantNode, isDate, isDenseMatrix, isFraction, isFunction, isFunctionAssignmentNode, isFunctionNode, isHelp, isIndex, isIndexNode, isMap, isMatrix, isNode, isNull, isNumber, isObject, isObjectNode, isObjectWrappingMap, isOperatorNode, isParenthesisNode, isPartitionedMap, isRange, isRangeNode, isRegExp, isRelationalNode, isResultSet, isSparseMatrix, isString, isSymbolNode, isUndefined, isUnit } from '../utils/is.js';
|
|
8
|
+
import { deepFlatten, isLegacyFactory } from '../utils/object.js';
|
|
9
|
+
import * as emitter from './../utils/emitter.js';
|
|
12
10
|
import { DEFAULT_CONFIG } from './config.js';
|
|
11
|
+
import { configFactory } from './function/config.js';
|
|
12
|
+
import { importFactory } from './function/import.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Create a mathjs instance from given factory functions and optionally config
|
|
@@ -85,6 +85,9 @@ export function create(factories, config) {
|
|
|
85
85
|
isDate,
|
|
86
86
|
isRegExp,
|
|
87
87
|
isObject,
|
|
88
|
+
isMap,
|
|
89
|
+
isPartitionedMap,
|
|
90
|
+
isObjectWrappingMap,
|
|
88
91
|
isNull,
|
|
89
92
|
isUndefined,
|
|
90
93
|
isAccessorNode,
|
|
@@ -36,11 +36,10 @@
|
|
|
36
36
|
* @returns {function} The created typed-function.
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
import { isAccessorNode, isArray, isArrayNode, isAssignmentNode, isBigNumber, isBlockNode, isBoolean, isChain, isCollection, isComplex, isConditionalNode, isConstantNode, isDate, isDenseMatrix, isFraction, isFunction, isFunctionAssignmentNode, isFunctionNode, isHelp, isIndex, isIndexNode, isMatrix, isNode, isNull, isNumber, isObject, isObjectNode, isOperatorNode, isParenthesisNode, isRange, isRangeNode, isRelationalNode, isRegExp, isResultSet, isSparseMatrix, isString, isSymbolNode, isUndefined, isUnit, isBigInt } from '../../utils/is.js';
|
|
40
39
|
import typedFunction from 'typed-function';
|
|
41
|
-
import { digits } from '../../utils/number.js';
|
|
42
40
|
import { factory } from '../../utils/factory.js';
|
|
43
|
-
import { isMap } from '../../utils/
|
|
41
|
+
import { isAccessorNode, isArray, isArrayNode, isAssignmentNode, isBigInt, isBigNumber, isBlockNode, isBoolean, isChain, isCollection, isComplex, isConditionalNode, isConstantNode, isDate, isDenseMatrix, isFraction, isFunction, isFunctionAssignmentNode, isFunctionNode, isHelp, isIndex, isIndexNode, isMap, isMatrix, isNode, isNull, isNumber, isObject, isObjectNode, isOperatorNode, isParenthesisNode, isRange, isRangeNode, isRegExp, isRelationalNode, isResultSet, isSparseMatrix, isString, isSymbolNode, isUndefined, isUnit } from '../../utils/is.js';
|
|
42
|
+
import { digits } from '../../utils/number.js';
|
|
44
43
|
|
|
45
44
|
// returns a new instance of typed-function
|
|
46
45
|
var _createTyped2 = function _createTyped() {
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* THIS FILE IS AUTO-GENERATED
|
|
3
3
|
* DON'T MAKE CHANGES HERE
|
|
4
4
|
*/
|
|
5
|
-
import { matrixDependencies } from './dependenciesMatrix.generated.js';
|
|
6
5
|
import { typedDependencies } from './dependenciesTyped.generated.js';
|
|
7
6
|
import { createFlatten } from '../../factoriesAny.js';
|
|
8
7
|
export var flattenDependencies = {
|
|
9
|
-
matrixDependencies,
|
|
10
8
|
typedDependencies,
|
|
11
9
|
createFlatten
|
|
12
10
|
};
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* THIS FILE IS AUTO-GENERATED
|
|
3
3
|
* DON'T MAKE CHANGES HERE
|
|
4
4
|
*/
|
|
5
|
-
import { matrixDependencies } from './dependenciesMatrix.generated.js';
|
|
6
5
|
import { typedDependencies } from './dependenciesTyped.generated.js';
|
|
7
6
|
import { createSqueeze } from '../../factoriesAny.js';
|
|
8
7
|
export var squeezeDependencies = {
|
|
9
|
-
matrixDependencies,
|
|
10
8
|
typedDependencies,
|
|
11
9
|
createSqueeze
|
|
12
10
|
};
|
|
@@ -7,7 +7,7 @@ import { config } from './configReadonly.js';
|
|
|
7
7
|
import { createNode, createObjectNode, createOperatorNode, createParenthesisNode, createRelationalNode, createArrayNode, createBlockNode, createConditionalNode, createConstantNode, createRangeNode, createReviver, createChainClass, createFunctionAssignmentNode, createChain, createIndexNode, createAccessorNode, createAssignmentNode, createSymbolNode, createFunctionNode, createParse, createResolve, createSimplifyConstant, createCompile, createSimplifyCore, createEvaluate, createHelpClass, createParserClass, createSimplify, createSymbolicEqual, createLeafCount, createParser, createRationalize, createDerivative, createHelp, createFilterTransform, createForEachTransform, createMapTransform, createApplyTransform, createOrTransform, createAndTransform, createConcatTransform, createMaxTransform, createPrintTransform, createBitAndTransform, createDiffTransform, createMinTransform, createSubsetTransform, createBitOrTransform, createCumSumTransform, createIndexTransform, createSumTransform, createRangeTransform, createRowTransform, createColumnTransform, createMeanTransform, createQuantileSeqTransform, createVarianceTransform, createStdTransform } from '../factoriesAny.js';
|
|
8
8
|
import { BigNumber, Complex, e, _false, fineStructure, Fraction, i, _Infinity, LN10, LOG10E, Matrix, _NaN, _null, phi, Range, ResultSet, SQRT1_2,
|
|
9
9
|
// eslint-disable-line camelcase
|
|
10
|
-
sackurTetrode, tau, _true, version, DenseMatrix, efimovFactor, LN2, pi, replacer, SQRT2, typed, weakMixingAngle, abs, acos, acot, acsc, addScalar, arg, asech, asinh, atan, atanh, bigint, bitNot, boolean, clone, combinations, complex, conj, cos, cot, csc, cube, equalScalar, erf, exp, expm1, filter, forEach, format, getMatrixDataType, hex, im, isInteger, isNegative, isPositive, isZero, LOG2E, lgamma, log10, log2, map, multiplyScalar, not, number, oct, pickRandom, print, random, re, sec, sign, sin, SparseMatrix, splitUnit, square, string, subtractScalar, tan, typeOf, acosh, acsch, apply, asec, bignumber, combinationsWithRep, cosh, csch, isNaN, isPrime, randomInt, sech, sinh, sparse, sqrt, tanh, unaryMinus, acoth, bin, coth, fraction, isNumeric, matrix, matrixFromFunction, mode, numeric, prod, reshape, size,
|
|
10
|
+
sackurTetrode, tau, _true, version, DenseMatrix, efimovFactor, LN2, pi, replacer, SQRT2, typed, weakMixingAngle, abs, acos, acot, acsc, addScalar, arg, asech, asinh, atan, atanh, bigint, bitNot, boolean, clone, combinations, complex, conj, cos, cot, csc, cube, equalScalar, erf, exp, expm1, filter, flatten, forEach, format, getMatrixDataType, hex, im, isInteger, isNegative, isPositive, isZero, LOG2E, lgamma, log10, log2, map, multiplyScalar, not, number, oct, pickRandom, print, random, re, sec, sign, sin, SparseMatrix, splitUnit, square, string, subtractScalar, tan, typeOf, acosh, acsch, apply, asec, bignumber, combinationsWithRep, cosh, csch, isNaN, isPrime, randomInt, sech, sinh, sparse, sqrt, squeeze, tanh, unaryMinus, acoth, bin, coth, fraction, isNumeric, matrix, matrixFromFunction, mode, numeric, prod, reshape, size, transpose, xgcd, zeros, asin, cbrt, concat, count, ctranspose, diag, divideScalar, dotDivide, equal, hasNumericValue, identity, kron, largerEq, leftShift, lsolve, matrixFromColumns, nthRoot, ones, qr, resize, rightArithShift, round, smaller, subtract, to, unaryPlus, usolve, xor, add, atan2, bitAnd, bitOr, bitXor, catalan, compare, compareText, cumsum, deepEqual, diff, distance, dot, equalText, floor, gcd, hypot, ImmutableDenseMatrix, Index, larger, log, lsolveAll, matrixFromRows, min, mod, multiply, nthRoots, or, partitionSelect, rightLogShift, slu, subset, sum, trace, usolveAll, zpk2tf, ceil, compareNatural, composition, cross, det, dotMultiply, FibonacciHeap, fix, index, intersect, invmod, lcm, log1p, max, setCartesian, setDistinct, setIsSubset, setPowerset, smallerEq, sort, unequal, and, range, row, setDifference, setMultiplicity, setSymDifference, Spa, column, inv, lup, pinv, pow, setIntersect, setUnion, sqrtm, Unit, vacuumImpedance, wienDisplacement, atomicMass, bohrMagneton, boltzmann, conductanceQuantum, coulomb, deuteronMass, dotPow, electricConstant, elementaryCharge, expm, faraday, fft, gamma, gravitationConstant, hartreeEnergy, ifft, klitzing, loschmidt, magneticConstant, molarMass, molarPlanckConstant, neutronMass, nuclearMagneton, planckCharge, planckLength, planckTemperature, protonMass, quantumOfCirculation, reducedPlanckConstant, rydberg, secondRadiation, speedOfLight, stefanBoltzmann, thomsonCrossSection, avogadro, bohrRadius, createUnit, divide, electronMass, factorial, firstRadiation, gravity, inverseConductanceQuantum, lusolve, magneticFluxQuantum, molarMassC12, multinomial, permutations, planckMass, polynomialRoot, setSize, solveODE, stirlingS2, unit, bellNumbers, eigs, fermiCoupling, gasConstant, kldivergence, mean, molarVolume, planckConstant, quantileSeq, variance, classicalElectronRadius, median, corr, freqz, mad, std, zeta, norm, rotationMatrix, planckTime, schur, rotate, sylvester, lyap } from './pureFunctionsAny.generated.js';
|
|
11
11
|
var math = {}; // NOT pure!
|
|
12
12
|
var mathWithTransform = {}; // NOT pure!
|
|
13
13
|
var classes = {}; // NOT pure!
|
|
@@ -300,6 +300,7 @@ _extends(math, {
|
|
|
300
300
|
exp,
|
|
301
301
|
expm1,
|
|
302
302
|
filter,
|
|
303
|
+
flatten,
|
|
303
304
|
forEach,
|
|
304
305
|
format,
|
|
305
306
|
getMatrixDataType,
|
|
@@ -347,6 +348,7 @@ _extends(math, {
|
|
|
347
348
|
sinh,
|
|
348
349
|
sparse,
|
|
349
350
|
sqrt,
|
|
351
|
+
squeeze,
|
|
350
352
|
tanh,
|
|
351
353
|
unaryMinus,
|
|
352
354
|
acoth,
|
|
@@ -361,7 +363,6 @@ _extends(math, {
|
|
|
361
363
|
prod,
|
|
362
364
|
reshape,
|
|
363
365
|
size,
|
|
364
|
-
squeeze,
|
|
365
366
|
transpose,
|
|
366
367
|
xgcd,
|
|
367
368
|
zeros,
|
|
@@ -374,7 +375,6 @@ _extends(math, {
|
|
|
374
375
|
divideScalar,
|
|
375
376
|
dotDivide,
|
|
376
377
|
equal,
|
|
377
|
-
flatten,
|
|
378
378
|
hasNumericValue,
|
|
379
379
|
identity,
|
|
380
380
|
kron,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { config } from './configReadonly.js';
|
|
6
6
|
import { createBigNumberClass, createComplexClass, createE, createFalse, createFineStructure, createFractionClass, createI, createInfinity, createLN10, createLOG10E, createMatrixClass, createNaN, createNull, createPhi, createRangeClass, createResultSet, createSQRT1_2,
|
|
7
7
|
// eslint-disable-line camelcase
|
|
8
|
-
createSackurTetrode, createTau, createTrue, createVersion, createDenseMatrixClass, createEfimovFactor, createLN2, createPi, createReplacer, createSQRT2, createTyped, createWeakMixingAngle, createAbs, createAcos, createAcot, createAcsc, createAddScalar, createArg, createAsech, createAsinh, createAtan, createAtanh, createBigint, createBitNot, createBoolean, createClone, createCombinations, createComplex, createConj, createCos, createCot, createCsc, createCube, createEqualScalar, createErf, createExp, createExpm1, createFilter, createForEach, createFormat, createGetMatrixDataType, createHex, createIm, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLgamma, createLog10, createLog2, createMap, createMultiplyScalar, createNot, createNumber, createOct, createPickRandom, createPrint, createRandom, createRe, createSec, createSign, createSin, createSparseMatrixClass, createSplitUnit, createSquare, createString, createSubtractScalar, createTan, createTypeOf, createAcosh, createAcsch, createApply, createAsec, createBignumber, createCombinationsWithRep, createCosh, createCsch, createIsNaN, createIsPrime, createRandomInt, createSech, createSinh, createSparse, createSqrt, createTanh, createUnaryMinus, createAcoth, createBin, createCoth, createFraction, createIsNumeric, createMatrix, createMatrixFromFunction, createMode, createNumeric, createProd, createReshape, createSize,
|
|
8
|
+
createSackurTetrode, createTau, createTrue, createVersion, createDenseMatrixClass, createEfimovFactor, createLN2, createPi, createReplacer, createSQRT2, createTyped, createWeakMixingAngle, createAbs, createAcos, createAcot, createAcsc, createAddScalar, createArg, createAsech, createAsinh, createAtan, createAtanh, createBigint, createBitNot, createBoolean, createClone, createCombinations, createComplex, createConj, createCos, createCot, createCsc, createCube, createEqualScalar, createErf, createExp, createExpm1, createFilter, createFlatten, createForEach, createFormat, createGetMatrixDataType, createHex, createIm, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLgamma, createLog10, createLog2, createMap, createMultiplyScalar, createNot, createNumber, createOct, createPickRandom, createPrint, createRandom, createRe, createSec, createSign, createSin, createSparseMatrixClass, createSplitUnit, createSquare, createString, createSubtractScalar, createTan, createTypeOf, createAcosh, createAcsch, createApply, createAsec, createBignumber, createCombinationsWithRep, createCosh, createCsch, createIsNaN, createIsPrime, createRandomInt, createSech, createSinh, createSparse, createSqrt, createSqueeze, createTanh, createUnaryMinus, createAcoth, createBin, createCoth, createFraction, createIsNumeric, createMatrix, createMatrixFromFunction, createMode, createNumeric, createProd, createReshape, createSize, createTranspose, createXgcd, createZeros, createAsin, createCbrt, createConcat, createCount, createCtranspose, createDiag, createDivideScalar, createDotDivide, createEqual, createHasNumericValue, createIdentity, createKron, createLargerEq, createLeftShift, createLsolve, createMatrixFromColumns, createNthRoot, createOnes, createQr, createResize, createRightArithShift, createRound, createSmaller, createSubtract, createTo, createUnaryPlus, createUsolve, createXor, createAdd, createAtan2, createBitAnd, createBitOr, createBitXor, createCatalan, createCompare, createCompareText, createCumSum, createDeepEqual, createDiff, createDistance, createDot, createEqualText, createFloor, createGcd, createHypot, createImmutableDenseMatrixClass, createIndexClass, createLarger, createLog, createLsolveAll, createMatrixFromRows, createMin, createMod, createMultiply, createNthRoots, createOr, createPartitionSelect, createRightLogShift, createSlu, createSubset, createSum, createTrace, createUsolveAll, createZpk2tf, createCeil, createCompareNatural, createComposition, createCross, createDet, createDotMultiply, createFibonacciHeapClass, createFix, createIndex, createIntersect, createInvmod, createLcm, createLog1p, createMax, createSetCartesian, createSetDistinct, createSetIsSubset, createSetPowerset, createSmallerEq, createSort, createUnequal, createAnd, createRange, createRow, createSetDifference, createSetMultiplicity, createSetSymDifference, createSpaClass, createColumn, createInv, createLup, createPinv, createPow, createSetIntersect, createSetUnion, createSqrtm, createUnitClass, createVacuumImpedance, createWienDisplacement, createAtomicMass, createBohrMagneton, createBoltzmann, createConductanceQuantum, createCoulomb, createDeuteronMass, createDotPow, createElectricConstant, createElementaryCharge, createExpm, createFaraday, createFft, createGamma, createGravitationConstant, createHartreeEnergy, createIfft, createKlitzing, createLoschmidt, createMagneticConstant, createMolarMass, createMolarPlanckConstant, createNeutronMass, createNuclearMagneton, createPlanckCharge, createPlanckLength, createPlanckTemperature, createProtonMass, createQuantumOfCirculation, createReducedPlanckConstant, createRydberg, createSecondRadiation, createSpeedOfLight, createStefanBoltzmann, createThomsonCrossSection, createAvogadro, createBohrRadius, createCreateUnit, createDivide, createElectronMass, createFactorial, createFirstRadiation, createGravity, createInverseConductanceQuantum, createLusolve, createMagneticFluxQuantum, createMolarMassC12, createMultinomial, createPermutations, createPlanckMass, createPolynomialRoot, createSetSize, createSolveODE, createStirlingS2, createUnitFunction, createBellNumbers, createEigs, createFermiCoupling, createGasConstant, createKldivergence, createMean, createMolarVolume, createPlanckConstant, createQuantileSeq, createVariance, createClassicalElectronRadius, createMedian, createCorr, createFreqz, createMad, createStd, createZeta, createNorm, createRotationMatrix, createPlanckTime, createSchur, createRotate, createSylvester, createLyap } from '../factoriesAny.js';
|
|
9
9
|
export var BigNumber = /* #__PURE__ */createBigNumberClass({
|
|
10
10
|
config
|
|
11
11
|
});
|
|
@@ -185,6 +185,9 @@ export var expm1 = /* #__PURE__ */createExpm1({
|
|
|
185
185
|
export var filter = /* #__PURE__ */createFilter({
|
|
186
186
|
typed
|
|
187
187
|
});
|
|
188
|
+
export var flatten = /* #__PURE__ */createFlatten({
|
|
189
|
+
typed
|
|
190
|
+
});
|
|
188
191
|
export var forEach = /* #__PURE__ */createForEach({
|
|
189
192
|
typed
|
|
190
193
|
});
|
|
@@ -359,6 +362,9 @@ export var sqrt = /* #__PURE__ */createSqrt({
|
|
|
359
362
|
config,
|
|
360
363
|
typed
|
|
361
364
|
});
|
|
365
|
+
export var squeeze = /* #__PURE__ */createSqueeze({
|
|
366
|
+
typed
|
|
367
|
+
});
|
|
362
368
|
export var tanh = /* #__PURE__ */createTanh({
|
|
363
369
|
typed
|
|
364
370
|
});
|
|
@@ -423,10 +429,6 @@ export var size = /* #__PURE__ */createSize({
|
|
|
423
429
|
config,
|
|
424
430
|
typed
|
|
425
431
|
});
|
|
426
|
-
export var squeeze = /* #__PURE__ */createSqueeze({
|
|
427
|
-
matrix,
|
|
428
|
-
typed
|
|
429
|
-
});
|
|
430
432
|
export var transpose = /* #__PURE__ */createTranspose({
|
|
431
433
|
matrix,
|
|
432
434
|
typed
|
|
@@ -498,10 +500,6 @@ export var equal = /* #__PURE__ */createEqual({
|
|
|
498
500
|
matrix,
|
|
499
501
|
typed
|
|
500
502
|
});
|
|
501
|
-
export var flatten = /* #__PURE__ */createFlatten({
|
|
502
|
-
matrix,
|
|
503
|
-
typed
|
|
504
|
-
});
|
|
505
503
|
export var hasNumericValue = /* #__PURE__ */createHasNumericValue({
|
|
506
504
|
isNumeric,
|
|
507
505
|
typed
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// util functions
|
|
2
|
-
export { isAccessorNode, isArray, isArrayNode, isAssignmentNode, isBigNumber, isBigInt, isBlockNode, isBoolean, isChain, isCollection, isComplex, isConditionalNode, isConstantNode, isDate, isDenseMatrix, isFraction, isFunction, isFunctionAssignmentNode, isFunctionNode, isHelp, isIndex, isIndexNode, isMatrix, isNode, isNull, isNumber, isString, isUndefined, isObject, isObjectNode, isOperatorNode, isParenthesisNode, isRange, isRangeNode, isRelationalNode, isRegExp, isResultSet, isSparseMatrix, isSymbolNode, isUnit } from '../utils/is.js';
|
|
2
|
+
export { isAccessorNode, isArray, isArrayNode, isAssignmentNode, isBigNumber, isBigInt, isBlockNode, isBoolean, isChain, isCollection, isComplex, isConditionalNode, isConstantNode, isDate, isDenseMatrix, isFraction, isFunction, isFunctionAssignmentNode, isFunctionNode, isHelp, isIndex, isIndexNode, isMatrix, isNode, isNull, isNumber, isString, isUndefined, isObject, isMap, isPartitionedMap, isObjectWrappingMap, isObjectNode, isOperatorNode, isParenthesisNode, isRange, isRangeNode, isRelationalNode, isRegExp, isResultSet, isSparseMatrix, isSymbolNode, isUnit } from '../utils/is.js';
|
|
@@ -316,7 +316,7 @@ export var embeddedDocs = {
|
|
|
316
316
|
examples: ['elementaryCharge']
|
|
317
317
|
},
|
|
318
318
|
bohrMagneton: {
|
|
319
|
-
description: '
|
|
319
|
+
description: 'Bohr magneton',
|
|
320
320
|
examples: ['bohrMagneton']
|
|
321
321
|
},
|
|
322
322
|
conductanceQuantum: {
|
|
@@ -341,7 +341,7 @@ export var embeddedDocs = {
|
|
|
341
341
|
examples: ['klitzing']
|
|
342
342
|
},
|
|
343
343
|
bohrRadius: {
|
|
344
|
-
description: '
|
|
344
|
+
description: 'Bohr radius',
|
|
345
345
|
examples: ['bohrRadius']
|
|
346
346
|
},
|
|
347
347
|
classicalElectronRadius: {
|
|
@@ -2,7 +2,7 @@ export var hypotDocs = {
|
|
|
2
2
|
name: 'hypot',
|
|
3
3
|
category: 'Arithmetic',
|
|
4
4
|
syntax: ['hypot(a, b, c, ...)', 'hypot([a, b, c, ...])'],
|
|
5
|
-
description: 'Calculate the
|
|
5
|
+
description: 'Calculate the hypotenuse of a list with values.',
|
|
6
6
|
examples: ['hypot(3, 4)', 'sqrt(3^2 + 4^2)', 'hypot(-2)', 'hypot([3, 4, 5])'],
|
|
7
7
|
seealso: ['abs', 'norm']
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var diffDocs = {
|
|
|
2
2
|
name: 'diff',
|
|
3
3
|
category: 'Matrix',
|
|
4
4
|
syntax: ['diff(arr)', 'diff(arr, dim)'],
|
|
5
|
-
description: ['Create a new matrix or array with the difference of the passed matrix or array.', 'Dim parameter is optional and used to
|
|
5
|
+
description: ['Create a new matrix or array with the difference of the passed matrix or array.', 'Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference', 'If no dimension parameter is passed it is assumed as dimension 0', 'Dimension is zero-based in javascript and one-based in the parser', 'Arrays must be \'rectangular\' meaning arrays like [1, 2]', 'If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays'],
|
|
6
6
|
examples: ['A = [1, 2, 4, 7, 0]', 'diff(A)', 'diff(A, 1)', 'B = [[1, 2], [3, 4]]', 'diff(B)', 'diff(B, 1)', 'diff(B, 2)', 'diff(B, bignumber(2))', 'diff([[1, 2], matrix([3, 4])], 2)'],
|
|
7
7
|
seealso: ['subtract', 'partitionSelect']
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var ifftDocs = {
|
|
|
2
2
|
name: 'ifft',
|
|
3
3
|
category: 'Matrix',
|
|
4
4
|
syntax: ['ifft(x)'],
|
|
5
|
-
description: 'Calculate N-dimensional inverse
|
|
5
|
+
description: 'Calculate N-dimensional inverse Fourier transform',
|
|
6
6
|
examples: ['ifft([[2, 2], [0, 0]])'],
|
|
7
7
|
seealso: ['fft']
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var kronDocs = {
|
|
|
2
2
|
name: 'kron',
|
|
3
3
|
category: 'Matrix',
|
|
4
4
|
syntax: ['kron(x, y)'],
|
|
5
|
-
description: 'Calculates the
|
|
5
|
+
description: 'Calculates the Kronecker product of 2 matrices or vectors.',
|
|
6
6
|
examples: ['kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])', 'kron([1,1], [2,3,4])'],
|
|
7
7
|
seealso: ['multiply', 'dot', 'cross']
|
|
8
8
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export var mapDocs = {
|
|
2
2
|
name: 'map',
|
|
3
3
|
category: 'Matrix',
|
|
4
|
-
syntax: ['map(x, callback)'],
|
|
5
|
-
description: 'Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.',
|
|
6
|
-
examples: ['map([1, 2, 3], square)'],
|
|
4
|
+
syntax: ['map(x, callback)', 'map(x, y, ..., callback)'],
|
|
5
|
+
description: 'Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.',
|
|
6
|
+
examples: ['map([1, 2, 3], square)', 'map([1, 2], [3, 4], f(a,b) = a + b)'],
|
|
7
7
|
seealso: ['filter', 'forEach']
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var zetaDocs = {
|
|
|
2
2
|
name: 'zeta',
|
|
3
3
|
category: 'Special',
|
|
4
4
|
syntax: ['zeta(s)'],
|
|
5
|
-
description: 'Compute the Riemann Zeta Function using an infinite series and
|
|
5
|
+
description: 'Compute the Riemann Zeta Function using an infinite series and Riemann\'s Functional Equation for the entire complex plane',
|
|
6
6
|
examples: ['zeta(0.2)', 'zeta(-0.5)', 'zeta(4)'],
|
|
7
7
|
seealso: []
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var quantileSeqDocs = {
|
|
|
2
2
|
name: 'quantileSeq',
|
|
3
3
|
category: 'Statistics',
|
|
4
4
|
syntax: ['quantileSeq(A, prob[, sorted])', 'quantileSeq(A, [prob1, prob2, ...][, sorted])', 'quantileSeq(A, N[, sorted])'],
|
|
5
|
-
description: 'Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of
|
|
5
|
+
description: 'Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.',
|
|
6
6
|
examples: ['quantileSeq([3, -1, 5, 7], 0.5)', 'quantileSeq([3, -1, 5, 7], [1/3, 2/3])', 'quantileSeq([3, -1, 5, 7], 2)', 'quantileSeq([-1, 3, 5, 7], 0.5, true)'],
|
|
7
7
|
seealso: ['mean', 'median', 'min', 'max', 'prod', 'std', 'sum', 'variance']
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var acothDocs = {
|
|
|
2
2
|
name: 'acoth',
|
|
3
3
|
category: 'Trigonometry',
|
|
4
4
|
syntax: ['acoth(x)'],
|
|
5
|
-
description: 'Calculate the hyperbolic
|
|
5
|
+
description: 'Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.',
|
|
6
6
|
examples: ['acoth(2)', 'acoth(0.5)'],
|
|
7
7
|
seealso: ['acsch', 'asech']
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var acschDocs = {
|
|
|
2
2
|
name: 'acsch',
|
|
3
3
|
category: 'Trigonometry',
|
|
4
4
|
syntax: ['acsch(x)'],
|
|
5
|
-
description: 'Calculate the hyperbolic
|
|
5
|
+
description: 'Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.',
|
|
6
6
|
examples: ['acsch(0.5)'],
|
|
7
7
|
seealso: ['asech', 'acoth']
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ export var cloneDocs = {
|
|
|
2
2
|
name: 'clone',
|
|
3
3
|
category: 'Utils',
|
|
4
4
|
syntax: ['clone(x)'],
|
|
5
|
-
description: 'Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices',
|
|
5
|
+
description: 'Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices',
|
|
6
6
|
examples: ['clone(3.5)', 'clone(2 - 4i)', 'clone(45 deg)', 'clone([1, 2; 3, 4])', 'clone("hello world")'],
|
|
7
7
|
seealso: []
|
|
8
8
|
};
|
|
@@ -45,7 +45,7 @@ export var createCompile = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
45
45
|
string: function string(expr) {
|
|
46
46
|
return parse(expr).compile();
|
|
47
47
|
},
|
|
48
|
-
'Array | Matrix': function
|
|
48
|
+
'Array | Matrix': function Array__Matrix(expr) {
|
|
49
49
|
return deepMap(expr, function (entry) {
|
|
50
50
|
return parse(entry).compile();
|
|
51
51
|
});
|
|
@@ -11,6 +11,11 @@ export var createEvaluate = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
11
11
|
/**
|
|
12
12
|
* Evaluate an expression.
|
|
13
13
|
*
|
|
14
|
+
* The expression parser does not use JavaScript. Its syntax is close
|
|
15
|
+
* to JavaScript but more suited for mathematical expressions.
|
|
16
|
+
* See [https://mathjs.org/docs/expressions/syntax.html](https://mathjs.org/docs/expressions/syntax.html) to learn
|
|
17
|
+
* the syntax and get an overview of the exact differences from JavaScript.
|
|
18
|
+
*
|
|
14
19
|
* Note the evaluating arbitrary expressions may involve security risks,
|
|
15
20
|
* see [https://mathjs.org/docs/expressions/security.html](https://mathjs.org/docs/expressions/security.html) for more information.
|
|
16
21
|
*
|
|
@@ -45,16 +50,16 @@ export var createEvaluate = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
45
50
|
var scope = createEmptyMap();
|
|
46
51
|
return parse(expr).compile().evaluate(scope);
|
|
47
52
|
},
|
|
48
|
-
'string, Map | Object': function
|
|
53
|
+
'string, Map | Object': function string_Map__Object(expr, scope) {
|
|
49
54
|
return parse(expr).compile().evaluate(scope);
|
|
50
55
|
},
|
|
51
|
-
'Array | Matrix': function
|
|
56
|
+
'Array | Matrix': function Array__Matrix(expr) {
|
|
52
57
|
var scope = createEmptyMap();
|
|
53
58
|
return deepMap(expr, function (entry) {
|
|
54
59
|
return parse(entry).compile().evaluate(scope);
|
|
55
60
|
});
|
|
56
61
|
},
|
|
57
|
-
'Array | Matrix, Map | Object': function
|
|
62
|
+
'Array | Matrix, Map | Object': function Array__Matrix_Map__Object(expr, scope) {
|
|
58
63
|
return deepMap(expr, function (entry) {
|
|
59
64
|
return parse(entry).compile().evaluate(scope);
|
|
60
65
|
});
|
|
@@ -97,7 +97,7 @@ export var createFunctionNode = /* #__PURE__ */factory(name, dependencies, _ref
|
|
|
97
97
|
* invoke a list with arguments on a node
|
|
98
98
|
* @param {./Node | string} fn
|
|
99
99
|
* Item resolving to a function on which to invoke
|
|
100
|
-
* the arguments, typically a
|
|
100
|
+
* the arguments, typically a SymbolNode or AccessorNode
|
|
101
101
|
* @param {./Node[]} args
|
|
102
102
|
*/
|
|
103
103
|
constructor(fn, args) {
|
|
@@ -70,10 +70,10 @@ export var createParse = /* #__PURE__ */factory(name, dependencies, _ref => {
|
|
|
70
70
|
string: function string(expression) {
|
|
71
71
|
return parseStart(expression, {});
|
|
72
72
|
},
|
|
73
|
-
'Array | Matrix': function
|
|
73
|
+
'Array | Matrix': function Array__Matrix(expressions) {
|
|
74
74
|
return parseMultiple(expressions, {});
|
|
75
75
|
},
|
|
76
|
-
'string, Object': function
|
|
76
|
+
'string, Object': function string_Object(expression, options) {
|
|
77
77
|
var extraNodes = options.nodes !== undefined ? options.nodes : {};
|
|
78
78
|
return parseStart(expression, extraNodes);
|
|
79
79
|
},
|
|
@@ -37,12 +37,12 @@ export var createFilterTransform = /* #__PURE__ */factory(name, dependencies, _r
|
|
|
37
37
|
// one based version of function filter
|
|
38
38
|
var filter = typed('filter', {
|
|
39
39
|
'Array, function': _filter,
|
|
40
|
-
'Matrix, function': function
|
|
41
|
-
return x.create(_filter(x.toArray(), test));
|
|
40
|
+
'Matrix, function': function Matrix_function(x, test) {
|
|
41
|
+
return x.create(_filter(x.toArray(), test), x.datatype());
|
|
42
42
|
},
|
|
43
43
|
'Array, RegExp': filterRegExp,
|
|
44
|
-
'Matrix, RegExp': function
|
|
45
|
-
return x.create(filterRegExp(x.toArray(), test));
|
|
44
|
+
'Matrix, RegExp': function Matrix_RegExp(x, test) {
|
|
45
|
+
return x.create(filterRegExp(x.toArray(), test), x.datatype());
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
return filterTransform;
|
|
@@ -35,19 +35,19 @@ export var createForEachTransform = /* #__PURE__ */factory(name, dependencies, _
|
|
|
35
35
|
|
|
36
36
|
// one-based version of forEach
|
|
37
37
|
var _forEach = typed('forEach', {
|
|
38
|
-
'Array | Matrix, function': function
|
|
39
|
-
var
|
|
38
|
+
'Array | Matrix, function': function Array__Matrix_function(array, callback) {
|
|
39
|
+
var _recurse = function recurse(value, index) {
|
|
40
40
|
if (Array.isArray(value)) {
|
|
41
41
|
forEach(value, function (child, i) {
|
|
42
42
|
// we create a copy of the index array and append the new index value
|
|
43
|
-
|
|
43
|
+
_recurse(child, index.concat(i + 1)); // one based index, hence i+1
|
|
44
44
|
});
|
|
45
45
|
} else {
|
|
46
46
|
// invoke the callback function with the right number of arguments
|
|
47
47
|
return applyCallback(callback, value, index, array, 'forEach');
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
_recurse(array.valueOf(), []); // pass Array
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
return forEachTransform;
|