mathjs 15.0.0 → 15.1.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.
- package/HISTORY.md +34 -6
- package/NOTICE +1 -1
- package/README.md +7 -7
- package/bin/cli.js +1 -1
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +3 -3
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/core/function/import.js +7 -0
- package/lib/cjs/core/function/typed.js +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesBernoulli.generated.js +25 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesConstantNode.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesEqual.generated.js +0 -2
- package/lib/cjs/entry/dependenciesAny/dependenciesIsBounded.generated.js +17 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesIsFinite.generated.js +21 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesIsInteger.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSimplifyConstant.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesUnitClass.generated.js +0 -2
- package/lib/cjs/entry/dependenciesAny/dependenciesZeta.generated.js +2 -0
- package/lib/cjs/entry/dependenciesAny.generated.js +21 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesBernoulli.generated.js +21 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesConstantNode.generated.js +2 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesIsBounded.generated.js +17 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesIsFinite.generated.js +21 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesSimplifyConstant.generated.js +2 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesZeta.generated.js +2 -0
- package/lib/cjs/entry/dependenciesNumber.generated.js +21 -0
- package/lib/cjs/entry/impureFunctionsAny.generated.js +217 -212
- package/lib/cjs/entry/impureFunctionsNumber.generated.js +82 -77
- package/lib/cjs/entry/pureFunctionsAny.generated.js +668 -652
- package/lib/cjs/entry/pureFunctionsNumber.generated.js +155 -140
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +6 -0
- package/lib/cjs/expression/embeddedDocs/function/combinatorics/stirlingS2.js +2 -2
- package/lib/cjs/expression/embeddedDocs/function/probability/bernoulli.js +14 -0
- package/lib/cjs/expression/embeddedDocs/function/utils/isBounded.js +14 -0
- package/lib/cjs/expression/embeddedDocs/function/utils/isFinite.js +14 -0
- package/lib/cjs/expression/embeddedDocs/function/utils/isNaN.js +1 -1
- package/lib/cjs/expression/embeddedDocs/function/utils/isNumeric.js +1 -1
- package/lib/cjs/expression/node/AccessorNode.js +36 -7
- package/lib/cjs/expression/node/ConstantNode.js +4 -4
- package/lib/cjs/expression/node/FunctionNode.js +20 -5
- package/lib/cjs/expression/parse.js +62 -14
- package/lib/cjs/factoriesAny.js +21 -0
- package/lib/cjs/factoriesNumber.js +23 -2
- package/lib/cjs/function/algebra/polynomialRoot.js +4 -0
- package/lib/cjs/function/algebra/simplifyConstant.js +3 -2
- package/lib/cjs/function/arithmetic/add.js +8 -1
- package/lib/cjs/function/arithmetic/cbrt.js +7 -6
- package/lib/cjs/function/arithmetic/ceil.js +10 -2
- package/lib/cjs/function/arithmetic/exp.js +7 -5
- package/lib/cjs/function/arithmetic/expm1.js +6 -5
- package/lib/cjs/function/arithmetic/fix.js +10 -2
- package/lib/cjs/function/arithmetic/floor.js +10 -2
- package/lib/cjs/function/arithmetic/log.js +13 -0
- package/lib/cjs/function/arithmetic/mod.js +8 -2
- package/lib/cjs/function/arithmetic/nthRoot.js +9 -3
- package/lib/cjs/function/arithmetic/nthRoots.js +12 -11
- package/lib/cjs/function/matrix/map.js +6 -0
- package/lib/cjs/function/probability/bernoulli.js +108 -0
- package/lib/cjs/function/relational/compare.js +6 -0
- package/lib/cjs/function/relational/compareNatural.js +8 -2
- package/lib/cjs/function/relational/deepEqual.js +8 -3
- package/lib/cjs/function/relational/equal.js +17 -5
- package/lib/cjs/function/relational/unequal.js +14 -2
- package/lib/cjs/function/set/setDistinct.js +2 -1
- package/lib/cjs/function/special/zeta.js +3 -2
- package/lib/cjs/function/string/format.js +9 -0
- package/lib/cjs/function/utils/isBounded.js +54 -0
- package/lib/cjs/function/utils/isFinite.js +57 -0
- package/lib/cjs/function/utils/isInteger.js +7 -15
- package/lib/cjs/function/utils/isNaN.js +1 -1
- package/lib/cjs/function/utils/isNumeric.js +1 -1
- package/lib/cjs/function/utils/numeric.js +6 -0
- package/lib/cjs/header.js +3 -3
- package/lib/cjs/json/replacer.js +1 -1
- package/lib/cjs/plain/number/probability.js +2 -2
- package/lib/cjs/plain/number/trigonometry.js +1 -1
- package/lib/cjs/type/bigint.js +5 -0
- package/lib/cjs/type/boolean.js +6 -0
- package/lib/cjs/type/complex/function/complex.js +6 -0
- package/lib/cjs/type/fraction/function/fraction.js +9 -1
- package/lib/cjs/type/matrix/SparseMatrix.js +24 -4
- package/lib/cjs/type/matrix/function/index.js +8 -0
- package/lib/cjs/type/matrix/function/matrix.js +6 -0
- package/lib/cjs/type/matrix/function/sparse.js +4 -0
- package/lib/cjs/type/string.js +4 -0
- package/lib/cjs/type/unit/Unit.js +12 -8
- package/lib/cjs/type/unit/function/unit.js +8 -0
- package/lib/cjs/utils/number.js +7 -7
- package/lib/cjs/utils/optimizeCallback.js +13 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/core/function/import.js +7 -0
- package/lib/esm/core/function/typed.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesBernoulli.generated.js +18 -0
- package/lib/esm/entry/dependenciesAny/dependenciesConstantNode.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesEqual.generated.js +0 -2
- package/lib/esm/entry/dependenciesAny/dependenciesIsBounded.generated.js +10 -0
- package/lib/esm/entry/dependenciesAny/dependenciesIsFinite.generated.js +14 -0
- package/lib/esm/entry/dependenciesAny/dependenciesIsInteger.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSimplifyConstant.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny/dependenciesUnitClass.generated.js +0 -2
- package/lib/esm/entry/dependenciesAny/dependenciesZeta.generated.js +2 -0
- package/lib/esm/entry/dependenciesAny.generated.js +3 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesBernoulli.generated.js +14 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesConstantNode.generated.js +2 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesIsBounded.generated.js +10 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesIsFinite.generated.js +14 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesSimplifyConstant.generated.js +2 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesZeta.generated.js +2 -0
- package/lib/esm/entry/dependenciesNumber.generated.js +3 -0
- package/lib/esm/entry/impureFunctionsAny.generated.js +219 -214
- package/lib/esm/entry/impureFunctionsNumber.generated.js +84 -79
- package/lib/esm/entry/pureFunctionsAny.generated.js +665 -649
- package/lib/esm/entry/pureFunctionsNumber.generated.js +154 -139
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +6 -0
- package/lib/esm/expression/embeddedDocs/function/combinatorics/stirlingS2.js +2 -2
- package/lib/esm/expression/embeddedDocs/function/probability/bernoulli.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/utils/isBounded.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/utils/isFinite.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/utils/isNaN.js +1 -1
- package/lib/esm/expression/embeddedDocs/function/utils/isNumeric.js +1 -1
- package/lib/esm/expression/node/AccessorNode.js +36 -7
- package/lib/esm/expression/node/ConstantNode.js +4 -4
- package/lib/esm/expression/node/FunctionNode.js +20 -5
- package/lib/esm/expression/parse.js +62 -14
- package/lib/esm/factoriesAny.js +3 -0
- package/lib/esm/factoriesNumber.js +3 -0
- package/lib/esm/function/algebra/polynomialRoot.js +4 -0
- package/lib/esm/function/algebra/simplifyConstant.js +3 -2
- package/lib/esm/function/arithmetic/add.js +8 -1
- package/lib/esm/function/arithmetic/cbrt.js +7 -6
- package/lib/esm/function/arithmetic/ceil.js +10 -2
- package/lib/esm/function/arithmetic/exp.js +7 -5
- package/lib/esm/function/arithmetic/expm1.js +6 -5
- package/lib/esm/function/arithmetic/fix.js +10 -2
- package/lib/esm/function/arithmetic/floor.js +10 -2
- package/lib/esm/function/arithmetic/log.js +13 -0
- package/lib/esm/function/arithmetic/mod.js +8 -2
- package/lib/esm/function/arithmetic/nthRoot.js +9 -3
- package/lib/esm/function/arithmetic/nthRoots.js +12 -11
- package/lib/esm/function/matrix/map.js +6 -0
- package/lib/esm/function/probability/bernoulli.js +102 -0
- package/lib/esm/function/relational/compare.js +6 -0
- package/lib/esm/function/relational/compareNatural.js +8 -2
- package/lib/esm/function/relational/deepEqual.js +8 -3
- package/lib/esm/function/relational/equal.js +17 -5
- package/lib/esm/function/relational/unequal.js +14 -2
- package/lib/esm/function/set/setDistinct.js +2 -1
- package/lib/esm/function/special/zeta.js +3 -2
- package/lib/esm/function/string/format.js +9 -0
- package/lib/esm/function/utils/isBounded.js +48 -0
- package/lib/esm/function/utils/isFinite.js +51 -0
- package/lib/esm/function/utils/isInteger.js +7 -15
- package/lib/esm/function/utils/isNaN.js +1 -1
- package/lib/esm/function/utils/isNumeric.js +1 -1
- package/lib/esm/function/utils/numeric.js +6 -0
- package/lib/esm/header.js +1 -1
- package/lib/esm/json/replacer.js +1 -1
- package/lib/esm/plain/number/probability.js +2 -2
- package/lib/esm/plain/number/trigonometry.js +1 -1
- package/lib/esm/type/bigint.js +5 -0
- package/lib/esm/type/boolean.js +6 -0
- package/lib/esm/type/complex/function/complex.js +6 -0
- package/lib/esm/type/fraction/function/fraction.js +9 -1
- package/lib/esm/type/matrix/SparseMatrix.js +24 -4
- package/lib/esm/type/matrix/function/index.js +8 -0
- package/lib/esm/type/matrix/function/matrix.js +6 -0
- package/lib/esm/type/matrix/function/sparse.js +4 -0
- package/lib/esm/type/string.js +4 -0
- package/lib/esm/type/unit/Unit.js +12 -8
- package/lib/esm/type/unit/function/unit.js +8 -0
- package/lib/esm/utils/number.js +7 -7
- package/lib/esm/utils/optimizeCallback.js +13 -1
- package/lib/esm/version.js +1 -1
- package/package.json +15 -15
- package/types/index.d.ts +580 -237
package/HISTORY.md
CHANGED
|
@@ -1,22 +1,50 @@
|
|
|
1
1
|
# History
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# 2026-02-10, 15.1.1
|
|
4
|
+
|
|
5
|
+
- Fix: #3631 Handle bigints in `compareNatural` (#3632). Thanks @Dheemanth07.
|
|
6
|
+
- Fix: #3578 interpret empty true-expr of conditional as error (#3581).
|
|
7
|
+
Thanks @gwhitney.
|
|
8
|
+
- Fix: #3597 added nullish type definitions (#3601). Thanks @Ayo1984.
|
|
9
|
+
- Docs: Correct several arithmetic and relational documentation examples
|
|
10
|
+
and add History (#3630). Thanks @Anadian.
|
|
11
|
+
- Docs: fix #3565, update Matrix documentation (#3591). Thanks @orelbn.
|
|
12
|
+
- Docs: #3341 add per-function HISTORY sections (#3606). Thanks @gwhitney.
|
|
13
|
+
- Docs: describe that `setDistinct` sorts the elements (see #3602).
|
|
14
|
+
|
|
15
|
+
# 2025-11-05, 15.1.0
|
|
16
|
+
|
|
17
|
+
- Feat: implement functions `isFinite` and `isBounded` (#3554, #3553).
|
|
18
|
+
Thanks @gwhitney.
|
|
19
|
+
- Feat: add function `bernoulli` to calculate Bernoulli numbers (#3551).
|
|
20
|
+
Thanks @gwhitney.
|
|
21
|
+
- Feat: support for optional chaining `object?.key` (#3547).
|
|
22
|
+
Thanks @NilsDietrich.
|
|
23
|
+
- Fix: #3580, #3586, #3587 issues with the optional chaining operator: disallow
|
|
24
|
+
double dot `?..`, allow optional function calls, throw errors on invalid uses
|
|
25
|
+
of `?.` (#3585). Thanks @AnslemHack.
|
|
26
|
+
- Fix: #3579 conditional parsed as optional chaining (#3584).
|
|
27
|
+
- Fix: #3564 Avoid error throws when mapping/filtering empty arrays/matrices.
|
|
28
|
+
(#3567). Thanks @richardt-cla.
|
|
29
|
+
- Fix: #3574 respect tolerances in function `isInteger` (#3575).
|
|
30
|
+
Thanks @gwhitney.
|
|
31
|
+
- Fix: #3562 serializing units missing an internal property (#3572).
|
|
32
|
+
|
|
33
|
+
# 2025-10-10, 15.0.0
|
|
4
34
|
|
|
5
35
|
!!! BE CAREFUL: BREAKING CHANGES !!!
|
|
6
36
|
|
|
7
37
|
- Feat: #3349 Decouple precedence of unary percentage operator and binary
|
|
8
38
|
modulus operator (that both use symbol `%`), and raise the former (#3432).
|
|
9
39
|
Thanks @kiprobinsonknack.
|
|
10
|
-
- Feat: #1753 enhance Kronecker product to handle arbitrary dimension (#3461
|
|
11
|
-
Thanks @gwhitney.
|
|
40
|
+
- Feat: #1753 enhance Kronecker product to handle arbitrary dimension (#3461,
|
|
41
|
+
#3455). Thanks @gwhitney and @Delaney.
|
|
12
42
|
- Feat: #2344 matrix subset according to the type of input (#3485).
|
|
13
43
|
Thanks @dvd101x.
|
|
14
|
-
- Fix: #1753 Correct dimensionality of Kronecker product on vectors (and
|
|
15
|
-
extend to arbitrary dimension) (#3455). Thanks @Delaney.
|
|
16
44
|
- Fix: #3501 parse `%` as unary only when not followed by a term (#3505).
|
|
17
45
|
Thanks @gwhitney.
|
|
18
46
|
- Fix: #3421 require a space or delimiter after hex, bin, and oct values (#3463).
|
|
19
|
-
- Fix: #3529 Change function `size` to always return an `Array` (3535).
|
|
47
|
+
- Fix: #3529 Change function `size` to always return an `Array` (#3535).
|
|
20
48
|
- Fix: #3530 throw an error when trying to flatten a `SparseMatrix` (#3536).
|
|
21
49
|
|
|
22
50
|
# 2025-10-10, 14.9.1
|
package/NOTICE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
math.js
|
|
2
2
|
https://github.com/josdejong/mathjs
|
|
3
3
|
|
|
4
|
-
Copyright (C) 2013-
|
|
4
|
+
Copyright (C) 2013-2026 Jos de Jong <wjosdejong@gmail.com>
|
|
5
5
|
|
|
6
6
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Math.js is an extensive math library for JavaScript and Node.js. It features a f
|
|
|
7
7
|
[](https://www.npmjs.com/package/mathjs)
|
|
8
8
|
[](https://www.npmjs.com/package/mathjs)
|
|
9
9
|
[](https://github.com/josdejong/mathjs/actions)
|
|
10
|
-
[](https://github.com/josdejong/mathjs/graphs/commit-activity)
|
|
11
11
|
[](https://github.com/josdejong/mathjs/blob/master/LICENSE)
|
|
12
12
|
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fjosdejong%2Fmathjs?ref=badge_shield)
|
|
13
13
|
[](https://codecov.io/gh/josdejong/mathjs)
|
|
@@ -133,10 +133,10 @@ At the lowest level, mathjs has immutable factory functions which create immutab
|
|
|
133
133
|
A common case is to implement a new function. This involves the following steps:
|
|
134
134
|
|
|
135
135
|
- Implement the function in the right category, for example `./src/function/arithmetic/myNewFunction.js`, where you can replace `arithmetic` with the proper category, and `myNewFunction` with the name of the new function. Add the new function to the index files `./src/factoriesAny.js` and possibly `./src/factoriesNumber.js`.
|
|
136
|
-
- Write documentation on the function in the source code comment of `myNewFunction.js`. This documentation is used to auto generate documentation on the website.
|
|
136
|
+
- Write documentation on the function in the source code comment of `myNewFunction.js`. This documentation is used to auto generate documentation on the website. It should include a History section with one line, indicating the upcoming version number in which the function will be created.
|
|
137
137
|
- Write embedded documentation for the new function in `./src/expression/embeddedDocs/function/arithmetic/myNewFunction.js`. Add the new documentation to the index file `./src/expression/embeddedDocs/embeddedDocs.js`.
|
|
138
138
|
- Write unit tests for the function in `./test/unit-tests/function/arithmetic/myNewFunction.test.js`.
|
|
139
|
-
- Write the necessary TypeScript definitions for the new function in `./types/index.d.ts`, and write tests for it in `./test/typescript-tests/testTypes.ts`. This is described in [./types/EXPLANATION.md](./types/EXPLANATION.md).
|
|
139
|
+
- Write the necessary TypeScript definitions for the new function in `./types/index.d.ts`, and write tests for it in `./test/typescript-tests/testTypes.ts`. This is described in [./types/EXPLANATION.md](./types/EXPLANATION.md) -- make sure to read that page, as Typescript definitions must be added in _multiple_ places in the code.
|
|
140
140
|
- Ensure the code style is ok by running `npm run lint` (run `npm run format` to fix the code style automatically).
|
|
141
141
|
|
|
142
142
|
|
|
@@ -191,18 +191,18 @@ To see the coverage results, open the generated report in your browser:
|
|
|
191
191
|
|
|
192
192
|
### Continuous integration testing
|
|
193
193
|
|
|
194
|
-
Continuous integration tests are run on [
|
|
194
|
+
Continuous integration tests are run on [GitHub Actions](https://github.com/josdejong/mathjs/actions) and [TestMu AI](https://www.testmu.ai) (formerly LambdaTest) every time a commit is pushed to GitHub. GitHub Actions runs the tests for different versions of node.js, and TestMu AI runs the tests on all major browsers.
|
|
195
195
|
|
|
196
|
-
[](https://www.testmu.ai)
|
|
197
197
|
|
|
198
|
-
Thanks, GitHub Actions and
|
|
198
|
+
Thanks, GitHub Actions and TestMu AI for the generous free hosting of this open source project!
|
|
199
199
|
|
|
200
200
|
## License
|
|
201
201
|
|
|
202
202
|
mathjs is published under the Apache 2.0 license:
|
|
203
203
|
|
|
204
204
|
```
|
|
205
|
-
Copyright (C) 2013-
|
|
205
|
+
Copyright (C) 2013-2026 Jos de Jong <wjosdejong@gmail.com>
|
|
206
206
|
|
|
207
207
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
208
208
|
you may not use this file except in compliance with the License.
|
package/bin/cli.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* cat script.txt | mathjs > results.txt Run input stream, output to file
|
|
31
31
|
*
|
|
32
32
|
* @license
|
|
33
|
-
* Copyright (C) 2013-
|
|
33
|
+
* Copyright (C) 2013-2026 Jos de Jong <wjosdejong@gmail.com>
|
|
34
34
|
*
|
|
35
35
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
36
36
|
* use this file except in compliance with the License. You may obtain a copy
|