mathjs 9.5.1 → 10.0.2

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 (75) hide show
  1. package/HISTORY.md +37 -0
  2. package/bin/cli.js +0 -0
  3. package/docs/reference/constants.md +1 -1
  4. package/docs/reference/functions/parser.md +4 -4
  5. package/examples/expressions.js +1 -1
  6. package/lib/browser/math.js +6 -6
  7. package/lib/browser/math.js.map +1 -1
  8. package/lib/cjs/constants.js +1 -1
  9. package/lib/cjs/core/function/config.js +1 -1
  10. package/lib/cjs/core/function/import.js +2 -1
  11. package/lib/cjs/entry/dependenciesAny/dependenciesIntersect.generated.js +6 -0
  12. package/lib/cjs/entry/dependenciesAny.generated.js +999 -999
  13. package/lib/cjs/entry/dependenciesNumber.generated.js +581 -581
  14. package/lib/cjs/entry/impureFunctionsAny.generated.js +314 -313
  15. package/lib/cjs/entry/impureFunctionsNumber.generated.js +223 -222
  16. package/lib/cjs/entry/mainAny.js +8 -8
  17. package/lib/cjs/entry/mainNumber.js +8 -8
  18. package/lib/cjs/entry/pureFunctionsAny.generated.js +1102 -1100
  19. package/lib/cjs/entry/pureFunctionsNumber.generated.js +375 -375
  20. package/lib/cjs/entry/typeChecks.js +12 -12
  21. package/lib/cjs/expression/Parser.js +1 -1
  22. package/lib/cjs/expression/function/parser.js +4 -4
  23. package/lib/cjs/expression/operators.js +1 -1
  24. package/lib/cjs/factoriesAny.js +660 -660
  25. package/lib/cjs/factoriesNumber.js +268 -237
  26. package/lib/cjs/function/algebra/simplify.js +3 -0
  27. package/lib/cjs/function/arithmetic/round.js +2 -2
  28. package/lib/cjs/function/geometry/intersect.js +12 -13
  29. package/lib/cjs/function/probability/gamma.js +28 -30
  30. package/lib/cjs/header.js +2 -2
  31. package/lib/cjs/plain/bignumber/arithmetic.js +2 -2
  32. package/lib/cjs/plain/number/arithmetic.js +10 -10
  33. package/lib/cjs/plain/number/constants.js +1 -1
  34. package/lib/cjs/plain/number/logical.js +1 -1
  35. package/lib/cjs/plain/number/probability.js +2 -1
  36. package/lib/cjs/plain/number/trigonometry.js +1 -1
  37. package/lib/cjs/plain/number/utils.js +1 -1
  38. package/lib/cjs/type/matrix/SparseMatrix.js +19 -15
  39. package/lib/cjs/type/unit/Unit.js +2 -2
  40. package/lib/cjs/type/unit/physicalConstants.js +1 -1
  41. package/lib/cjs/utils/array.js +14 -14
  42. package/lib/cjs/utils/bignumber/bitwise.js +1 -1
  43. package/lib/cjs/utils/customs.js +5 -5
  44. package/lib/cjs/utils/factory.js +3 -3
  45. package/lib/cjs/utils/function.js +1 -1
  46. package/lib/cjs/utils/is.js +23 -23
  47. package/lib/cjs/utils/latex.js +2 -1
  48. package/lib/cjs/utils/map.js +3 -3
  49. package/lib/cjs/utils/noop.js +1 -1
  50. package/lib/cjs/utils/number.js +11 -7
  51. package/lib/cjs/utils/object.js +8 -8
  52. package/lib/cjs/utils/snapshot.js +3 -3
  53. package/lib/cjs/utils/string.js +2 -2
  54. package/lib/cjs/version.js +1 -1
  55. package/lib/esm/core/function/import.js +2 -1
  56. package/lib/esm/entry/dependenciesAny/dependenciesIntersect.generated.js +4 -0
  57. package/lib/esm/entry/dependenciesAny.generated.js +270 -270
  58. package/lib/esm/entry/dependenciesNumber.generated.js +163 -163
  59. package/lib/esm/entry/impureFunctionsAny.generated.js +301 -301
  60. package/lib/esm/entry/impureFunctionsNumber.generated.js +211 -211
  61. package/lib/esm/entry/pureFunctionsAny.generated.js +818 -816
  62. package/lib/esm/entry/pureFunctionsNumber.generated.js +234 -234
  63. package/lib/esm/expression/Parser.js +1 -1
  64. package/lib/esm/expression/function/parser.js +4 -4
  65. package/lib/esm/function/algebra/simplify.js +3 -0
  66. package/lib/esm/function/arithmetic/round.js +2 -2
  67. package/lib/esm/function/geometry/intersect.js +12 -12
  68. package/lib/esm/function/probability/gamma.js +28 -30
  69. package/lib/esm/type/matrix/SparseMatrix.js +19 -15
  70. package/lib/esm/type/unit/Unit.js +2 -2
  71. package/lib/esm/utils/number.js +1 -1
  72. package/lib/esm/utils/snapshot.js +2 -2
  73. package/lib/esm/version.js +1 -1
  74. package/package.json +17 -17
  75. package/types/index.d.ts +47 -47
