mathjs 10.0.1 → 10.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +10 -0
- package/docs/reference/constants.md +1 -1
- package/lib/browser/math.js +6 -6
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesIntersect.generated.js +6 -0
- package/lib/cjs/entry/pureFunctionsAny.generated.js +2 -0
- package/lib/cjs/function/algebra/simplify.js +3 -0
- package/lib/cjs/function/arithmetic/round.js +2 -2
- package/lib/cjs/function/geometry/intersect.js +12 -13
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/matrix/SparseMatrix.js +19 -15
- package/lib/cjs/type/unit/Unit.js +2 -2
- package/lib/cjs/utils/number.js +1 -1
- package/lib/cjs/utils/snapshot.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesIntersect.generated.js +4 -0
- package/lib/esm/entry/pureFunctionsAny.generated.js +2 -0
- package/lib/esm/function/algebra/simplify.js +3 -0
- package/lib/esm/function/arithmetic/round.js +2 -2
- package/lib/esm/function/geometry/intersect.js +12 -12
- package/lib/esm/type/matrix/SparseMatrix.js +19 -15
- package/lib/esm/type/unit/Unit.js +2 -2
- package/lib/esm/utils/number.js +1 -1
- package/lib/esm/utils/snapshot.js +2 -2
- package/lib/esm/version.js +1 -1
- package/package.json +12 -12
@@ -17,6 +17,10 @@ var _dependenciesEqualScalarGenerated = require("./dependenciesEqualScalar.gener
|
|
17
17
|
|
18
18
|
var _dependenciesFlattenGenerated = require("./dependenciesFlatten.generated.js");
|
19
19
|
|
20
|
+
var _dependenciesIsNumericGenerated = require("./dependenciesIsNumeric.generated.js");
|
21
|
+
|
22
|
+
var _dependenciesIsZeroGenerated = require("./dependenciesIsZero.generated.js");
|
23
|
+
|
20
24
|
var _dependenciesMatrixGenerated = require("./dependenciesMatrix.generated.js");
|
21
25
|
|
22
26
|
var _dependenciesMultiplyGenerated = require("./dependenciesMultiply.generated.js");
|
@@ -42,6 +46,8 @@ var intersectDependencies = {
|
|
42
46
|
divideScalarDependencies: _dependenciesDivideScalarGenerated.divideScalarDependencies,
|
43
47
|
equalScalarDependencies: _dependenciesEqualScalarGenerated.equalScalarDependencies,
|
44
48
|
flattenDependencies: _dependenciesFlattenGenerated.flattenDependencies,
|
49
|
+
isNumericDependencies: _dependenciesIsNumericGenerated.isNumericDependencies,
|
50
|
+
isZeroDependencies: _dependenciesIsZeroGenerated.isZeroDependencies,
|
45
51
|
matrixDependencies: _dependenciesMatrixGenerated.matrixDependencies,
|
46
52
|
multiplyDependencies: _dependenciesMultiplyGenerated.multiplyDependencies,
|
47
53
|
multiplyScalarDependencies: _dependenciesMultiplyScalarGenerated.multiplyScalarDependencies,
|
@@ -1370,6 +1370,8 @@ var intersect = /* #__PURE__ */(0, _factoriesAny.createIntersect)({
|
|
1370
1370
|
divideScalar: divideScalar,
|
1371
1371
|
equalScalar: equalScalar,
|
1372
1372
|
flatten: flatten,
|
1373
|
+
isNumeric: isNumeric,
|
1374
|
+
isZero: isZero,
|
1373
1375
|
matrix: matrix,
|
1374
1376
|
multiply: multiply,
|
1375
1377
|
multiplyScalar: multiplyScalar,
|
@@ -23,9 +23,9 @@ var _algorithm3 = require("../../type/matrix/utils/algorithm14.js");
|
|
23
23
|
|
24
24
|
var _index = require("../../plain/number/index.js");
|
25
25
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
27
27
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
29
29
|
|
30
30
|
var NO_INT = 'Number of decimals in function round must be an integer';
|
31
31
|
var name = 'round';
|
@@ -5,12 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.createIntersect = void 0;
|
7
7
|
|
8
|
-
var _is = require("../../utils/is.js");
|
9
|
-
|
10
8
|
var _factory = require("../../utils/factory.js");
|
11
9
|
|
12
10
|
var name = 'intersect';
|
13
|
-
var dependencies = ['typed', 'config', 'abs', 'add', 'addScalar', 'matrix', 'multiply', 'multiplyScalar', 'divideScalar', 'subtract', 'smaller', 'equalScalar', 'flatten'];
|
11
|
+
var dependencies = ['typed', 'config', 'abs', 'add', 'addScalar', 'matrix', 'multiply', 'multiplyScalar', 'divideScalar', 'subtract', 'smaller', 'equalScalar', 'flatten', 'isZero', 'isNumeric'];
|
14
12
|
var createIntersect = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
|
15
13
|
var typed = _ref.typed,
|
16
14
|
config = _ref.config,
|
@@ -24,7 +22,9 @@ var createIntersect = /* #__PURE__ */(0, _factory.factory)(name, dependencies, f
|
|
24
22
|
subtract = _ref.subtract,
|
25
23
|
smaller = _ref.smaller,
|
26
24
|
equalScalar = _ref.equalScalar,
|
27
|
-
flatten = _ref.flatten
|
25
|
+
flatten = _ref.flatten,
|
26
|
+
isZero = _ref.isZero,
|
27
|
+
isNumeric = _ref.isNumeric;
|
28
28
|
|
29
29
|
/**
|
30
30
|
* Calculates the point of intersection of two lines in two or three dimensions
|
@@ -151,21 +151,16 @@ var createIntersect = /* #__PURE__ */(0, _factory.factory)(name, dependencies, f
|
|
151
151
|
return arr;
|
152
152
|
}
|
153
153
|
|
154
|
-
function _isNumeric(a) {
|
155
|
-
// intersect supports numbers and bignumbers
|
156
|
-
return typeof a === 'number' || (0, _is.isBigNumber)(a);
|
157
|
-
}
|
158
|
-
|
159
154
|
function _2d(x) {
|
160
|
-
return x.length === 2 &&
|
155
|
+
return x.length === 2 && isNumeric(x[0]) && isNumeric(x[1]);
|
161
156
|
}
|
162
157
|
|
163
158
|
function _3d(x) {
|
164
|
-
return x.length === 3 &&
|
159
|
+
return x.length === 3 && isNumeric(x[0]) && isNumeric(x[1]) && isNumeric(x[2]);
|
165
160
|
}
|
166
161
|
|
167
162
|
function _4d(x) {
|
168
|
-
return x.length === 4 &&
|
163
|
+
return x.length === 4 && isNumeric(x[0]) && isNumeric(x[1]) && isNumeric(x[2]) && isNumeric(x[3]);
|
169
164
|
}
|
170
165
|
|
171
166
|
function _intersect2d(p1a, p1b, p2a, p2b) {
|
@@ -174,6 +169,7 @@ var createIntersect = /* #__PURE__ */(0, _factory.factory)(name, dependencies, f
|
|
174
169
|
var d1 = subtract(o1, p1b);
|
175
170
|
var d2 = subtract(o2, p2b);
|
176
171
|
var det = subtract(multiplyScalar(d1[0], d2[1]), multiplyScalar(d2[0], d1[1]));
|
172
|
+
if (isZero(det)) return null;
|
177
173
|
|
178
174
|
if (smaller(abs(det), config.epsilon)) {
|
179
175
|
return null;
|
@@ -206,7 +202,10 @@ var createIntersect = /* #__PURE__ */(0, _factory.factory)(name, dependencies, f
|
|
206
202
|
|
207
203
|
var d2121 = _intersect3dHelper(x2, x1, x2, x1, y2, y1, y2, y1, z2, z1, z2, z1);
|
208
204
|
|
209
|
-
var
|
205
|
+
var numerator = subtract(multiplyScalar(d1343, d4321), multiplyScalar(d1321, d4343));
|
206
|
+
var denominator = subtract(multiplyScalar(d2121, d4343), multiplyScalar(d4321, d4321));
|
207
|
+
if (isZero(denominator)) return null;
|
208
|
+
var ta = divideScalar(numerator, denominator);
|
210
209
|
var tb = divideScalar(addScalar(d1343, multiplyScalar(ta, d4321)), d4343);
|
211
210
|
var pax = addScalar(x1, multiplyScalar(ta, subtract(x2, x1)));
|
212
211
|
var pay = addScalar(y1, multiplyScalar(ta, subtract(y2, y1)));
|
package/lib/cjs/header.js
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
* It features real and complex numbers, units, matrices, a large set of
|
7
7
|
* mathematical functions, and a flexible expression parser.
|
8
8
|
*
|
9
|
-
* @version 10.0.
|
10
|
-
* @date 2021-12-
|
9
|
+
* @version 10.0.2
|
10
|
+
* @date 2021-12-29
|
11
11
|
*
|
12
12
|
* @license
|
13
13
|
* Copyright (C) 2013-2021 Jos de Jong <wjosdejong@gmail.com>
|
@@ -433,23 +433,27 @@ var createSparseMatrixClass = /* #__PURE__ */(0, _factory.factory)(name, depende
|
|
433
433
|
|
434
434
|
if (!(0, _object.deepStrictEqual)(iSize, sSize)) {
|
435
435
|
throw new _DimensionError.DimensionError(iSize, sSize, '>');
|
436
|
-
} //
|
436
|
+
} // insert the sub matrix
|
437
437
|
|
438
438
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
439
|
+
if (iSize.length === 1) {
|
440
|
+
// if the replacement index only has 1 dimension, go trough each one and set its value
|
441
|
+
var range = index.dimension(0);
|
442
|
+
range.forEach(function (dataIndex, subIndex) {
|
443
|
+
(0, _array.validateIndex)(dataIndex);
|
444
|
+
matrix.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue);
|
445
|
+
});
|
446
|
+
} else {
|
447
|
+
// if the replacement index has 2 dimensions, go through each one and set the value in the correct index
|
448
|
+
var firstDimensionRange = index.dimension(0);
|
449
|
+
var secondDimensionRange = index.dimension(1);
|
450
|
+
firstDimensionRange.forEach(function (firstDataIndex, firstSubIndex) {
|
451
|
+
(0, _array.validateIndex)(firstDataIndex);
|
452
|
+
secondDimensionRange.forEach(function (secondDataIndex, secondSubIndex) {
|
453
|
+
(0, _array.validateIndex)(secondDataIndex);
|
454
|
+
matrix.set([firstDataIndex, secondDataIndex], submatrix[firstSubIndex[0]][secondSubIndex[0]], defaultValue);
|
455
|
+
});
|
456
|
+
});
|
453
457
|
}
|
454
458
|
}
|
455
459
|
|
@@ -25,9 +25,9 @@ var _object = require("../../utils/object.js");
|
|
25
25
|
|
26
26
|
var _constants = require("../../utils/bignumber/constants.js");
|
27
27
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
29
29
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
31
31
|
|
32
32
|
var name = 'Unit';
|
33
33
|
var dependencies = ['?on', 'config', 'addScalar', 'subtract', 'multiplyScalar', 'divideScalar', 'pow', 'abs', 'fix', 'round', 'equal', 'isNumeric', 'format', 'number', 'Complex', 'BigNumber', 'Fraction'];
|
package/lib/cjs/utils/number.js
CHANGED
@@ -359,7 +359,7 @@ function format(value, options) {
|
|
359
359
|
|
360
360
|
function splitNumber(value) {
|
361
361
|
// parse the input value
|
362
|
-
var match = String(value).toLowerCase().match(/^
|
362
|
+
var match = String(value).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);
|
363
363
|
|
364
364
|
if (!match) {
|
365
365
|
throw new SyntaxError('Invalid number ' + value);
|
@@ -29,9 +29,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
29
29
|
|
30
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
31
31
|
|
32
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
33
33
|
|
34
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
35
35
|
|
36
36
|
function validateBundle(expectedBundleStructure, bundle) {
|
37
37
|
var originalWarn = console.warn;
|
package/lib/cjs/version.js
CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.version = void 0;
|
7
|
-
var version = '10.0.
|
7
|
+
var version = '10.0.2'; // Note: This file is automatically generated when building math.js.
|
8
8
|
// Changes made in this file will be overwritten.
|
9
9
|
|
10
10
|
exports.version = version;
|
@@ -8,6 +8,8 @@ import { addScalarDependencies } from './dependenciesAddScalar.generated.js';
|
|
8
8
|
import { divideScalarDependencies } from './dependenciesDivideScalar.generated.js';
|
9
9
|
import { equalScalarDependencies } from './dependenciesEqualScalar.generated.js';
|
10
10
|
import { flattenDependencies } from './dependenciesFlatten.generated.js';
|
11
|
+
import { isNumericDependencies } from './dependenciesIsNumeric.generated.js';
|
12
|
+
import { isZeroDependencies } from './dependenciesIsZero.generated.js';
|
11
13
|
import { matrixDependencies } from './dependenciesMatrix.generated.js';
|
12
14
|
import { multiplyDependencies } from './dependenciesMultiply.generated.js';
|
13
15
|
import { multiplyScalarDependencies } from './dependenciesMultiplyScalar.generated.js';
|
@@ -22,6 +24,8 @@ export var intersectDependencies = {
|
|
22
24
|
divideScalarDependencies,
|
23
25
|
equalScalarDependencies,
|
24
26
|
flattenDependencies,
|
27
|
+
isNumericDependencies,
|
28
|
+
isZeroDependencies,
|
25
29
|
matrixDependencies,
|
26
30
|
multiplyDependencies,
|
27
31
|
multiplyScalarDependencies,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
4
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
6
6
|
|
7
7
|
import { factory } from '../../utils/factory.js';
|
8
8
|
import { deepMap } from '../../utils/collection.js';
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { isBigNumber } from '../../utils/is.js';
|
2
1
|
import { factory } from '../../utils/factory.js';
|
3
2
|
var name = 'intersect';
|
4
|
-
var dependencies = ['typed', 'config', 'abs', 'add', 'addScalar', 'matrix', 'multiply', 'multiplyScalar', 'divideScalar', 'subtract', 'smaller', 'equalScalar', 'flatten'];
|
3
|
+
var dependencies = ['typed', 'config', 'abs', 'add', 'addScalar', 'matrix', 'multiply', 'multiplyScalar', 'divideScalar', 'subtract', 'smaller', 'equalScalar', 'flatten', 'isZero', 'isNumeric'];
|
5
4
|
export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref => {
|
6
5
|
var {
|
7
6
|
typed,
|
@@ -16,7 +15,9 @@ export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
16
15
|
subtract,
|
17
16
|
smaller,
|
18
17
|
equalScalar,
|
19
|
-
flatten
|
18
|
+
flatten,
|
19
|
+
isZero,
|
20
|
+
isNumeric
|
20
21
|
} = _ref;
|
21
22
|
|
22
23
|
/**
|
@@ -142,21 +143,16 @@ export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
142
143
|
return arr;
|
143
144
|
}
|
144
145
|
|
145
|
-
function _isNumeric(a) {
|
146
|
-
// intersect supports numbers and bignumbers
|
147
|
-
return typeof a === 'number' || isBigNumber(a);
|
148
|
-
}
|
149
|
-
|
150
146
|
function _2d(x) {
|
151
|
-
return x.length === 2 &&
|
147
|
+
return x.length === 2 && isNumeric(x[0]) && isNumeric(x[1]);
|
152
148
|
}
|
153
149
|
|
154
150
|
function _3d(x) {
|
155
|
-
return x.length === 3 &&
|
151
|
+
return x.length === 3 && isNumeric(x[0]) && isNumeric(x[1]) && isNumeric(x[2]);
|
156
152
|
}
|
157
153
|
|
158
154
|
function _4d(x) {
|
159
|
-
return x.length === 4 &&
|
155
|
+
return x.length === 4 && isNumeric(x[0]) && isNumeric(x[1]) && isNumeric(x[2]) && isNumeric(x[3]);
|
160
156
|
}
|
161
157
|
|
162
158
|
function _intersect2d(p1a, p1b, p2a, p2b) {
|
@@ -165,6 +161,7 @@ export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
165
161
|
var d1 = subtract(o1, p1b);
|
166
162
|
var d2 = subtract(o2, p2b);
|
167
163
|
var det = subtract(multiplyScalar(d1[0], d2[1]), multiplyScalar(d2[0], d1[1]));
|
164
|
+
if (isZero(det)) return null;
|
168
165
|
|
169
166
|
if (smaller(abs(det), config.epsilon)) {
|
170
167
|
return null;
|
@@ -197,7 +194,10 @@ export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref =>
|
|
197
194
|
|
198
195
|
var d2121 = _intersect3dHelper(x2, x1, x2, x1, y2, y1, y2, y1, z2, z1, z2, z1);
|
199
196
|
|
200
|
-
var
|
197
|
+
var numerator = subtract(multiplyScalar(d1343, d4321), multiplyScalar(d1321, d4343));
|
198
|
+
var denominator = subtract(multiplyScalar(d2121, d4343), multiplyScalar(d4321, d4321));
|
199
|
+
if (isZero(denominator)) return null;
|
200
|
+
var ta = divideScalar(numerator, denominator);
|
201
201
|
var tb = divideScalar(addScalar(d1343, multiplyScalar(ta, d4321)), d4343);
|
202
202
|
var pax = addScalar(x1, multiplyScalar(ta, subtract(x2, x1)));
|
203
203
|
var pay = addScalar(y1, multiplyScalar(ta, subtract(y2, y1)));
|
@@ -417,23 +417,27 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies,
|
|
417
417
|
|
418
418
|
if (!deepStrictEqual(iSize, sSize)) {
|
419
419
|
throw new DimensionError(iSize, sSize, '>');
|
420
|
-
} //
|
420
|
+
} // insert the sub matrix
|
421
421
|
|
422
422
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
423
|
+
if (iSize.length === 1) {
|
424
|
+
// if the replacement index only has 1 dimension, go trough each one and set its value
|
425
|
+
var range = index.dimension(0);
|
426
|
+
range.forEach(function (dataIndex, subIndex) {
|
427
|
+
validateIndex(dataIndex);
|
428
|
+
matrix.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue);
|
429
|
+
});
|
430
|
+
} else {
|
431
|
+
// if the replacement index has 2 dimensions, go through each one and set the value in the correct index
|
432
|
+
var firstDimensionRange = index.dimension(0);
|
433
|
+
var secondDimensionRange = index.dimension(1);
|
434
|
+
firstDimensionRange.forEach(function (firstDataIndex, firstSubIndex) {
|
435
|
+
validateIndex(firstDataIndex);
|
436
|
+
secondDimensionRange.forEach(function (secondDataIndex, secondSubIndex) {
|
437
|
+
validateIndex(secondDataIndex);
|
438
|
+
matrix.set([firstDataIndex, secondDataIndex], submatrix[firstSubIndex[0]][secondSubIndex[0]], defaultValue);
|
439
|
+
});
|
440
|
+
});
|
437
441
|
}
|
438
442
|
}
|
439
443
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
5
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
|
8
8
|
import { isComplex, isUnit, typeOf } from '../../utils/is.js';
|
9
9
|
import { factory } from '../../utils/factory.js';
|
package/lib/esm/utils/number.js
CHANGED
@@ -318,7 +318,7 @@ export function format(value, options) {
|
|
318
318
|
|
319
319
|
export function splitNumber(value) {
|
320
320
|
// parse the input value
|
321
|
-
var match = String(value).toLowerCase().match(/^
|
321
|
+
var match = String(value).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);
|
322
322
|
|
323
323
|
if (!match) {
|
324
324
|
throw new SyntaxError('Invalid number ' + value);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
5
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
|
8
8
|
/**
|
9
9
|
* This file contains helper methods to create expected snapshot structures
|
package/lib/esm/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export var version = '10.0.
|
1
|
+
export var version = '10.0.2'; // Note: This file is automatically generated when building math.js.
|
2
2
|
// Changes made in this file will be overwritten.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mathjs",
|
3
|
-
"version": "10.0.
|
3
|
+
"version": "10.0.2",
|
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,28 +25,28 @@
|
|
25
25
|
"unit"
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
|
-
"@babel/runtime": "^7.16.
|
28
|
+
"@babel/runtime": "^7.16.5",
|
29
29
|
"complex.js": "^2.0.15",
|
30
30
|
"decimal.js": "^10.3.1",
|
31
31
|
"escape-latex": "^1.2.0",
|
32
|
-
"fraction.js": "^4.1.
|
32
|
+
"fraction.js": "^4.1.2",
|
33
33
|
"javascript-natural-sort": "^0.7.1",
|
34
34
|
"seedrandom": "^3.0.5",
|
35
35
|
"tiny-emitter": "^2.1.0",
|
36
36
|
"typed-function": "^2.0.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@babel/core": "7.16.
|
40
|
-
"@babel/plugin-transform-object-assign": "7.16.
|
41
|
-
"@babel/plugin-transform-runtime": "7.16.
|
42
|
-
"@babel/preset-env": "7.16.
|
43
|
-
"@babel/register": "7.16.
|
39
|
+
"@babel/core": "7.16.5",
|
40
|
+
"@babel/plugin-transform-object-assign": "7.16.5",
|
41
|
+
"@babel/plugin-transform-runtime": "7.16.5",
|
42
|
+
"@babel/preset-env": "7.16.5",
|
43
|
+
"@babel/register": "7.16.5",
|
44
44
|
"babel-loader": "8.2.3",
|
45
45
|
"benchmark": "2.1.4",
|
46
46
|
"codecov": "3.8.3",
|
47
|
-
"core-js": "3.
|
47
|
+
"core-js": "3.20.1",
|
48
48
|
"del": "6.0.0",
|
49
|
-
"dtslint": "4.2.
|
49
|
+
"dtslint": "4.2.1",
|
50
50
|
"expr-eval": "2.0.2",
|
51
51
|
"fancy-log": "1.3.3",
|
52
52
|
"glob": "7.2.0",
|
@@ -55,7 +55,7 @@
|
|
55
55
|
"handlebars": "4.7.7",
|
56
56
|
"istanbul": "0.4.5",
|
57
57
|
"jsep": "1.2.0",
|
58
|
-
"karma": "6.3.
|
58
|
+
"karma": "6.3.9",
|
59
59
|
"karma-browserstack-launcher": "1.6.0",
|
60
60
|
"karma-firefox-launcher": "2.1.2",
|
61
61
|
"karma-mocha": "2.0.1",
|
@@ -74,7 +74,7 @@
|
|
74
74
|
"pad-right": "0.2.2",
|
75
75
|
"standard": "16.0.4",
|
76
76
|
"sylvester": "0.0.21",
|
77
|
-
"typescript": "4.
|
77
|
+
"typescript": "4.5.4",
|
78
78
|
"webpack": "4.46.0",
|
79
79
|
"zeros": "1.0.0"
|
80
80
|
},
|