mathjs 10.3.0 → 10.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +14 -0
- package/docs/reference/functions/cumsum.md +57 -0
- package/docs/reference/functions/format.md +1 -1
- package/docs/reference/functions/sum.md +2 -1
- package/docs/reference/functions.md +1 -0
- package/lib/browser/math.js +4 -4
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesCumSum.generated.js +26 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesCumSumTransform.generated.js +26 -0
- package/lib/cjs/entry/dependenciesAny.generated.js +16 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesCumSum.generated.js +26 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesCumSumTransform.generated.js +26 -0
- package/lib/cjs/entry/dependenciesNumber.generated.js +16 -0
- package/lib/cjs/entry/impureFunctionsAny.generated.js +6 -0
- package/lib/cjs/entry/impureFunctionsNumber.generated.js +6 -0
- package/lib/cjs/entry/pureFunctionsAny.generated.js +9 -3
- package/lib/cjs/entry/pureFunctionsNumber.generated.js +8 -2
- package/lib/cjs/expression/embeddedDocs/construction/fraction.js +3 -3
- package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +3 -0
- package/lib/cjs/expression/embeddedDocs/function/statistics/cumsum.js +15 -0
- package/lib/cjs/expression/transform/cumsum.transform.js +57 -0
- package/lib/cjs/expression/transform/sum.transform.js +1 -1
- package/lib/cjs/factoriesAny.js +16 -0
- package/lib/cjs/factoriesNumber.js +17 -1
- package/lib/cjs/function/algebra/simplifyCore.js +2 -2
- package/lib/cjs/function/statistics/cumsum.js +151 -0
- package/lib/cjs/function/statistics/sum.js +1 -1
- package/lib/cjs/function/string/format.js +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/type/fraction/function/fraction.js +20 -8
- package/lib/cjs/utils/collection.js +3 -27
- package/lib/cjs/utils/switch.js +31 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesCumSum.generated.js +14 -0
- package/lib/esm/entry/dependenciesAny/dependenciesCumSumTransform.generated.js +14 -0
- package/lib/esm/entry/dependenciesAny.generated.js +2 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesCumSum.generated.js +14 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesCumSumTransform.generated.js +14 -0
- package/lib/esm/entry/dependenciesNumber.generated.js +2 -0
- package/lib/esm/entry/impureFunctionsAny.generated.js +8 -2
- package/lib/esm/entry/impureFunctionsNumber.generated.js +8 -2
- package/lib/esm/entry/pureFunctionsAny.generated.js +6 -1
- package/lib/esm/entry/pureFunctionsNumber.generated.js +6 -1
- package/lib/esm/expression/embeddedDocs/construction/fraction.js +3 -3
- package/lib/esm/expression/embeddedDocs/embeddedDocs.js +2 -0
- package/lib/esm/expression/embeddedDocs/function/statistics/cumsum.js +8 -0
- package/lib/esm/expression/transform/cumsum.transform.js +48 -0
- package/lib/esm/expression/transform/sum.transform.js +1 -1
- package/lib/esm/factoriesAny.js +2 -0
- package/lib/esm/factoriesNumber.js +2 -0
- package/lib/esm/function/algebra/simplifyCore.js +2 -2
- package/lib/esm/function/statistics/cumsum.js +139 -0
- package/lib/esm/function/statistics/sum.js +1 -1
- package/lib/esm/function/string/format.js +1 -1
- package/lib/esm/type/fraction/function/fraction.js +20 -8
- package/lib/esm/utils/collection.js +1 -26
- package/lib/esm/utils/switch.js +24 -0
- package/lib/esm/version.js +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +107 -7
package/HISTORY.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# History
|
2
2
|
|
3
|
+
# 2022-03-07, version 10.4.0
|
4
|
+
|
5
|
+
- Fix #2461: make sure `simplifyCore` recurses over all binary nodes (#2462).
|
6
|
+
Thanks @gwhitney.
|
7
|
+
- Fix #2429: fix the TypeScript definitions of functions `std` and `variance`
|
8
|
+
(#2455). Thanks @NattapongSiri.
|
9
|
+
- Fix #1633: implement a `cumsum` function generating cumulative sums of a list
|
10
|
+
of values or a matrix. (#1870). Thanks @hjonasson.
|
11
|
+
- Upgrade to the latest version of `Fraction.js`, having more strict input,
|
12
|
+
only accepting an integer numerator and denominator. See #2427.
|
13
|
+
- Fix typo in documentation example for `format`. (#2468) Thanks @abranhe.
|
14
|
+
- Write unit tests for all jsdoc examples. See #2452. Thanks @gwhitney.
|
15
|
+
|
16
|
+
|
3
17
|
# 2021-03-02, version 10.3.0
|
4
18
|
|
5
19
|
- Fix #1260: implement function `symbolicEqual` (#2424). Thanks @gwhitney.
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
2
|
+
|
3
|
+
# Function cumsum
|
4
|
+
|
5
|
+
Compute the cumulative sum of a matrix or a list with values.
|
6
|
+
In case of a (multi dimensional) array or matrix, the cumulative sums
|
7
|
+
along a specified dimension (defaulting to the first) will be calculated.
|
8
|
+
|
9
|
+
|
10
|
+
## Syntax
|
11
|
+
|
12
|
+
```js
|
13
|
+
math.cumsum(a, b, c, ...)
|
14
|
+
math.cumsum(A)
|
15
|
+
```
|
16
|
+
|
17
|
+
### Parameters
|
18
|
+
|
19
|
+
Parameter | Type | Description
|
20
|
+
--------- | ---- | -----------
|
21
|
+
`args` | ... * | A single matrix or or multiple scalar values
|
22
|
+
|
23
|
+
### Returns
|
24
|
+
|
25
|
+
Type | Description
|
26
|
+
---- | -----------
|
27
|
+
* | The cumulative sum of all values
|
28
|
+
|
29
|
+
|
30
|
+
### Throws
|
31
|
+
|
32
|
+
Type | Description
|
33
|
+
---- | -----------
|
34
|
+
|
35
|
+
|
36
|
+
## Examples
|
37
|
+
|
38
|
+
```js
|
39
|
+
math.cumsum(2, 1, 4, 3) // returns [2, 3, 7, 10]
|
40
|
+
math.cumsum([2, 1, 4, 3]) // returns [2, 3, 7, 10]
|
41
|
+
math.cumsum([[1, 2], [3, 4]]) // returns [[1, 2], [4, 6]]
|
42
|
+
math.cumsum([[1, 2], [3, 4]], 0) // returns [[1, 2], [4, 6]]
|
43
|
+
math.cumsum([[1, 2], [3, 4]], 1) // returns [[1, 3], [3, 7]]
|
44
|
+
math.cumsum([[2, 5], [4, 3], [1, 7]]) // returns [[2, 5], [6, 8], [7, 15]]
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
## See also
|
49
|
+
|
50
|
+
[mean](mean.md),
|
51
|
+
[median](median.md),
|
52
|
+
[min](min.md),
|
53
|
+
[max](max.md),
|
54
|
+
[prod](prod.md),
|
55
|
+
[std](std.md),
|
56
|
+
[variance](variance.md),
|
57
|
+
[sum](sum.md)
|
@@ -115,7 +115,7 @@ function formatCurrency(value) {
|
|
115
115
|
// you could also use math.format inside the callback:
|
116
116
|
// return '$' + math.format(value, {notation: 'fixed', precision: 2})
|
117
117
|
}
|
118
|
-
math.format([2.1, 3, 0.016], formatCurrency
|
118
|
+
math.format([2.1, 3, 0.016], formatCurrency) // returns '[$2.10, $3.00, $0.02]'
|
119
119
|
```
|
120
120
|
|
121
121
|
|
@@ -215,6 +215,7 @@ Function | Description
|
|
215
215
|
|
216
216
|
Function | Description
|
217
217
|
---- | -----------
|
218
|
+
[math.cumsum(a, b, c, ...)](functions/cumsum.md) | Compute the cumulative sum of a matrix or a list with values.
|
218
219
|
[math.mad(a, b, c, ...)](functions/mad.md) | Compute the median absolute deviation of a matrix or a list with values.
|
219
220
|
[math.max(a, b, c, ...)](functions/max.md) | Compute the maximum value of a matrix or a list with values.
|
220
221
|
[math.mean(a, b, c, ...)](functions/mean.md) | Compute the mean value of matrix or a list with values.
|