mathjs 11.5.0 → 11.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/HISTORY.md +18 -0
  2. package/NOTICE +1 -1
  3. package/README.md +2 -2
  4. package/bin/cli.js +1 -1
  5. package/lib/browser/math.js +1 -1
  6. package/lib/browser/math.js.LICENSE.txt +3 -3
  7. package/lib/browser/math.js.map +1 -1
  8. package/lib/cjs/expression/embeddedDocs/function/arithmetic/invmod.js +1 -1
  9. package/lib/cjs/expression/embeddedDocs/function/arithmetic/pow.js +1 -1
  10. package/lib/cjs/expression/embeddedDocs/function/matrix/matrixFromColumns.js +1 -1
  11. package/lib/cjs/expression/embeddedDocs/function/matrix/matrixFromFunction.js +1 -1
  12. package/lib/cjs/expression/embeddedDocs/function/matrix/matrixFromRows.js +1 -1
  13. package/lib/cjs/expression/embeddedDocs/function/matrix/rotate.js +1 -1
  14. package/lib/cjs/expression/embeddedDocs/function/probability/lgamma.js +1 -1
  15. package/lib/cjs/expression/embeddedDocs/function/statistics/max.js +1 -1
  16. package/lib/cjs/expression/embeddedDocs/function/statistics/mean.js +1 -1
  17. package/lib/cjs/expression/embeddedDocs/function/statistics/min.js +1 -1
  18. package/lib/cjs/expression/embeddedDocs/function/statistics/std.js +1 -1
  19. package/lib/cjs/expression/embeddedDocs/function/statistics/sum.js +1 -1
  20. package/lib/cjs/expression/embeddedDocs/function/statistics/variance.js +1 -1
  21. package/lib/cjs/function/statistics/max.js +2 -2
  22. package/lib/cjs/function/statistics/mean.js +2 -2
  23. package/lib/cjs/function/statistics/min.js +2 -2
  24. package/lib/cjs/function/statistics/mode.js +1 -1
  25. package/lib/cjs/function/statistics/prod.js +1 -1
  26. package/lib/cjs/function/statistics/quantileSeq.js +1 -1
  27. package/lib/cjs/function/statistics/sum.js +3 -2
  28. package/lib/cjs/function/statistics/variance.js +1 -1
  29. package/lib/cjs/header.js +3 -3
  30. package/lib/cjs/version.js +1 -1
  31. package/lib/esm/expression/embeddedDocs/function/arithmetic/invmod.js +1 -1
  32. package/lib/esm/expression/embeddedDocs/function/arithmetic/pow.js +1 -1
  33. package/lib/esm/expression/embeddedDocs/function/matrix/matrixFromColumns.js +1 -1
  34. package/lib/esm/expression/embeddedDocs/function/matrix/matrixFromFunction.js +1 -1
  35. package/lib/esm/expression/embeddedDocs/function/matrix/matrixFromRows.js +1 -1
  36. package/lib/esm/expression/embeddedDocs/function/matrix/rotate.js +1 -1
  37. package/lib/esm/expression/embeddedDocs/function/probability/lgamma.js +1 -1
  38. package/lib/esm/expression/embeddedDocs/function/statistics/max.js +1 -1
  39. package/lib/esm/expression/embeddedDocs/function/statistics/mean.js +1 -1
  40. package/lib/esm/expression/embeddedDocs/function/statistics/min.js +1 -1
  41. package/lib/esm/expression/embeddedDocs/function/statistics/std.js +1 -1
  42. package/lib/esm/expression/embeddedDocs/function/statistics/sum.js +1 -1
  43. package/lib/esm/expression/embeddedDocs/function/statistics/variance.js +1 -1
  44. package/lib/esm/function/statistics/max.js +2 -2
  45. package/lib/esm/function/statistics/mean.js +2 -2
  46. package/lib/esm/function/statistics/min.js +2 -2
  47. package/lib/esm/function/statistics/mode.js +1 -1
  48. package/lib/esm/function/statistics/prod.js +1 -1
  49. package/lib/esm/function/statistics/quantileSeq.js +1 -1
  50. package/lib/esm/function/statistics/sum.js +3 -2
  51. package/lib/esm/function/statistics/variance.js +1 -1
  52. package/lib/esm/header.js +1 -1
  53. package/lib/esm/version.js +1 -1
  54. package/package.json +19 -21
  55. package/types/index.d.ts +66 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mathjs",
