mathjs 12.4.0 → 12.4.1

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 (61) hide show
  1. package/HISTORY.md +13 -0
  2. package/README.md +28 -0
  3. package/bin/cli.js +1 -1
  4. package/bin/repl.js +1 -1
  5. package/lib/browser/math.js +1 -1
  6. package/lib/browser/math.js.LICENSE.txt +2 -2
  7. package/lib/browser/math.js.map +1 -1
  8. package/lib/cjs/expression/node/ConstantNode.js +5 -3
  9. package/lib/cjs/function/algebra/simplifyCore.js +3 -0
  10. package/lib/cjs/function/algebra/sparse/csAmd.js +4 -2
  11. package/lib/cjs/function/algebra/sparse/csChol.js +4 -2
  12. package/lib/cjs/function/algebra/sparse/csCounts.js +4 -2
  13. package/lib/cjs/function/algebra/sparse/csCumsum.js +4 -2
  14. package/lib/cjs/function/algebra/sparse/csDfs.js +4 -2
  15. package/lib/cjs/function/algebra/sparse/csEreach.js +4 -2
  16. package/lib/cjs/function/algebra/sparse/csEtree.js +4 -2
  17. package/lib/cjs/function/algebra/sparse/csFkeep.js +4 -2
  18. package/lib/cjs/function/algebra/sparse/csFlip.js +4 -2
  19. package/lib/cjs/function/algebra/sparse/csIpvec.js +4 -0
  20. package/lib/cjs/function/algebra/sparse/csLeaf.js +4 -2
  21. package/lib/cjs/function/algebra/sparse/csLu.js +4 -2
  22. package/lib/cjs/function/algebra/sparse/csMark.js +4 -2
  23. package/lib/cjs/function/algebra/sparse/csMarked.js +4 -2
  24. package/lib/cjs/function/algebra/sparse/csPermute.js +4 -2
  25. package/lib/cjs/function/algebra/sparse/csPost.js +4 -2
  26. package/lib/cjs/function/algebra/sparse/csReach.js +4 -2
  27. package/lib/cjs/function/algebra/sparse/csSpsolve.js +4 -2
  28. package/lib/cjs/function/algebra/sparse/csSqr.js +4 -2
  29. package/lib/cjs/function/algebra/sparse/csSymperm.js +4 -2
  30. package/lib/cjs/function/algebra/sparse/csTdfs.js +4 -2
  31. package/lib/cjs/function/algebra/sparse/csUnflip.js +4 -2
  32. package/lib/cjs/header.js +2 -2
  33. package/lib/cjs/type/unit/Unit.js +6 -2
  34. package/lib/cjs/version.js +1 -1
  35. package/lib/esm/expression/node/ConstantNode.js +5 -3
  36. package/lib/esm/function/algebra/simplifyCore.js +3 -0
  37. package/lib/esm/function/algebra/sparse/csAmd.js +3 -2
  38. package/lib/esm/function/algebra/sparse/csChol.js +3 -2
  39. package/lib/esm/function/algebra/sparse/csCounts.js +3 -2
  40. package/lib/esm/function/algebra/sparse/csCumsum.js +4 -2
  41. package/lib/esm/function/algebra/sparse/csDfs.js +3 -2
  42. package/lib/esm/function/algebra/sparse/csEreach.js +3 -2
  43. package/lib/esm/function/algebra/sparse/csEtree.js +4 -2
  44. package/lib/esm/function/algebra/sparse/csFkeep.js +4 -2
  45. package/lib/esm/function/algebra/sparse/csFlip.js +4 -2
  46. package/lib/esm/function/algebra/sparse/csIpvec.js +4 -0
  47. package/lib/esm/function/algebra/sparse/csLeaf.js +4 -2
  48. package/lib/esm/function/algebra/sparse/csLu.js +4 -2
  49. package/lib/esm/function/algebra/sparse/csMark.js +4 -2
  50. package/lib/esm/function/algebra/sparse/csMarked.js +4 -2
  51. package/lib/esm/function/algebra/sparse/csPermute.js +4 -2
  52. package/lib/esm/function/algebra/sparse/csPost.js +3 -2
  53. package/lib/esm/function/algebra/sparse/csReach.js +4 -2
  54. package/lib/esm/function/algebra/sparse/csSpsolve.js +3 -2
  55. package/lib/esm/function/algebra/sparse/csSqr.js +3 -2
  56. package/lib/esm/function/algebra/sparse/csSymperm.js +3 -2
  57. package/lib/esm/function/algebra/sparse/csTdfs.js +4 -2
  58. package/lib/esm/function/algebra/sparse/csUnflip.js +3 -2
  59. package/lib/esm/type/unit/Unit.js +6 -2
  60. package/lib/esm/version.js +1 -1
  61. package/package.json +13 -13
