mathjs 11.6.0 → 11.8.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.
Files changed (63) hide show
  1. package/HISTORY.md +23 -0
  2. package/README.md +0 -26
  3. package/lib/browser/math.js +1 -1
  4. package/lib/browser/math.js.LICENSE.txt +2 -2
  5. package/lib/browser/math.js.map +1 -1
  6. package/lib/cjs/core/function/typed.js +1 -1
  7. package/lib/cjs/expression/embeddedDocs/function/matrix/partitionSelect.js +1 -1
  8. package/lib/cjs/expression/node/FunctionAssignmentNode.js +1 -1
  9. package/lib/cjs/expression/node/OperatorNode.js +1 -3
  10. package/lib/cjs/expression/operators.js +19 -4
  11. package/lib/cjs/factoriesNumber.js +18 -0
  12. package/lib/cjs/function/algebra/rationalize.js +1 -3
  13. package/lib/cjs/function/algebra/simplifyConstant.js +1 -1
  14. package/lib/cjs/function/algebra/sparse/csAmd.js +1 -3
  15. package/lib/cjs/function/algebra/sparse/csLeaf.js +1 -3
  16. package/lib/cjs/function/arithmetic/expm1.js +1 -1
  17. package/lib/cjs/function/arithmetic/gcd.js +35 -12
  18. package/lib/cjs/function/arithmetic/nthRoots.js +2 -1
  19. package/lib/cjs/function/arithmetic/round.js +1 -1
  20. package/lib/cjs/function/arithmetic/sign.js +1 -1
  21. package/lib/cjs/function/bitwise/rightArithShift.js +1 -1
  22. package/lib/cjs/function/geometry/distance.js +13 -15
  23. package/lib/cjs/function/matrix/det.js +7 -1
  24. package/lib/cjs/function/matrix/diff.js +3 -3
  25. package/lib/cjs/function/matrix/eigs/complexEigs.js +3 -3
  26. package/lib/cjs/function/matrix/matrixFromColumns.js +1 -1
  27. package/lib/cjs/function/matrix/matrixFromRows.js +1 -1
  28. package/lib/cjs/function/matrix/partitionSelect.js +7 -2
  29. package/lib/cjs/function/set/setIsSubset.js +1 -1
  30. package/lib/cjs/function/set/setSize.js +3 -2
  31. package/lib/cjs/header.js +2 -2
  32. package/lib/cjs/type/matrix/DenseMatrix.js +41 -45
  33. package/lib/cjs/type/matrix/SparseMatrix.js +39 -41
  34. package/lib/cjs/type/unit/Unit.js +2 -0
  35. package/lib/cjs/utils/lruQueue.js +2 -6
  36. package/lib/cjs/utils/map.js +1 -1
  37. package/lib/cjs/utils/snapshot.js +7 -1
  38. package/lib/cjs/version.js +1 -1
  39. package/lib/esm/core/function/typed.js +1 -1
  40. package/lib/esm/expression/embeddedDocs/function/matrix/partitionSelect.js +1 -1
  41. package/lib/esm/expression/node/OperatorNode.js +1 -3
  42. package/lib/esm/expression/operators.js +1 -3
  43. package/lib/esm/function/algebra/rationalize.js +1 -3
  44. package/lib/esm/function/algebra/sparse/csAmd.js +1 -3
  45. package/lib/esm/function/algebra/sparse/csLeaf.js +1 -3
  46. package/lib/esm/function/arithmetic/expm1.js +1 -1
  47. package/lib/esm/function/arithmetic/gcd.js +27 -10
  48. package/lib/esm/function/arithmetic/nthRoots.js +2 -1
  49. package/lib/esm/function/arithmetic/round.js +1 -1
  50. package/lib/esm/function/arithmetic/sign.js +1 -1
  51. package/lib/esm/function/bitwise/rightArithShift.js +1 -1
  52. package/lib/esm/function/geometry/distance.js +13 -15
  53. package/lib/esm/function/matrix/det.js +7 -1
  54. package/lib/esm/function/matrix/diff.js +3 -3
  55. package/lib/esm/function/matrix/eigs/complexEigs.js +2 -2
  56. package/lib/esm/function/matrix/partitionSelect.js +7 -2
  57. package/lib/esm/function/set/setIsSubset.js +1 -1
  58. package/lib/esm/function/set/setSize.js +3 -2
  59. package/lib/esm/type/unit/Unit.js +2 -0
  60. package/lib/esm/utils/lruQueue.js +2 -6
  61. package/lib/esm/version.js +1 -1
  62. package/package.json +14 -14
  63. package/types/index.d.ts +251 -475
