mathjs 10.0.2 → 10.1.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.
- package/HISTORY.md +11 -0
- package/NOTICE +1 -1
- package/README.md +10 -2
- package/bin/cli.js +1 -1
- package/docs/expressions/syntax.md +1 -1
- package/docs/reference/functions/invmod.md +41 -0
- package/docs/reference/functions.md +1 -0
- package/lib/browser/math.js +6 -6
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesInvmod.generated.js +41 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesRationalize.generated.js +15 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesSimplify.generated.js +15 -0
- package/lib/cjs/entry/dependenciesAny.generated.js +8 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesRationalize.generated.js +15 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesSimplify.generated.js +15 -0
- package/lib/cjs/entry/impureFunctionsAny.generated.js +11 -0
- package/lib/cjs/entry/impureFunctionsNumber.generated.js +10 -0
- package/lib/cjs/entry/pureFunctionsAny.generated.js +14 -2
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +6 -1
- package/lib/cjs/expression/embeddedDocs/function/arithmetic/invmod.js +15 -0
- package/lib/cjs/expression/embeddedDocs/function/matrix/forEach.js +1 -1
- package/lib/cjs/factoriesAny.js +8 -0
- package/lib/cjs/function/algebra/rationalize.js +18 -4
- package/lib/cjs/function/algebra/simplify/simplifyConstant.js +223 -29
- package/lib/cjs/function/algebra/simplify/simplifyCore.js +34 -6
- package/lib/cjs/function/algebra/simplify.js +70 -22
- package/lib/cjs/function/arithmetic/invmod.js +73 -0
- package/lib/cjs/header.js +3 -3
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesInvmod.generated.js +24 -0
- package/lib/esm/entry/dependenciesAny/dependenciesRationalize.generated.js +10 -0
- package/lib/esm/entry/dependenciesAny/dependenciesSimplify.generated.js +10 -0
- package/lib/esm/entry/dependenciesAny.generated.js +1 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesRationalize.generated.js +10 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesSimplify.generated.js +10 -0
- package/lib/esm/entry/impureFunctionsAny.generated.js +12 -1
- package/lib/esm/entry/impureFunctionsNumber.generated.js +10 -0
- package/lib/esm/entry/pureFunctionsAny.generated.js +12 -1
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +4 -1
- package/lib/esm/expression/embeddedDocs/function/arithmetic/invmod.js +8 -0
- package/lib/esm/expression/embeddedDocs/function/matrix/forEach.js +1 -1
- package/lib/esm/factoriesAny.js +1 -0
- package/lib/esm/function/algebra/rationalize.js +18 -4
- package/lib/esm/function/algebra/simplify/simplifyConstant.js +197 -29
- package/lib/esm/function/algebra/simplify/simplifyCore.js +35 -7
- package/lib/esm/function/algebra/simplify.js +70 -22
- package/lib/esm/function/arithmetic/invmod.js +57 -0
- package/lib/esm/header.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +2 -1
package/HISTORY.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# History
|
2
2
|
|
3
|
+
# 2022-01-15, version 10.1.0
|
4
|
+
|
5
|
+
- Implemented function `invmod`, see #2368, #1744. Thanks @thetazero.
|
6
|
+
- Improvements and fixes in function `simplify`, thanks @gwhitney:
|
7
|
+
- Fix #1179, #1290: improve collection of non-constant like terms (#2384).
|
8
|
+
- Fix #2152: do not transform strings into numbers (#2372).
|
9
|
+
- Fix #1913: implement support for array and object simplification (#2382).
|
10
|
+
- Fix #2379: add embedded documentation for function `print`.
|
11
|
+
- Remove broken example from the embedded documentation of function `forEach`.
|
12
|
+
|
13
|
+
|
3
14
|
# 2021-12-29, version 10.0.2
|
4
15
|
|
5
16
|
- Fix #2156: simplify expressions like `-1 / (-x)` to `1/x`. Thanks @ony3000.
|
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-2022 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)
|
@@ -155,6 +155,14 @@ To run the tests remotely on BrowserStack, first set the environment variables `
|
|
155
155
|
|
156
156
|
npm run test:browserstack
|
157
157
|
|
158
|
+
You can separately run the code linter, though it is also executed with `npm test`:
|
159
|
+
|
160
|
+
npm run lint
|
161
|
+
|
162
|
+
To automatically fix linting issue, run:
|
163
|
+
|
164
|
+
npm run format
|
165
|
+
|
158
166
|
To test code coverage of the tests:
|
159
167
|
|
160
168
|
npm run coverage
|
@@ -174,7 +182,7 @@ Thanks Github Actions and BrowserStack for the generous free hosting of this ope
|
|
174
182
|
|
175
183
|
## License
|
176
184
|
|
177
|
-
Copyright (C) 2013-
|
185
|
+
Copyright (C) 2013-2022 Jos de Jong <wjosdejong@gmail.com>
|
178
186
|
|
179
187
|
Licensed under the Apache License, Version 2.0 (the "License");
|
180
188
|
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-2022 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
|
@@ -547,7 +547,7 @@ parser.evaluate('c[end - 1 : -1 : 2]') // Matrix, [8, 7, 6]
|
|
547
547
|
## Objects
|
548
548
|
|
549
549
|
Objects in math.js work the same as in languages like JavaScript and Python.
|
550
|
-
An object is enclosed by
|
550
|
+
An object is enclosed by curly brackets `{`, `}`, and contains a set of
|
551
551
|
comma separated key/value pairs. Keys and values are separated by a colon `:`.
|
552
552
|
Keys can be a symbol like `prop` or a string like `"prop"`.
|
553
553
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
+
|
3
|
+
# Function invmod
|
4
|
+
|
5
|
+
Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation `ax ≣ 1 (mod b)`
|
6
|
+
See https://en.wikipedia.org/wiki/Modular_multiplicative_inverse.
|
7
|
+
|
8
|
+
|
9
|
+
## Syntax
|
10
|
+
|
11
|
+
```js
|
12
|
+
math.invmod(a, b)
|
13
|
+
```
|
14
|
+
|
15
|
+
### Parameters
|
16
|
+
|
17
|
+
Parameter | Type | Description
|
18
|
+
--------- | ---- | -----------
|
19
|
+
`a` | number | BigNumber | An integer number
|
20
|
+
`b` | number | BigNumber | An integer number
|
21
|
+
|
22
|
+
### Returns
|
23
|
+
|
24
|
+
Type | Description
|
25
|
+
---- | -----------
|
26
|
+
number | BigNumber | Returns an integer number where `invmod(a,b)*a ≣ 1 (mod b)`
|
27
|
+
|
28
|
+
|
29
|
+
## Examples
|
30
|
+
|
31
|
+
```js
|
32
|
+
math.invmod(8, 12) // returns NaN
|
33
|
+
math.invmod(7, 13) // return 2
|
34
|
+
math.invmod(15151, 15122) // returns 10429
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
## See also
|
39
|
+
|
40
|
+
[gcd](gcd.md),
|
41
|
+
[xgcd](xgcd.md)
|
@@ -44,6 +44,7 @@ Function | Description
|
|
44
44
|
[math.floor(x)](functions/floor.md) | Round a value towards minus infinity.
|
45
45
|
[math.gcd(a, b)](functions/gcd.md) | Calculate the greatest common divisor for two or more values or arrays.
|
46
46
|
[math.hypot(a, b, ...)](functions/hypot.md) | Calculate the hypotenusa of a list with values.
|
47
|
+
[math.invmod(a, b)](functions/invmod.md) | Calculate the (modular) multiplicative inverse of a modulo b.
|
47
48
|
[math.lcm(a, b)](functions/lcm.md) | Calculate the least common multiple for two or more values or arrays.
|
48
49
|
[math.log(x [, base])](functions/log.md) | Calculate the logarithm of a value.
|
49
50
|
[math.log10(x)](functions/log10.md) | Calculate the 10-base logarithm of a value.
|