mathjs 9.4.0 → 9.4.4

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.
Files changed (38) hide show
  1. package/HISTORY.md +39 -0
  2. package/README.md +1 -3
  3. package/docs/expressions/expression_trees.md +2 -1
  4. package/docs/expressions/parsing.md +1 -1
  5. package/docs/reference/functions/intersect.md +1 -1
  6. package/examples/advanced/custom_datatype.js +7 -4
  7. package/lib/browser/math.js +7 -7
  8. package/lib/browser/math.js.map +1 -1
  9. package/lib/cjs/entry/dependenciesAny/dependenciesEigs.generated.js +6 -9
  10. package/lib/cjs/entry/dependenciesAny/dependenciesIntersect.generated.js +3 -0
  11. package/lib/cjs/entry/impureFunctionsAny.generated.js +41 -41
  12. package/lib/cjs/entry/pureFunctionsAny.generated.js +128 -128
  13. package/lib/cjs/expression/node/ArrayNode.js +15 -15
  14. package/lib/cjs/expression/parse.js +1 -0
  15. package/lib/cjs/function/geometry/intersect.js +93 -58
  16. package/lib/cjs/function/matrix/eigs/complexEigs.js +168 -18
  17. package/lib/cjs/function/matrix/eigs.js +7 -9
  18. package/lib/cjs/header.js +2 -2
  19. package/lib/cjs/type/bignumber/BigNumber.js +3 -3
  20. package/lib/cjs/utils/is.js +13 -1
  21. package/lib/cjs/version.js +1 -1
  22. package/lib/esm/entry/dependenciesAny/dependenciesEigs.generated.js +4 -6
  23. package/lib/esm/entry/dependenciesAny/dependenciesIntersect.generated.js +2 -0
  24. package/lib/esm/entry/impureFunctionsAny.generated.js +38 -38
  25. package/lib/esm/entry/pureFunctionsAny.generated.js +107 -107
  26. package/lib/esm/expression/node/ArrayNode.js +16 -16
  27. package/lib/esm/expression/parse.js +1 -0
  28. package/lib/esm/function/geometry/intersect.js +91 -58
  29. package/lib/esm/function/matrix/eigs/complexEigs.js +152 -18
  30. package/lib/esm/function/matrix/eigs.js +7 -9
  31. package/lib/esm/type/bignumber/BigNumber.js +2 -3
  32. package/lib/esm/utils/is.js +13 -1
  33. package/lib/esm/version.js +1 -1
  34. package/package.json +22 -20
  35. package/types/index.d.ts +4772 -0
  36. package/types/index.ts +597 -0
  37. package/types/tsconfig.json +18 -0
  38. package/types/tslint.json +6 -0
@@ -1,7 +1,7 @@
1
1
  import { isBigNumber } from '../../utils/is.js';
2
2
  import { factory } from '../../utils/factory.js';
3
3
  var name = 'intersect';