package/HISTORY.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # History
2
2
 
3
+ # 2021-12-29, version 10.0.2
4
+
5
+ - Fix #2156: simplify expressions like `-1 / (-x)` to `1/x`. Thanks @ony3000.
6
+ - Fix #2363: remove a redundant part of the regex to split a number.
7
+ - Fix #2291: add support for fractions in function `intersect`.
8
+ Thanks @thetazero.
9
+ - Fix #2358: bug in `SparseMatrix` when replacing a subset of a matrix with
10
+ a non-consecutive index. Thanks @Al-0.
11
+
12
+
13
+ # 2021-12-22, version 10.0.1
14
+
15
+ - Fix #1681: function `gamma` giving inaccurate complex results in some cases.
16
+ Thanks @kmdrGroch.
17
+ - Fixed a typo in an example, see #2366. Thanks @blackwindforce.
18
+
19
+
20
+ # 2021-11-03, version 10.0.0
21
+
22
+ !!! BE CAREFUL: BREAKING CHANGES IN THE TYPESCRIPT DEFINITIONS !!!
23
+
24
+ - Improvements to the Typescript typings (commit fc5c202e).
25
+ Thanks @joshhansen. First introduced in v9.5.1, but reverted because
26
+ it contains breaking changes.
27
+
28
+ Breaking changes: interface `MathNode` is now renamed to `MathNodeCommon`
29
+ and the related interfaces are structured in a different way.
30
+
31
+ - Fixed a typo in the TypeScript definition of toHTML. Thanks @TheToto.
32
+
33
+
34
+ # 2021-11-03, version 9.5.2`
35
+
36
+ - Revert the improvements to the Typescript typings because they contain
37
+ breaking changes. The improvements will be published in v10.0.0. See #2339.
38
+
39
+
3
40
  # 2021-10-13, version 9.5.1
4
41
 
5
42
  - Various improvements to the Typescript typings.
package/bin/cli.js CHANGED
File without changes
@@ -5,7 +5,7 @@ Math.js contains the following constants.
5
5
  Constant | Description | Value
6
6
  --------------- | ----------- | -----
7
7
  `e`, `E` | Euler's number, the base of the natural logarithm. | 2.718281828459045
8
- `i` | Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part. | `sqrt(-1)`
8
+ `i` | Imaginary unit, defined as `i * i = -1`. A complex number is described as `a + b * i`, where a is the real part, and b is the imaginary part. | `sqrt(-1)`
9
9
  `Infinity` | Infinity, a number which is larger than the maximum number that can be handled by a floating point number. | `Infinity`
10
10
  `LN2` | Returns the natural logarithm of 2. | `0.6931471805599453`
11
11
  `LN10` | Returns the natural logarithm of 10. | `2.302585092994046`
@@ -36,10 +36,10 @@ const c = parser.evaluate('2 inch in cm') // 5.08 cm
36
36
  const d = parser.evaluate('cos(45 deg)') // 0.7071067811865476
37
37
 
38
38
  // define variables and functions
39
- parser.evaluate('x = 7 / 2') // 3.5
40
- parser.evaluate('x + 3') // 6.5
41
- parser.evaluate('function f(x, y) = x^y') // f(x, y)
42
- parser.evaluate('f(2, 3)') // 8
39
+ parser.evaluate('x = 7 / 2') // 3.5
40
+ parser.evaluate('x + 3') // 6.5
41
+ parser.evaluate('f(x, y) = x^y') // f(x, y)
42
+ parser.evaluate('f(2, 3)') // 8
43
43
 
44
44
  // get and set variables and functions
45
45
  const x = parser.get('x') // 7
@@ -91,7 +91,7 @@ const scope2 = {
91
91
  print(code2.evaluate(scope2)) // 9
92
92
 
93
93
  // change a value in the scope and re-evaluate the node
94
- scope.a = 3
94
+ scope2.a = 3
95
95
  print(code2.evaluate(scope2)) // 27
96
96
 
97
97
  // 3. using function math.compile