3
- "version": "11.5.0",
3
+ "version": "11.5.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.20.6",
28
+ "@babel/runtime": "^7.20.13",
29
29
  "complex.js": "^2.1.1",
30
30
  "decimal.js": "^10.4.3",
31
31
  "escape-latex": "^1.2.0",
@@ -36,48 +36,47 @@
36
36
  "typed-function": "^4.1.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "7.20.5",
39
+ "@babel/core": "7.20.12",
40
40
  "@babel/plugin-transform-object-assign": "7.18.6",
41
41
  "@babel/plugin-transform-runtime": "7.19.6",
42
42
  "@babel/preset-env": "7.20.2",
43
43
  "@babel/register": "7.18.9",
44
44
  "@types/assert": "1.5.6",
45
45
  "@types/mocha": "10.0.1",
46
- "@typescript-eslint/eslint-plugin": "5.45.0",
47
- "@typescript-eslint/parser": "5.45.0",
46
+ "@typescript-eslint/eslint-plugin": "5.50.0",
47
+ "@typescript-eslint/parser": "5.50.0",
48
48
  "assert": "2.0.0",
49
- "babel-loader": "9.1.0",
49
+ "babel-loader": "9.1.2",
50
50
  "benchmark": "2.1.4",
51
+ "c8": "7.12.0",
51
52
  "codecov": "3.8.3",
52
- "core-js": "3.26.1",
53
+ "core-js": "3.27.2",
53
54
  "del": "6.1.1",
54
55
  "dtslint": "4.2.1",
55
- "eslint": "8.29.0",
56
- "eslint-config-prettier": "8.5.0",
56
+ "eslint": "8.33.0",
57
+ "eslint-config-prettier": "8.6.0",
57
58
  "eslint-config-standard": "17.0.0",
58
- "eslint-plugin-import": "2.26.0",
59
+ "eslint-plugin-import": "2.27.5",
59
60
  "eslint-plugin-mocha": "10.1.0",
60
- "eslint-plugin-n": "15.6.0",
61
+ "eslint-plugin-n": "15.6.1",
61
62
  "eslint-plugin-prettier": "4.2.1",
62
63
  "eslint-plugin-promise": "6.1.1",
63
64
  "expect-type": "0.15.0",
64
65
  "expr-eval": "2.0.2",
65
66
  "fancy-log": "2.0.0",
66
- "glob": "8.0.3",
67
+ "glob": "8.1.0",
67
68
  "gulp": "4.0.2",
68
69
  "gulp-babel": "8.0.0",
69
70
  "handlebars": "4.7.7",
70
- "istanbul": "0.4.5",
71
- "jsep": "1.3.7",
71
+ "jsep": "1.3.8",
72
72
  "karma": "6.4.1",
73
73
  "karma-browserstack-launcher": "1.6.0",
74
74
  "karma-firefox-launcher": "2.1.2",
75
75
  "karma-mocha": "2.0.1",
76
76
  "karma-mocha-reporter": "2.2.5",
77
77
  "karma-webpack": "5.0.0",
78
- "math-expression-evaluator": "1.4.0",
79
- "mkdirp": "1.0.4",
80
- "mocha": "10.1.0",
78
+ "mkdirp": "2.1.3",
79
+ "mocha": "10.2.0",
81
80
  "mocha-junit-reporter": "2.2.0",
82
81
  "ndarray": "1.0.19",
83
82
  "ndarray-determinant": "1.0.0",
@@ -85,13 +84,12 @@
85
84
  "ndarray-ops": "1.2.2",
86
85
  "ndarray-pack": "1.2.1",
87
86
  "numericjs": "1.2.6",
88
- "nyc": "15.1.0",
89
87
  "pad-right": "0.2.2",
90
- "prettier": "2.8.0",
88
+ "prettier": "2.8.3",
91
89
  "process": "0.11.10",
92
90
  "sylvester": "0.0.21",
93
91
  "ts-node": "10.9.1",
94
- "typescript": "4.9.3",
92
+ "typescript": "4.9.5",
95
93
  "webpack": "5.75.0",