@@ -25,14 +25,19 @@ export var createPartitionSelect = /* #__PURE__ */factory(name, dependencies, _r
25
25
  *
26
26
  * Examples:
27
27
  *
28
- * math.partitionSelect([5, 10, 1], 2) // returns 10
29
- * math.partitionSelect(['C', 'B', 'A', 'D'], 1) // returns 'B'
28
+ * math.partitionSelect([5, 10, 1], 2) // returns 10
29
+ * math.partitionSelect(['C', 'B', 'A', 'D'], 1, math.compareText) // returns 'B'
30
30
  *
31
31
  * function sortByLength (a, b) {
32
32
  * return a.length - b.length
33
33
  * }
34
34
  * math.partitionSelect(['Langdon', 'Tom', 'Sara'], 2, sortByLength) // returns 'Langdon'
35
35
  *
36
+ * // the input array is mutated
37
+ * arr = [5, 2, 1]
38
+ * math.partitionSelect(arr, 0) // returns 1, arr is now: [1, 2, 5]
39
+ * math.partitionSelect(arr, 1, 'desc') // returns 2, arr is now: [5, 2, 1]
40
+ *
36
41
  * See also:
37
42
  *
38
43
  * sort
@@ -29,7 +29,7 @@ export var createSetIsSubset = /* #__PURE__ */factory(name, dependencies, _ref =
29
29
  *
30
30
  * @param {Array | Matrix} a1 A (multi)set
31
31
  * @param {Array | Matrix} a2 A (multi)set
32
- * @return {boolean} true | false
32
+ * @return {boolean} Returns true when a1 is a subset of a2, returns false otherwise
33
33
  */
34
34
  return typed(name, {
35
35
  'Array | Matrix, Array | Matrix': function ArrayMatrixArrayMatrix(a1, a2) {
@@ -25,8 +25,9 @@ export var createSetSize = /* #__PURE__ */factory(name, dependencies, _ref => {
25
25
  *
26
26
  * setUnion, setIntersect, setDifference
27
27
  *
28
- * @param {Array | Matrix} a A multiset
29
- * @return {number} The number of elements of the (multi)set
28
+ * @param {Array | Matrix} a A multiset
29
+ * @param {boolean} [unique] If true, only the unique values are counted. False by default
30
+ * @return {number} The number of elements of the (multi)set
30
31
  */
31
32
  return typed(name, {
32
33
  'Array | Matrix': function ArrayMatrix(a) {
@@ -3260,6 +3260,8 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref =>
3260
3260
  watts: 'watt',
3261
3261
  joules: 'joule',
3262
3262
  amperes: 'ampere',
3263
+ amps: 'ampere',
3264
+ amp: 'ampere',
3263
3265
  coulombs: 'coulomb',
3264
3266
  volts: 'volt',
3265
3267
  ohms: 'ohm',
@@ -19,9 +19,7 @@ export function lruQueue(limit) {
19
19
  base = 1;
20
20
  return;
21
21
  }
22
- while (!hasOwnProperty.call(queue, ++base)) {
23
- continue;
24
- }
22
+ while (!hasOwnProperty.call(queue, ++base)) continue;
25
23
  };
26
24
  limit = Math.abs(limit);
27
25
  return {
@@ -39,9 +37,7 @@ export function lruQueue(limit) {
39
37
  }
40
38
  delete queue[oldIndex];
41
39
  if (base !== oldIndex) return undefined;
42
- while (!hasOwnProperty.call(queue, ++base)) {
43
- continue;
44
- }
40
+ while (!hasOwnProperty.call(queue, ++base)) continue;
45
41
  return undefined;
46
42
  },
47
43
  delete: del,
@@ -1,3 +1,3 @@
1
- export var version = '11.6.0';
1
+ export var version = '11.8.0';
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": "11.6.0",
3
+ "version": "11.8.0",
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",
@@ -36,29 +36,29 @@
36
36
  "typed-function": "^4.1.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "7.21.0",
39
+ "@babel/core": "7.21.4",
40
40
  "@babel/plugin-transform-object-assign": "7.18.6",
41
- "@babel/plugin-transform-runtime": "7.21.0",
42
- "@babel/preset-env": "7.20.2",
41
+ "@babel/plugin-transform-runtime": "7.21.4",
42
+ "@babel/preset-env": "7.21.4",
43
43
  "@babel/register": "7.21.0",
44
44
  "@types/assert": "1.5.6",
45
45
  "@types/mocha": "10.0.1",
46
- "@typescript-eslint/eslint-plugin": "5.53.0",
47
- "@typescript-eslint/parser": "5.53.0",
46
+ "@typescript-eslint/eslint-plugin": "5.57.0",
47
+ "@typescript-eslint/parser": "5.57.0",
48
48
  "assert": "2.0.0",
49
49
  "babel-loader": "9.1.2",
50
50
  "benchmark": "2.1.4",
51
51
  "c8": "7.13.0",
52
52
  "codecov": "3.8.3",
53
- "core-js": "3.28.0",
53
+ "core-js": "3.29.1",
54
54
  "del": "6.1.1",
55
55
  "dtslint": "4.2.1",
56
- "eslint": "8.34.0",
57
- "eslint-config-prettier": "8.6.0",
56
+ "eslint": "8.37.0",
57
+ "eslint-config-prettier": "8.8.0",
58
58
  "eslint-config-standard": "17.0.0",
59
59
  "eslint-plugin-import": "2.27.5",
60
60
  "eslint-plugin-mocha": "10.1.0",
61
- "eslint-plugin-n": "15.6.1",
61
+ "eslint-plugin-n": "15.7.0",
62
62
  "eslint-plugin-prettier": "4.2.1",
63
63
  "eslint-plugin-promise": "6.1.1",
64
64
  "expect-type": "0.15.0",
@@ -75,7 +75,7 @@
75
75
  "karma-mocha": "2.0.1",
76
76
  "karma-mocha-reporter": "2.2.5",
77
77
  "karma-webpack": "5.0.0",
78
- "mkdirp": "2.1.3",
78
+ "mkdirp": "2.1.6",
79
79
  "mocha": "10.2.0",
80
80
  "mocha-junit-reporter": "2.2.0",
81
81
  "ndarray": "1.0.19",
@@ -85,12 +85,12 @@
85
85
  "ndarray-pack": "1.2.1",
86
86
  "numericjs": "1.2.6",
87
87
  "pad-right": "0.2.2",
88
- "prettier": "2.8.4",
88
+ "prettier": "2.8.7",
89
89
  "process": "0.11.10",
90
90
  "sylvester": "0.0.21",
91
91
  "ts-node": "10.9.1",
92
- "typescript": "4.9.5",
93
- "webpack": "5.75.0",
92
+ "typescript": "5.0.3",
93
+ "webpack": "5.77.0",
94
94
  "zeros": "1.0.0"
95
95
  },
96
96
  "type": "module",