4
- var dependencies = ['typed', 'config', 'abs', 'add', 'addScalar', 'matrix', 'multiply', 'multiplyScalar', 'divideScalar', 'subtract', 'smaller', 'equalScalar'];
4
+ var dependencies = ['typed', 'config', 'abs', 'add', 'addScalar', 'matrix', 'multiply', 'multiplyScalar', 'divideScalar', 'subtract', 'smaller', 'equalScalar', 'flatten'];
5
5
  export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref => {
6
6
  var {
7
7
  typed,
@@ -15,7 +15,8 @@ export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref =>
15
15
  divideScalar,
16
16
  subtract,
17
17
  smaller,
18
- equalScalar
18
+ equalScalar,
19
+ flatten
19
20
  } = _ref;
20
21
 
21
22
  /**
@@ -42,74 +43,104 @@ export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref =>
42
43
  * @param {Array | Matrix} y Co-ordinates of first end-point of second line
43
44
  * OR Co-efficients of the plane's equation
44
45
  * @param {Array | Matrix} z Co-ordinates of second end-point of second line
45
- * OR null if the calculation is for line and plane
46
+ * OR undefined if the calculation is for line and plane
46
47
  * @return {Array} Returns the point of intersection of lines/lines-planes
47
48
  */
48
49
  return typed('intersect', {
49
- 'Array, Array, Array': function ArrayArrayArray(x, y, plane) {
50
- if (!_3d(x)) {
50
+ 'Array, Array, Array': _AAA,
51
+ 'Array, Array, Array, Array': _AAAA,
52
+ 'Matrix, Matrix, Matrix': function MatrixMatrixMatrix(x, y, plane) {
53
+ var arr = _AAA(x.valueOf(), y.valueOf(), plane.valueOf());
54
+
55
+ return arr === null ? null : matrix(arr);
56
+ },
57
+ 'Matrix, Matrix, Matrix, Matrix': function MatrixMatrixMatrixMatrix(w, x, y, z) {
58
+ // TODO: output matrix type should match input matrix type
59
+ var arr = _AAAA(w.valueOf(), x.valueOf(), y.valueOf(), z.valueOf());
60
+
61
+ return arr === null ? null : matrix(arr);
62
+ }
63
+ });
64
+
65
+ function _AAA(x, y, plane) {
66
+ x = _coerceArr(x);
67
+ y = _coerceArr(y);
68
+ plane = _coerceArr(plane);
69
+
70
+ if (!_3d(x)) {
71
+ throw new TypeError('Array with 3 numbers or BigNumbers expected for first argument');
72
+ }
73
+
74
+ if (!_3d(y)) {
75
+ throw new TypeError('Array with 3 numbers or BigNumbers expected for second argument');
76
+ }
77
+
78
+ if (!_4d(plane)) {
79
+ throw new TypeError('Array with 4 numbers expected as third argument');
80
+ }
81
+
82
+ return _intersectLinePlane(x[0], x[1], x[2], y[0], y[1], y[2], plane[0], plane[1], plane[2], plane[3]);
83
+ }
84
+
85
+ function _AAAA(w, x, y, z) {
86
+ w = _coerceArr(w);
87
+ x = _coerceArr(x);
88
+ y = _coerceArr(y);
89
+ z = _coerceArr(z);
90
+
91
+ if (w.length === 2) {
92
+ if (!_2d(w)) {
93
+ throw new TypeError('Array with 2 numbers or BigNumbers expected for first argument');
94
+ }
95
+
96
+ if (!_2d(x)) {
97
+ throw new TypeError('Array with 2 numbers or BigNumbers expected for second argument');
98
+ }
99
+
100
+ if (!_2d(y)) {
101
+ throw new TypeError('Array with 2 numbers or BigNumbers expected for third argument');
102
+ }
103
+
104
+ if (!_2d(z)) {
105
+ throw new TypeError('Array with 2 numbers or BigNumbers expected for fourth argument');
106
+ }
107
+
108
+ return _intersect2d(w, x, y, z);
109
+ } else if (w.length === 3) {
110
+ if (!_3d(w)) {
51
111
  throw new TypeError('Array with 3 numbers or BigNumbers expected for first argument');
52
112
  }
53
113
 
54
- if (!_3d(y)) {
114
+ if (!_3d(x)) {
55
115
  throw new TypeError('Array with 3 numbers or BigNumbers expected for second argument');
56
116
  }
57
117
 
58
- if (!_4d(plane)) {
59
- throw new TypeError('Array with 4 numbers expected as third argument');
118
+ if (!_3d(y)) {
119
+ throw new TypeError('Array with 3 numbers or BigNumbers expected for third argument');
60
120
  }
61
121
 
62
- return _intersectLinePlane(x[0], x[1], x[2], y[0], y[1], y[2], plane[0], plane[1], plane[2], plane[3]);
63
- },
64
- 'Array, Array, Array, Array': function ArrayArrayArrayArray(w, x, y, z) {
65
- if (w.length === 2) {
66
- if (!_2d(w)) {
67
- throw new TypeError('Array with 2 numbers or BigNumbers expected for first argument');
68
- }
69
-
70
- if (!_2d(x)) {
71
- throw new TypeError('Array with 2 numbers or BigNumbers expected for second argument');
72
- }
73
-
74
- if (!_2d(y)) {
75
- throw new TypeError('Array with 2 numbers or BigNumbers expected for third argument');
76
- }
77
-
78
- if (!_2d(z)) {
79
- throw new TypeError('Array with 2 numbers or BigNumbers expected for fourth argument');
80
- }
81
-
82
- return _intersect2d(w, x, y, z);
83
- } else if (w.length === 3) {
84
- if (!_3d(w)) {
85
- throw new TypeError('Array with 3 numbers or BigNumbers expected for first argument');
86
- }
87
-
88
- if (!_3d(x)) {
89
- throw new TypeError('Array with 3 numbers or BigNumbers expected for second argument');
90
- }
91
-
92
- if (!_3d(y)) {
93
- throw new TypeError('Array with 3 numbers or BigNumbers expected for third argument');
94
- }
95
-
96
- if (!_3d(z)) {
97
- throw new TypeError('Array with 3 numbers or BigNumbers expected for fourth argument');
98
- }
99
-
100
- return _intersect3d(w[0], w[1], w[2], x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1], z[2]);
101
- } else {
102
- throw new TypeError('Arrays with two or thee dimensional points expected');
122
+ if (!_3d(z)) {
123
+ throw new TypeError('Array with 3 numbers or BigNumbers expected for fourth argument');
103
124
  }
104
- },
105
- 'Matrix, Matrix, Matrix': function MatrixMatrixMatrix(x, y, plane) {
106
- return matrix(this(x.valueOf(), y.valueOf(), plane.valueOf()));
107
- },
108
- 'Matrix, Matrix, Matrix, Matrix': function MatrixMatrixMatrixMatrix(w, x, y, z) {
109
- // TODO: output matrix type should match input matrix type
110
- return matrix(this(w.valueOf(), x.valueOf(), y.valueOf(), z.valueOf()));
125
+
126
+ return _intersect3d(w[0], w[1], w[2], x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1], z[2]);
127
+ } else {
128
+ throw new TypeError('Arrays with two or thee dimensional points expected');
111
129
  }
112
- });
130
+ }
131
+ /** Coerce row and column 2-dim arrays to 1-dim array */
132
+
133
+
134
+ function _coerceArr(arr) {
135
+ // row matrix
136
+ if (arr.length === 1) return arr[0]; // column matrix
137
+
138
+ if (arr.length > 1 && Array.isArray(arr[0])) {
139
+ if (arr.every(el => Array.isArray(el) && el.length === 1)) return flatten(arr);
140
+ }
141
+
142
+ return arr;
143
+ }
113
144
 
114
145
  function _isNumeric(a) {
115
146
  // intersect supports numbers and bignumbers
@@ -189,7 +220,9 @@ export var createIntersect = /* #__PURE__ */factory(name, dependencies, _ref =>
189
220
  var y2y = multiplyScalar(y2, y);
190
221
  var z1z = multiplyScalar(z1, z);
191
222
  var z2z = multiplyScalar(z2, z);
192
- var t = divideScalar(subtract(subtract(subtract(c, x1x), y1y), z1z), subtract(subtract(subtract(addScalar(addScalar(x2x, y2y), z2z), x1x), y1y), z1z));
223
+ var numerator = subtract(subtract(subtract(c, x1x), y1y), z1z);
224
+ var denominator = subtract(subtract(subtract(addScalar(addScalar(x2x, y2y), z2z), x1x), y1y), z1z);
225
+ var t = divideScalar(numerator, denominator);
193
226
  var px = addScalar(x1, multiplyScalar(t, subtract(x2, x1)));
194
227
  var py = addScalar(y1, multiplyScalar(t, subtract(y2, y1)));
195
228
  var pz = addScalar(z1, multiplyScalar(t, subtract(z2, z1)));
@@ -13,15 +13,14 @@ export function createComplexEigs(_ref) {
13
13
  diag,
14
14
  inv,
15
15
  qr,
16
+ usolve,
16
17
  usolveAll,
17
18
  equal,
18
19
  complex,
19
20
  larger,
20
21
  smaller,
21
- round,
22
- log10,
23
- transpose,
24
- matrixFromColumns
22
+ matrixFromColumns,
23
+ dot
25
24
  } = _ref;
26
25
 
27
26
  /**
@@ -64,7 +63,7 @@ export function createComplexEigs(_ref) {
64
63
  var vectors;
65
64
 
66
65
  if (findVectors) {
67
- vectors = findEigenvectors(arr, N, C, values, prec);
66
+ vectors = findEigenvectors(arr, N, C, values, prec, type);
68
67
  vectors = matrixFromColumns(...vectors);
69
68
  }
70
69
 
@@ -397,13 +396,18 @@ export function createComplexEigs(_ref) {
397
396
  * @param {number} N size of A
398
397
  * @param {Matrix} C column transformation matrix that turns A into upper triangular
399
398
  * @param {number[]} values array of eigenvalues of A
399
+ * @param {'number'|'BigNumber'|'Complex'} type
400
400
  * @returns {number[][]} eigenvalues
401
401
  */
402
402
 
403
403
 
404
- function findEigenvectors(A, N, C, values, prec) {
404
+ function findEigenvectors(A, N, C, values, prec, type) {
405
405
  var Cinv = inv(C);
406
- var U = multiply(Cinv, A, C); // turn values into a kind of "multiset"
406
+ var U = multiply(Cinv, A, C);
407
+ var big = type === 'BigNumber';
408
+ var cplx = type === 'Complex';
409
+ var zero = big ? bignumber(0) : cplx ? complex(0) : 0;
410
+ var one = big ? bignumber(1) : cplx ? complex(1) : 1; // turn values into a kind of "multiset"
407
411
  // this way it is easier to find eigenvectors
408
412
 
409
413
  var uniqueValues = [];
@@ -413,11 +417,7 @@ export function createComplexEigs(_ref) {
413
417
  var i = indexOf(uniqueValues, λ, equal);
414
418
 
415
419
  if (i === -1) {
416
- // a dirty trick that helps us find more vectors
417
- // TODO with iterative algorithm this can be removed
418
- // Note: the round around log10 is needed to prevent rounding off errors in IE
419
- var rounded = round(λ, subtract(-1, round(log10(prec))));
420
- uniqueValues.push(rounded);
420
+ uniqueValues.push(λ);
421
421
  multiplicities.push(1);
422
422
  } else {
423
423
  multiplicities[i] += 1;
@@ -429,20 +429,32 @@ export function createComplexEigs(_ref) {
429
429
 
430
430
  var vectors = [];
431
431
  var len = uniqueValues.length;
432
- var b = Array(N).fill(0);
433
- var E = diag(Array(N).fill(1)); // eigenvalues for which usolve failed (due to numerical error)
432
+ var b = Array(N).fill(zero);
433
+ var E = diag(Array(N).fill(one)); // eigenvalues for which usolve failed (due to numerical error)
434
434
 
435
435
  var failedLambdas = [];
436
436
 
437
437
  for (var _i4 = 0; _i4 < len; _i4++) {
438
438
  var _λ = uniqueValues[_i4];
439
- var solutions = usolveAll(subtract(U, multiply(_λ, E)), b);
439
+
440
+ var _A = subtract(U, multiply(_λ, E)); // the characteristic matrix
441
+
442
+
443
+ var solutions = usolveAll(_A, b);
440
444
  solutions = solutions.map(v => multiply(C, v));
441
445
  solutions.shift(); // ignore the null vector
442
- // looks like we missed something
446
+ // looks like we missed something, try inverse iteration
447
+
448
+ while (solutions.length < multiplicities[_i4]) {
449
+ var approxVec = inverseIterate(_A, N, solutions, prec, type);
450
+
451
+ if (approxVec == null) {
452
+ // no more vectors were found
453
+ failedLambdas.push(_λ);
454
+ break;
455
+ }
443
456
 
444
- if (solutions.length < multiplicities[_i4]) {
445
- failedLambdas.push(_λ);
457
+ solutions.push(approxVec);
446
458
  }
447
459
 
448
460
  vectors.push(...solutions.map(v => flatten(v)));
@@ -581,6 +593,128 @@ export function createComplexEigs(_ref) {
581
593
 
582
594
  return -1;
583
595
  }
596
+ /**
597
+ * Provided a near-singular upper-triangular matrix A and a list of vectors,
598
+ * finds an eigenvector of A with the smallest eigenvalue, which is orthogonal
599
+ * to each vector in the list
600
+ * @template T
601
+ * @param {T[][]} A near-singular square matrix
602
+ * @param {number} N dimension
603
+ * @param {T[][]} orthog list of vectors
604
+ * @param {number} prec epsilon
605
+ * @param {'number'|'BigNumber'|'Complex'} type
606
+ * @return {T[] | null} eigenvector
607
+ *
608
+ * @see Numerical Recipes for Fortran 77 – 11.7 Eigenvalues or Eigenvectors by Inverse Iteration
609
+ */
610
+
611
+
612
+ function inverseIterate(A, N, orthog, prec, type) {
613
+ var largeNum = type === 'BigNumber' ? bignumber(1000) : 1000;
614
+ var b; // the vector
615
+ // you better choose a random vector before I count to five
616
+
617
+ var i = 0;
618
+
619
+ while (true) {
620
+ b = randomOrthogonalVector(N, orthog, type);
621
+ b = usolve(A, b);
622
+
623
+ if (larger(norm(b), largeNum)) {
624
+ break;
625
+ }
626
+
627
+ if (++i >= 5) {
628
+ return null;
629
+ }
630
+ } // you better converge before I count to ten
631
+
632
+
633
+ i = 0;
634
+
635
+ while (true) {
636
+ var c = usolve(A, b);
637
+
638
+ if (smaller(norm(orthogonalComplement(b, [c])), prec)) {
639
+ break;
640
+ }
641
+
642
+ if (++i >= 10) {
643
+ return null;
644
+ }
645
+
646
+ b = normalize(c);
647
+ }
648
+
649
+ return b;
650
+ }
651
+ /**
652
+ * Generates a random unit vector of dimension N, orthogonal to each vector in the list
653
+ * @template T
654
+ * @param {number} N dimension
655
+ * @param {T[][]} orthog list of vectors
656
+ * @param {'number'|'BigNumber'|'Complex'} type
657
+ * @returns {T[]} random vector
658
+ */
659
+
660
+
661
+ function randomOrthogonalVector(N, orthog, type) {
662
+ var big = type === 'BigNumber';
663
+ var cplx = type === 'Complex'; // generate random vector with the correct type
664
+
665
+ var v = Array(N).fill(0).map(_ => 2 * Math.random() - 1);
666
+
667
+ if (big) {
668
+ v = v.map(n => bignumber(n));
669
+ }
670
+
671
+ if (cplx) {
672
+ v = v.map(n => complex(n));
673
+ } // project to orthogonal complement
674
+
675
+
676
+ v = orthogonalComplement(v, orthog); // normalize
677
+
678
+ return normalize(v, type);
679
+ }
680
+ /**
681
+ * Project vector v to the orthogonal complement of an array of vectors
682
+ */
683
+
684
+
685
+ function orthogonalComplement(v, orthog) {
686
+ for (var w of orthog) {
687
+ // v := v − (w, v)/∥w∥² w
688
+ v = subtract(v, multiply(divideScalar(dot(w, v), dot(w, w)), w));
689
+ }
690
+
691
+ return v;
692
+ }
693
+ /**
694
+ * Calculate the norm of a vector.
695
+ * We can't use math.norm because factory can't handle circular dependency.
696
+ * Seriously, I'm really fed up with factory.
697
+ */
698
+
699
+
700
+ function norm(v) {
701
+ return abs(sqrt(dot(v, v)));
702
+ }
703
+ /**
704
+ * Normalize a vector
705
+ * @template T
706
+ * @param {T[]} v
707
+ * @param {'number'|'BigNumber'|'Complex'} type
708
+ * @returns {T[]} normalized vec
709
+ */
710
+
711
+
712
+ function normalize(v, type) {
713
+ var big = type === 'BigNumber';
714
+ var cplx = type === 'Complex';
715
+ var one = big ? bignumber(1) : cplx ? complex(1) : 1;
716
+ return multiply(divideScalar(one, norm(v)), v);
717
+ }
584
718
 
585
719
  return complexEigs;
586
720
  }
@@ -5,7 +5,7 @@ import { createRealSymmetric } from './eigs/realSymetric.js';
5
5
  import { typeOf, isNumber, isBigNumber, isComplex, isFraction } from '../../utils/is.js';
6
6
  var name = 'eigs'; // The absolute state of math.js's dependency system:
7
7
 
8
- var dependencies = ['config', 'typed', 'matrix', 'addScalar', 'equal', 'subtract', 'abs', 'atan', 'cos', 'sin', 'multiplyScalar', 'divideScalar', 'inv', 'bignumber', 'multiply', 'add', 'larger', 'column', 'flatten', 'number', 'complex', 'sqrt', 'diag', 'qr', 'usolveAll', 'im', 're', 'smaller', 'round', 'log10', 'transpose', 'matrixFromColumns'];
8
+ var dependencies = ['config', 'typed', 'matrix', 'addScalar', 'equal', 'subtract', 'abs', 'atan', 'cos', 'sin', 'multiplyScalar', 'divideScalar', 'inv', 'bignumber', 'multiply', 'add', 'larger', 'column', 'flatten', 'number', 'complex', 'sqrt', 'diag', 'qr', 'usolve', 'usolveAll', 'im', 're', 'smaller', 'matrixFromColumns', 'dot'];
9
9
  export var createEigs = /* #__PURE__ */factory(name, dependencies, _ref => {
10
10
  var {
11
11
  config,
@@ -32,14 +32,13 @@ export var createEigs = /* #__PURE__ */factory(name, dependencies, _ref => {
32
32
  sqrt,
33
33
  diag,
34
34
  qr,
35
+ usolve,
35
36
  usolveAll,
36
37
  im,
37
38
  re,
38
39
  smaller,
39
- round,
40
- log10,
41
- transpose,
42
- matrixFromColumns
40
+ matrixFromColumns,
41
+ dot
43
42
  } = _ref;
44
43
  var doRealSymetric = createRealSymmetric({
45
44
  config,
@@ -73,15 +72,14 @@ export var createEigs = /* #__PURE__ */factory(name, dependencies, _ref => {
73
72
  diag,
74
73
  qr,
75
74
  inv,
75
+ usolve,
76
76
  usolveAll,
77
77
  equal,
78
78
  complex,
79
79
  larger,
80
80
  smaller,
81
- round,
82
- log10,
83
- transpose,
84
- matrixFromColumns
81
+ matrixFromColumns,
82
+ dot
85
83
  });
86
84
  /**
87
85
  * Compute eigenvalues and eigenvectors of a matrix. The eigenvalues are sorted by their absolute value, ascending.
@@ -7,12 +7,11 @@ export var createBigNumberClass = /* #__PURE__ */factory(name, dependencies, _re
7
7
  on,
8
8
  config
9
9
  } = _ref;
10
- var EUCLID = 9; // Use euclidian division for mod calculation
11
-
12
10
  var BigNumber = Decimal.clone({
13
11
  precision: config.precision,
14
- modulo: EUCLID
12
+ modulo: Decimal.EUCLID
15
13
  });
14
+ BigNumber.prototype = Object.create(BigNumber.prototype);
16
15
  /**
17
16
  * Attach type information
18
17
  */
@@ -15,7 +15,19 @@ export function isNumber(x) {
15
15
  return typeof x === 'number';
16
16
  }
17
17
  export function isBigNumber(x) {
18
- return x && x.constructor.prototype.isBigNumber === true || false;
18
+ if (!x || typeof x !== 'object' || typeof x.constructor !== 'function') {
19
+ return false;
20
+ }
21
+
22
+ if (x.isBigNumber === true && typeof x.constructor.prototype === 'object' && x.constructor.prototype.isBigNumber === true) {
23
+ return true;
24
+ }
25
+
26
+ if (typeof x.constructor.isDecimal === 'function' && x.constructor.isDecimal(x) === true) {
27
+ return true;
28
+ }
29
+
30
+ return false;
19
31
  }
20
32
  export function isComplex(x) {
21
33
  return x && typeof x === 'object' && Object.getPrototypeOf(x).isComplex === true || false;
@@ -1,2 +1,2 @@
1
- export var version = '9.4.0'; // Note: This file is automatically generated when building math.js.
1
+ export var version = '9.4.4'; // 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": "9.4.0",
3
+ "version": "9.4.4",
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,27 +25,28 @@
25
25
  "unit"
26
26
  ],
27
27
  "dependencies": {
28
- "@babel/runtime": "^7.14.0",
29
- "complex.js": "^2.0.13",
30
- "decimal.js": "^10.2.1",
28
+ "@babel/runtime": "^7.14.6",
29
+ "complex.js": "^2.0.15",
30
+ "decimal.js": "^10.3.1",
31
31
  "escape-latex": "^1.2.0",
32
- "fraction.js": "^4.1.0",
32
+ "fraction.js": "^4.1.1",
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.14.2",
40
- "@babel/plugin-transform-object-assign": "7.12.13",
41
- "@babel/plugin-transform-runtime": "7.14.2",
42
- "@babel/preset-env": "7.14.2",
43
- "@babel/register": "7.13.16",
39
+ "@babel/core": "7.14.6",
40
+ "@babel/plugin-transform-object-assign": "7.14.5",
41
+ "@babel/plugin-transform-runtime": "7.14.5",
42
+ "@babel/preset-env": "7.14.7",
43
+ "@babel/register": "7.14.5",
44
44
  "babel-loader": "8.2.2",
45
45
  "benchmark": "2.1.4",
46
46
  "codecov": "3.8.2",
47
+ "core-js": "3.15.2",
47
48
  "del": "6.0.0",
48
- "dtslint": "^4.0.9",
49
+ "dtslint": "4.1.1",
49
50
  "expr-eval": "2.0.2",
50
51
  "fancy-log": "1.3.3",
51
52
  "glob": "7.1.7",
@@ -54,13 +55,13 @@
54
55
  "handlebars": "4.7.7",
55
56
  "istanbul": "0.4.5",
56
57
  "jsep": "0.4.0",
57
- "karma": "6.3.2",
58
+ "karma": "6.3.4",
58
59
  "karma-browserstack-launcher": "1.6.0",
59
- "karma-firefox-launcher": "2.1.0",
60
+ "karma-firefox-launcher": "2.1.1",
60
61
  "karma-mocha": "2.0.1",
61
62
  "karma-mocha-reporter": "2.2.5",
62
63
  "karma-webpack": "4.0.2",
63
- "math-expression-evaluator": "1.3.7",
64
+ "math-expression-evaluator": "1.3.8",
64
65
  "mkdirp": "1.0.4",
65
66
  "mocha": "8.4.0",
66
67
  "ndarray": "1.0.19",
@@ -73,7 +74,7 @@
73
74
  "pad-right": "0.2.2",
74
75
  "standard": "16.0.3",
75
76
  "sylvester": "0.0.21",
76
- "typescript": "^4.2.4",
77
+ "typescript": "4.3.5",
77
78
  "webpack": "4.46.0",
78
79
  "zeros": "1.0.0"
79
80
  },
@@ -114,6 +115,7 @@
114
115
  "lib",
115
116
  "examples",
116
117
  "main",
118
+ "types",
117
119
  "number.cjs",
118
120
  "LICENSE",
119
121
  "NOTICE",
@@ -131,13 +133,13 @@
131
133
  "lint": "standard --env=mocha --env=worker",
132
134
  "validate:ascii": "gulp --gulpfile gulpfile.cjs validate:ascii",
133
135
  "test": "npm run test:src && npm run lint",
134
- "test:src": "mocha test/unit-tests --recursive --forbid-only",
135
- "test:generated": "mocha test/generated-code-tests --recursive --forbid-only",
136
- "test:node": "mocha test/node-tests/*.test.js test/node-tests/**/*.test.js --recursive --forbid-only",
136
+ "test:src": "mocha test/unit-tests",
137
+ "test:generated": "mocha test/generated-code-tests",
138
+ "test:node": "mocha test/node-tests/*.test.js test/node-tests/**/*.test.js",
137
139
  "test:all": "npm run test:src && npm run test:generated && npm run test:node",
138
140
  "test:browser": "karma start test/browser-test-config/local-karma.js",
139
141
  "test:browserstack": "karma start test/browser-test-config/browserstack-karma.js",
140
- "coverage": "nyc --reporter=lcov --reporter=text-summary mocha test/unit-tests --recursive && echo \"\nDetailed coverage report is available at ./coverage/lcov-report/index.html\"",
142
+ "coverage": "nyc --reporter=lcov --reporter=text-summary mocha test/unit-tests && echo \"\nDetailed coverage report is available at ./coverage/lcov-report/index.html\"",
141
143
  "prepublishOnly": "npm run test:all && npm run lint",
142
144
  "prepare": "npm run build",
143
145
  "update-authors": "node ./tools/update-authors.js"
@@ -146,7 +148,7 @@
146
148
  "mathjs": "./bin/cli.js"
147
149
  },
148
150
  "engines": {
149
- "node": ">= 10"
151
+ "node": ">= 12"
150
152
  },
151
153
  "bugs": {
152
154
  "url": "https://github.com/josdejong/mathjs/issues"