96
94
  "zeros": "1.0.0"
97
95
  },
@@ -163,7 +161,7 @@
163
161
  "test:browser": "karma start test/browser-test-config/local-karma.js",
164
162
  "test:browserstack": "karma start test/browser-test-config/browserstack-karma.js",
165
163
  "test:types": " tsc -p ./tsconfig.json && node --loader ts-node/esm ./test/typescript-tests/testTypes.ts",
166
- "coverage": "nyc --reporter=lcov --reporter=text-summary mocha test/unit-tests && echo \"\nDetailed coverage report is available at ./coverage/lcov-report/index.html\"",
164
+ "coverage": "c8 --reporter=lcov --reporter=text-summary mocha test/unit-tests && echo \"\nDetailed coverage report is available at ./coverage/lcov-report/index.html\"",
167
165
  "prepublishOnly": "npm run test:all && npm run lint",
168
166
  "update-authors": "node ./tools/update-authors.js"
169
167
  },
package/types/index.d.ts CHANGED
@@ -622,7 +622,7 @@ declare namespace math {
622
622
  * complex number
623
623
  * @returns Returns a complex value
624
624
  */
625
- complex(arg?: Complex | string | PolarCoordinates): Complex
625
+ complex(arg?: MathNumericType | string | PolarCoordinates): Complex
626
626
  complex(arg?: MathCollection): MathCollection
627
627
  /**
628
628
  * @param re Argument specifying the real part of the complex number
@@ -899,6 +899,8 @@ declare namespace math {
899
899
  threshold?: number
900
900
  ): MathArray
901
901
 
902
+ lusolve(A: LUDecomposition, b: Matrix | MathArray): Matrix
903
+
902
904
  /* Finds the roots of a polynomial of degree three or less. Coefficients are given constant first
903
905
  * followed by linear and higher powers in order; coefficients beyond the degree of the polynomial
904
906
  * need not be specified.
@@ -1147,7 +1149,11 @@ declare namespace math {
1147
1149
  * @param y Denominator
1148
1150
  * @returns Quotient, x ./ y
1149
1151
  */
1150
- dotDivide(x: MathType, y: MathType): MathType
1152
+ dotDivide<T extends MathCollection>(x: T, y: MathType): T
1153
+ dotDivide<T extends MathCollection>(x: MathType, y: T): T
1154
+ dotDivide(x: Unit, y: MathType): Unit
1155
+ dotDivide(x: MathType, y: Unit): Unit
1156
+ dotDivide(x: MathNumericType, y: MathNumericType): MathNumericType
1151
1157
 
1152
1158
  /**
1153
1159
  * Multiply two matrices element wise. The function accepts both
@@ -1156,7 +1162,11 @@ declare namespace math {
1156
1162
  * @param y Right hand value
1157
1163
  * @returns Multiplication of x and y
1158
1164
  */
1159
- dotMultiply(x: MathType, y: MathType): MathType
1165
+ dotMultiply<T extends MathCollection>(x: T, y: MathType): T
1166
+ dotMultiply<T extends MathCollection>(x: MathType, y: T): T
1167
+ dotMultiply(x: Unit, y: MathType): Unit
1168
+ dotMultiply(x: MathType, y: Unit): Unit
1169
+ dotMultiply(x: MathNumericType, y: MathNumericType): MathNumericType
1160
1170
 
1161
1171
  /**
1162
1172
  * Calculates the power of x to y element wise.
@@ -1164,7 +1174,7 @@ declare namespace math {
1164
1174
  * @param y The exponent
1165
1175
  * @returns The value of x to the power y
1166
1176
  */
1167
- dotPow(x: MathType, y: MathType): MathType
1177
+ dotPow<T extends MathType>(x: T, y: MathType): T
1168
1178
 
1169
1179
  /**
1170
1180
  * Calculate the exponent of a value. For matrices, the function is
@@ -2072,6 +2082,19 @@ declare namespace math {
2072
2082
  defaultValue?: number | string
2073
2083
  ): T
2074
2084
 
2085
+ /**
2086
+ * Return a Rotation Matrix for a given angle in radians
2087
+ * @param {number | BigNumber | Complex | Unit} theta Rotation angle
2088
+ * @param {Array | Matrix} [v] Rotation axis
2089
+ * @param {string} [format] Result Matrix storage format. Default value: 'dense'.
2090
+ * @return {Matrix} Rotation Matrix
2091
+ */
2092
+ rotationMatrix<T extends MathCollection>(
2093
+ theta?: number | BigNumber | Complex | Unit,
2094
+ axis?: T,
2095
+ format?: 'sparse' | 'dense'
2096
+ ): T
2097
+
2075
2098
  /**
2076
2099
  * Return a row from a Matrix.
2077
2100
  * @param value An array or matrix
@@ -3771,12 +3794,12 @@ declare namespace math {
3771
3794
  size(): number[]
3772
3795
  map(
3773
3796
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3774
- callback: (a: any, b: number, c: Matrix) => any,
3797
+ callback: (a: any, b: number[], c: Matrix) => any,
3775
3798
  skipZeros?: boolean
3776
3799
  ): Matrix
3777
3800
  forEach(
3778
3801
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3779
- callback: (a: any, b: number, c: Matrix) => void,
3802
+ callback: (a: any, b: number[], c: Matrix) => void,
3780
3803
  skipZeros?: boolean
3781
3804
  ): void
3782
3805
  toArray(): MathArray
@@ -4504,6 +4527,11 @@ declare namespace math {
4504
4527
  threshold?: number
4505
4528
  ): MathJsChain<MathArray>
4506
4529
 
4530
+ lusolve(
4531
+ this: MathJsChain<LUDecomposition>,
4532
+ b: Matrix | MathArray
4533
+ ): MathJsChain<Matrix>
4534
+
4507
4535
  /**
4508
4536
  * Calculate the Matrix QR decomposition. Matrix A is decomposed in two
4509
4537
  * matrices (Q, R) where Q is an orthogonal matrix and R is an upper
@@ -4724,20 +4752,49 @@ declare namespace math {
4724
4752
  * and scalar values.
4725
4753
  * @param y Denominator
4726
4754
  */
4727
- dotDivide(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
4755
+ dotDivide<T extends MathCollection>(
4756
+ this: MathJsChain<T>,
4757
+ y: MathType
4758
+ ): MathJsChain<T>
4759
+ dotDivide<T extends MathCollection>(
4760
+ this: MathJsChain<MathType>,
4761
+ y: T
4762
+ ): MathJsChain<T>
4763
+ dotDivide(this: MathJsChain<Unit>, y: MathType): MathJsChain<Unit>
4764
+ dotDivide(this: MathJsChain<MathType>, y: Unit): MathJsChain<Unit>
4765
+ dotDivide(
4766
+ this: MathJsChain<MathNumericType>,
4767
+ y: MathNumericType
4768
+ ): MathJsChain<MathNumericType>
4728
4769
 
4729
4770
  /**
4730
4771
  * Multiply two matrices element wise. The function accepts both
4731
4772
  * matrices and scalar values.
4732
4773
  * @param y Right hand value
4733
4774
  */
4734
- dotMultiply(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
4775
+ dotMultiply<T extends MathCollection>(
4776
+ this: MathJsChain<T>,
4777
+ y: MathType
4778
+ ): MathJsChain<T>
4779
+ dotMultiply<T extends MathCollection>(
4780
+ this: MathJsChain<MathType>,
4781
+ y: T
4782
+ ): MathJsChain<T>
4783
+ dotMultiply(this: MathJsChain<Unit>, y: MathType): MathJsChain<Unit>
4784
+ dotMultiply(this: MathJsChain<MathType>, y: Unit): MathJsChain<Unit>
4785
+ dotMultiply(
4786
+ this: MathJsChain<MathNumericType>,
4787
+ y: MathNumericType
4788
+ ): MathJsChain<MathNumericType>
4735
4789
 
4736
4790
  /**
4737
4791
  * Calculates the power of x to y element wise.
4738
4792
  * @param y The exponent
4739
4793
  */
4740
- dotPow(this: MathJsChain<MathType>, y: MathType): MathJsChain<MathType>
4794
+ dotPow<T extends MathType>(
4795
+ this: MathJsChain<T>,
4796
+ y: MathType
4797
+ ): MathJsChain<T>
4741
4798
 
4742
4799
  /**
4743
4800
  * Calculate the exponent of a value. For matrices, the function is