@@ -1,3 +1,6 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
1
4
  import { csMark } from './csMark.js';
2
5
  import { csMarked } from './csMarked.js';
3
6
 
@@ -11,8 +14,6 @@ import { csMarked } from './csMarked.js';
11
14
  * The first n entries is the nonzero pattern, the last n entries is the stack
12
15
  *
13
16
  * @return {Number} The index for the nonzero pattern
14
- *
15
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
16
17
  */
17
18
  export function csEreach(a, k, parent, w) {
18
19
  // a arrays
@@ -1,11 +1,13 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * Computes the elimination tree of Matrix A (using triu(A)) or the
3
7
  * elimination tree of A'A without forming A'A.
4
8
  *
5
9
  * @param {Matrix} a The A Matrix
6
10
  * @param {boolean} ata A value of true the function computes the etree of A'A
7
- *
8
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
9
11
  */
10
12
  export function csEtree(a, ata) {
11
13
  // check inputs
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * Keeps entries in the matrix when the callback function returns true, removes the entry otherwise
3
7
  *
@@ -10,8 +14,6 @@
10
14
  * @param {any} other The state
11
15
  *
12
16
  * @return The number of nonzero elements in the matrix
13
- *
14
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
15
17
  */
16
18
  export function csFkeep(a, callback, other) {
17
19
  // a arrays
@@ -1,9 +1,11 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * This function "flips" its input about the integer -1.
3
7
  *
4
8
  * @param {Number} i The value to flip
5
- *
6
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
7
9
  */
8
10
  export function csFlip(i) {
9
11
  // flip the value
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * Permutes a vector; x = P'b. In MATLAB notation, x(p)=b.
3
7
  *
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * This function determines if j is a leaf of the ith row subtree.
3
7
  * Consider A(i,j), node j in ith row subtree and return lca(jprev,j)
@@ -11,8 +15,6 @@
11
15
  * @param {Number} ancestor The index offset within the workspace for the ancestor array
12
16
  *
13
17
  * @return {Object}
14
- *
15
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
16
18
  */
17
19
  export function csLeaf(i, j, w, first, maxfirst, prevleaf, ancestor) {
18
20
  var s, sparent;
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  import { factory } from '../../../utils/factory.js';
2
6
  import { createCsSpsolve } from './csSpsolve.js';
3
7
  var name = 'csLu';
@@ -30,8 +34,6 @@ export var createCsLu = /* #__PURE__ */factory(name, dependencies, _ref => {
30
34
  * @param {Number} tol Partial pivoting threshold (1 for partial pivoting)
31
35
  *
32
36
  * @return {Number} The numeric LU factorization of A or null
33
- *
34
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
35
37
  */
36
38
  return function csLu(m, s, tol) {
37
39
  // validate input
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  import { csFlip } from './csFlip.js';
2
6
 
3
7
  /**
@@ -5,8 +9,6 @@ import { csFlip } from './csFlip.js';
5
9
  *
6
10
  * @param {Array} w The array
7
11
  * @param {Number} j The array index
8
- *
9
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
10
12
  */
11
13
  export function csMark(w, j) {
12
14
  // mark w[j]
@@ -1,10 +1,12 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * Checks if the node at w[j] is marked
3
7
  *
4
8
  * @param {Array} w The array
5
9
  * @param {Number} j The array index
6
- *
7
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
8
10
  */
9
11
  export function csMarked(w, j) {
10
12
  // check node is marked
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * Permutes a sparse matrix C = P * A * Q
3
7
  *
@@ -7,8 +11,6 @@
7
11
  * @param {boolean} values Create a pattern matrix (false), values and pattern otherwise
8
12
  *
9
13
  * @return {Matrix} C = P * A * Q, null on error
10
- *
11
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
12
14
  */
13
15
  export function csPermute(a, pinv, q, values) {
14
16
  // a arrays
@@ -1,3 +1,6 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
1
4
  import { csTdfs } from './csTdfs.js';
2
5
 
3
6
  /**
@@ -5,8 +8,6 @@ import { csTdfs } from './csTdfs.js';
5
8
  *
6
9
  * @param {Array} parent The tree or forest
7
10
  * @param {Number} n Number of columns
8
- *
9
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
10
11
  */
11
12
  export function csPost(parent, n) {
12
13
  // check inputs
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  import { csMarked } from './csMarked.js';
2
6
  import { csMark } from './csMark.js';
3
7
  import { csDfs } from './csDfs.js';
@@ -15,8 +19,6 @@ import { csDfs } from './csDfs.js';
15
19
  * @param {Array} pinv The inverse row permutation vector
16
20
  *
17
21
  * @return {Number} The index for the nonzero pattern
18
- *
19
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
20
22
  */
21
23
  export function csReach(g, b, k, xi, pinv) {
22
24
  // g arrays
@@ -1,3 +1,6 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
1
4
  import { csReach } from './csReach.js';
2
5
  import { factory } from '../../../utils/factory.js';
3
6
  var name = 'csSpsolve';
@@ -24,8 +27,6 @@ export var createCsSpsolve = /* #__PURE__ */factory(name, dependencies, _ref =>
24
27
  * @param {boolean} lo The lower (true) upper triangular (false) flag
25
28
  *
26
29
  * @return {Number} The index for the nonzero pattern
27
- *
28
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
29
30
  */
30
31
  return function csSpsolve(g, b, k, xi, x, pinv, lo) {
31
32
  // g arrays
@@ -1,3 +1,6 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
1
4
  import { csPermute } from './csPermute.js';
2
5
  import { csPost } from './csPost.js';
3
6
  import { csEtree } from './csEtree.js';
@@ -30,8 +33,6 @@ export var createCsSqr = /* #__PURE__ */factory(name, dependencies, _ref => {
30
33
  * symbolic ordering and analysis for LU decomposition (false)
31
34
  *
32
35
  * @return {Object} The Symbolic ordering and analysis for matrix A
33
- *
34
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
35
36
  */
36
37
  return function csSqr(order, a, qr) {
37
38
  // a arrays
@@ -1,3 +1,6 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
1
4
  import { csCumsum } from './csCumsum.js';
2
5
  import { factory } from '../../../utils/factory.js';
3
6
  var name = 'csSymperm';
@@ -18,8 +21,6 @@ export var createCsSymperm = /* #__PURE__ */factory(name, dependencies, _ref =>
18
21
  * @param {boolean} values Process matrix values (true)
19
22
  *
20
23
  * @return {Matrix} The C matrix, C = P * A * P'
21
- *
22
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
23
24
  */
24
25
  return function csSymperm(a, pinv, values) {
25
26
  // A matrix arrays
@@ -1,3 +1,7 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
4
+
1
5
  /**
2
6
  * Depth-first search and postorder of a tree rooted at node j
3
7
  *
@@ -8,8 +12,6 @@
8
12
  * @param {Number} next The index offset within the workspace for the next array
9
13
  * @param {Array} post The post ordering array
10
14
  * @param {Number} stack The index offset within the workspace for the stack array
11
- *
12
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
13
15
  */
14
16
  export function csTdfs(j, k, w, head, next, post, stack) {
15
17
  // variables
@@ -1,11 +1,12 @@
1
+ // Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.
2
+ // SPDX-License-Identifier: LGPL-2.1+
3
+ // https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source
1
4
  import { csFlip } from './csFlip.js';
2
5
 
3
6
  /**
4
7
  * Flips the value if it is negative of returns the same value otherwise.
5
8
  *
6
9
  * @param {Number} i The value to flip
7
- *
8
- * Reference: http://faculty.cse.tamu.edu/davis/publications.html
9
10
  */
10
11
  export function csUnflip(i) {
11
12
  // flip the value if it is negative
@@ -3267,6 +3267,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
3267
3267
  };
3268
3268
 
3269
3269
  // aliases (formerly plurals)
3270
+ // note that ALIASES is only used at creation to create more entries in UNITS by copying the aliased units
3270
3271
  var ALIASES = {
3271
3272
  meters: 'meter',
3272
3273
  inches: 'inch',
@@ -3912,13 +3913,16 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
3912
3913
  _alias.name = aliasName;
3913
3914
  Unit.UNITS[aliasName] = _alias;
3914
3915
  }
3915
- // delete the memoization cache, since adding a new unit to the array
3916
- // invalidates all old results
3916
+
3917
+ // delete the memoization cache because we created a new unit
3917
3918
  delete _findUnit.cache;
3918
3919
  return new Unit(null, name);
3919
3920
  };
3920
3921
  Unit.deleteUnit = function (name) {
3921
3922
  delete Unit.UNITS[name];
3923
+
3924
+ // delete the memoization cache because we deleted a unit
3925
+ delete _findUnit.cache;
3922
3926
  };
3923
3927
 
3924
3928
  // expose arrays with prefixes, dimensions, units, systems
@@ -1,3 +1,3 @@
1
- export var version = '12.4.0';
1
+ export var version = '12.4.1';
2
2
  // Note: This file is automatically generated when building math.js.
3
3
  // Changes made in this file will be overwritten.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mathjs",
3
- "version": "12.4.0",
3
+ "version": "12.4.1",
4
4
  "description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
5
5
  "author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
6
6
  "homepage": "https://mathjs.org",
@@ -25,7 +25,7 @@
25
25
  "unit"
26
26
  ],
27
27
  "dependencies": {
28
- "@babel/runtime": "^7.23.9",
28
+ "@babel/runtime": "^7.24.0",
29
29
  "complex.js": "^2.1.1",
30
30
  "decimal.js": "^10.4.3",
31
31
  "escape-latex": "^1.2.0",
@@ -36,15 +36,15 @@
36
36
  "typed-function": "^4.1.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "7.23.9",
39
+ "@babel/core": "7.24.0",
40
40
  "@babel/plugin-transform-object-assign": "7.23.3",
41
- "@babel/plugin-transform-runtime": "7.23.9",
42
- "@babel/preset-env": "7.23.9",
41
+ "@babel/plugin-transform-runtime": "7.24.0",
42
+ "@babel/preset-env": "7.24.0",
43
43
  "@babel/register": "7.23.7",
44
44
  "@types/assert": "1.5.10",
45
45
  "@types/mocha": "10.0.6",
46
- "@typescript-eslint/eslint-plugin": "7.0.2",
47
- "@typescript-eslint/parser": "7.0.2",
46
+ "@typescript-eslint/eslint-plugin": "7.2.0",
47
+ "@typescript-eslint/parser": "7.2.0",
48
48
  "assert": "2.1.0",
49
49
  "babel-loader": "9.1.3",
50
50
  "benchmark": "2.1.4",
@@ -53,15 +53,15 @@
53
53
  "core-js": "3.36.0",
54
54
  "del": "6.1.1",
55
55
  "dtslint": "4.2.1",
56
- "eslint": "8.56.0",
56
+ "eslint": "8.57.0",
57
57
  "eslint-config-prettier": "9.1.0",
58
58
  "eslint-config-standard": "17.1.0",
59
59
  "eslint-plugin-import": "2.29.1",
60
- "eslint-plugin-mocha": "10.3.0",
60
+ "eslint-plugin-mocha": "10.4.1",
61
61
  "eslint-plugin-n": "16.6.2",
62
62
  "eslint-plugin-prettier": "5.1.3",
63
63
  "eslint-plugin-promise": "6.1.1",
64
- "expect-type": "0.17.3",
64
+ "expect-type": "0.18.0",
65
65
  "expr-eval": "2.0.2",
66
66
  "fancy-log": "2.0.0",
67
67
  "glob": "8.1.0",
@@ -69,9 +69,9 @@
69
69
  "gulp-babel": "8.0.0",
70
70
  "handlebars": "4.7.8",
71
71
  "jsep": "1.3.8",
72
- "karma": "6.4.2",
72
+ "karma": "6.4.3",
73
73
  "karma-browserstack-launcher": "1.6.0",
74
- "karma-firefox-launcher": "2.1.2",
74
+ "karma-firefox-launcher": "2.1.3",
75
75
  "karma-mocha": "2.0.1",
76
76
  "karma-mocha-reporter": "2.2.5",
77
77
  "karma-webpack": "5.0.1",
@@ -89,7 +89,7 @@
89
89
  "process": "0.11.10",
90
90
  "sylvester": "0.0.21",
91
91
  "ts-node": "10.9.2",
92
- "typescript": "5.3.3",
92
+ "typescript": "5.4.2",
93
93
  "webpack": "5.90.3",
94
94
  "zeros": "1.0.0"
95
95
  },