mathjs 12.3.2 → 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 (92) hide show
  1. package/HISTORY.md +28 -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/entry/pureFunctionsAny.generated.js +1 -0
  9. package/lib/cjs/expression/node/ConstantNode.js +5 -3
  10. package/lib/cjs/expression/parse.js +8 -4
  11. package/lib/cjs/function/algebra/simplifyCore.js +3 -0
  12. package/lib/cjs/function/algebra/sparse/csAmd.js +4 -2
  13. package/lib/cjs/function/algebra/sparse/csChol.js +4 -2
  14. package/lib/cjs/function/algebra/sparse/csCounts.js +4 -2
  15. package/lib/cjs/function/algebra/sparse/csCumsum.js +4 -2
  16. package/lib/cjs/function/algebra/sparse/csDfs.js +4 -2
  17. package/lib/cjs/function/algebra/sparse/csEreach.js +4 -2
  18. package/lib/cjs/function/algebra/sparse/csEtree.js +4 -2
  19. package/lib/cjs/function/algebra/sparse/csFkeep.js +4 -2
  20. package/lib/cjs/function/algebra/sparse/csFlip.js +4 -2
  21. package/lib/cjs/function/algebra/sparse/csIpvec.js +4 -0
  22. package/lib/cjs/function/algebra/sparse/csLeaf.js +4 -2
  23. package/lib/cjs/function/algebra/sparse/csLu.js +4 -2
  24. package/lib/cjs/function/algebra/sparse/csMark.js +4 -2
  25. package/lib/cjs/function/algebra/sparse/csMarked.js +4 -2
  26. package/lib/cjs/function/algebra/sparse/csPermute.js +4 -2
  27. package/lib/cjs/function/algebra/sparse/csPost.js +4 -2
  28. package/lib/cjs/function/algebra/sparse/csReach.js +4 -2
  29. package/lib/cjs/function/algebra/sparse/csSpsolve.js +4 -2
  30. package/lib/cjs/function/algebra/sparse/csSqr.js +4 -2
  31. package/lib/cjs/function/algebra/sparse/csSymperm.js +4 -2
  32. package/lib/cjs/function/algebra/sparse/csTdfs.js +4 -2
  33. package/lib/cjs/function/algebra/sparse/csUnflip.js +4 -2
  34. package/lib/cjs/function/arithmetic/multiply.js +30 -29
  35. package/lib/cjs/function/arithmetic/round.js +38 -7
  36. package/lib/cjs/function/matrix/dot.js +3 -3
  37. package/lib/cjs/header.js +2 -2
  38. package/lib/cjs/type/matrix/utils/matAlgo01xDSid.js +4 -4
  39. package/lib/cjs/type/matrix/utils/matAlgo02xDS0.js +4 -4
  40. package/lib/cjs/type/matrix/utils/matAlgo03xDSf.js +4 -4
  41. package/lib/cjs/type/matrix/utils/matAlgo04xSidSid.js +4 -4
  42. package/lib/cjs/type/matrix/utils/matAlgo05xSfSf.js +4 -4
  43. package/lib/cjs/type/matrix/utils/matAlgo06xS0S0.js +4 -4
  44. package/lib/cjs/type/matrix/utils/matAlgo07xSSf.js +4 -4
  45. package/lib/cjs/type/matrix/utils/matAlgo08xS0Sid.js +4 -4
  46. package/lib/cjs/type/matrix/utils/matAlgo09xS0Sf.js +4 -4
  47. package/lib/cjs/type/unit/Unit.js +6 -2
  48. package/lib/cjs/utils/map.js +2 -0
  49. package/lib/cjs/version.js +1 -1
  50. package/lib/esm/entry/pureFunctionsAny.generated.js +1 -0
  51. package/lib/esm/expression/node/ConstantNode.js +5 -3
  52. package/lib/esm/expression/parse.js +8 -4
  53. package/lib/esm/function/algebra/simplifyCore.js +3 -0
  54. package/lib/esm/function/algebra/sparse/csAmd.js +3 -2
  55. package/lib/esm/function/algebra/sparse/csChol.js +3 -2
  56. package/lib/esm/function/algebra/sparse/csCounts.js +3 -2
  57. package/lib/esm/function/algebra/sparse/csCumsum.js +4 -2
  58. package/lib/esm/function/algebra/sparse/csDfs.js +3 -2
  59. package/lib/esm/function/algebra/sparse/csEreach.js +3 -2
  60. package/lib/esm/function/algebra/sparse/csEtree.js +4 -2
  61. package/lib/esm/function/algebra/sparse/csFkeep.js +4 -2
  62. package/lib/esm/function/algebra/sparse/csFlip.js +4 -2
  63. package/lib/esm/function/algebra/sparse/csIpvec.js +4 -0
  64. package/lib/esm/function/algebra/sparse/csLeaf.js +4 -2
  65. package/lib/esm/function/algebra/sparse/csLu.js +4 -2
  66. package/lib/esm/function/algebra/sparse/csMark.js +4 -2
  67. package/lib/esm/function/algebra/sparse/csMarked.js +4 -2
  68. package/lib/esm/function/algebra/sparse/csPermute.js +4 -2
  69. package/lib/esm/function/algebra/sparse/csPost.js +3 -2
  70. package/lib/esm/function/algebra/sparse/csReach.js +4 -2
  71. package/lib/esm/function/algebra/sparse/csSpsolve.js +3 -2
  72. package/lib/esm/function/algebra/sparse/csSqr.js +3 -2
  73. package/lib/esm/function/algebra/sparse/csSymperm.js +3 -2
  74. package/lib/esm/function/algebra/sparse/csTdfs.js +4 -2
  75. package/lib/esm/function/algebra/sparse/csUnflip.js +3 -2
  76. package/lib/esm/function/arithmetic/multiply.js +30 -29
  77. package/lib/esm/function/arithmetic/round.js +38 -7
  78. package/lib/esm/function/matrix/dot.js +3 -3
  79. package/lib/esm/type/matrix/utils/matAlgo01xDSid.js +4 -4
  80. package/lib/esm/type/matrix/utils/matAlgo02xDS0.js +4 -4
  81. package/lib/esm/type/matrix/utils/matAlgo03xDSf.js +4 -4
  82. package/lib/esm/type/matrix/utils/matAlgo04xSidSid.js +4 -4
  83. package/lib/esm/type/matrix/utils/matAlgo05xSfSf.js +4 -4
  84. package/lib/esm/type/matrix/utils/matAlgo06xS0S0.js +4 -4
  85. package/lib/esm/type/matrix/utils/matAlgo07xSSf.js +4 -4
  86. package/lib/esm/type/matrix/utils/matAlgo08xS0Sid.js +4 -4
  87. package/lib/esm/type/matrix/utils/matAlgo09xS0Sf.js +4 -4
  88. package/lib/esm/type/unit/Unit.js +6 -2
  89. package/lib/esm/utils/map.js +2 -0
  90. package/lib/esm/version.js +1 -1
  91. package/package.json +16 -16
  92. package/types/index.d.ts +5 -5
@@ -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
@@ -12,6 +12,7 @@ import { isObject } from './is.js';
12
12
  export class ObjectWrappingMap {
13
13
  constructor(object) {
14
14
  this.wrappedObject = object;
15
+ this[Symbol.iterator] = this.entries;
15
16
  }
16
17
  keys() {
17
18
  return Object.keys(this.wrappedObject).values();
@@ -71,6 +72,7 @@ export class PartitionedMap {
71
72
  this.a = a;
72
73
  this.b = b;
73
74
  this.bKeys = bKeys;
75
+ this[Symbol.iterator] = this.entries;
74
76
  }
75
77
  get(key) {
76
78
  return this.bKeys.has(key) ? this.b.get(key) : this.a.get(key);
@@ -1,3 +1,3 @@
1
- export var version = '12.3.2';
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.3.2",
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,32 +36,32 @@
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": "6.21.0",
47
- "@typescript-eslint/parser": "6.21.0",
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",
51
51
  "c8": "9.1.0",
52
52
  "codecov": "3.8.3",
53
- "core-js": "3.35.1",
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.2.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,14 +69,14 @@
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",
78
78
  "mkdirp": "3.0.1",
79
- "mocha": "10.2.0",
79
+ "mocha": "10.3.0",
80
80
  "mocha-junit-reporter": "2.2.1",
81
81
  "ndarray": "1.0.19",
82
82
  "ndarray-determinant": "1.0.0",
@@ -89,8 +89,8 @@
89
89
  "process": "0.11.10",
90
90
  "sylvester": "0.0.21",
91
91
  "ts-node": "10.9.2",
92
- "typescript": "5.3.3",
93
- "webpack": "5.90.1",
92
+ "typescript": "5.4.2",
93
+ "webpack": "5.90.3",
94
94
  "zeros": "1.0.0"
95
95
  },
96
96
  "type": "module",
package/types/index.d.ts CHANGED
@@ -2760,22 +2760,22 @@ export interface MathJsInstance extends MathJsFactory {
2760
2760
  * @param args Multiple scalar values
2761
2761
  * @returns The mode of all values
2762
2762
  */
2763
- mode<T extends MathScalarType>(...args: T[]): T
2763
+ mode<T extends MathScalarType>(...args: T[]): T[]
2764
2764
  /**
2765
2765
  * @param args Multiple scalar values
2766
2766
  * @returns The mode of all values
2767
2767
  */
2768
- mode(...args: MathScalarType[]): MathScalarType
2768
+ mode(...args: MathScalarType[]): MathScalarType[]
2769
2769
  /**
2770
2770
  * @param A A single matrix
2771
- * @returns The median value
2771
+ * @returns The mode value
2772
2772
  */
2773
- mode<T extends MathScalarType>(A: T[] | T[][]): T
2773
+ mode<T extends MathScalarType>(A: T[] | T[][]): T[]
2774
2774
  /**
2775
2775
  * @param A A single matrix
2776
2776
  * @returns The mode of all values
2777
2777
  */
2778
- mode(A: MathCollection): MathScalarType
2778
+ mode(A: MathCollection): MathScalarType[]
2779
2779
 
2780
2780
  /**
2781
2781
  * Compute the product of a matrix or a list with values. In case of a