mathjs 10.3.0 → 10.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. package/HISTORY.md +14 -0
  2. package/docs/reference/functions/cumsum.md +57 -0
  3. package/docs/reference/functions/format.md +1 -1
  4. package/docs/reference/functions/sum.md +2 -1
  5. package/docs/reference/functions.md +1 -0
  6. package/lib/browser/math.js +4 -4
  7. package/lib/browser/math.js.map +1 -1
  8. package/lib/cjs/entry/dependenciesAny/dependenciesCumSum.generated.js +26 -0
  9. package/lib/cjs/entry/dependenciesAny/dependenciesCumSumTransform.generated.js +26 -0
  10. package/lib/cjs/entry/dependenciesAny.generated.js +16 -0
  11. package/lib/cjs/entry/dependenciesNumber/dependenciesCumSum.generated.js +26 -0
  12. package/lib/cjs/entry/dependenciesNumber/dependenciesCumSumTransform.generated.js +26 -0
  13. package/lib/cjs/entry/dependenciesNumber.generated.js +16 -0
  14. package/lib/cjs/entry/impureFunctionsAny.generated.js +6 -0
  15. package/lib/cjs/entry/impureFunctionsNumber.generated.js +6 -0
  16. package/lib/cjs/entry/pureFunctionsAny.generated.js +9 -3
  17. package/lib/cjs/entry/pureFunctionsNumber.generated.js +8 -2
  18. package/lib/cjs/expression/embeddedDocs/construction/fraction.js +3 -3
  19. package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +3 -0
  20. package/lib/cjs/expression/embeddedDocs/function/statistics/cumsum.js +15 -0
  21. package/lib/cjs/expression/transform/cumsum.transform.js +57 -0
  22. package/lib/cjs/expression/transform/sum.transform.js +1 -1
  23. package/lib/cjs/factoriesAny.js +16 -0
  24. package/lib/cjs/factoriesNumber.js +17 -1
  25. package/lib/cjs/function/algebra/simplifyCore.js +2 -2
  26. package/lib/cjs/function/statistics/cumsum.js +151 -0
  27. package/lib/cjs/function/statistics/sum.js +1 -1
  28. package/lib/cjs/function/string/format.js +1 -1
  29. package/lib/cjs/header.js +2 -2
  30. package/lib/cjs/type/fraction/function/fraction.js +20 -8
  31. package/lib/cjs/utils/collection.js +3 -27
  32. package/lib/cjs/utils/switch.js +31 -0
  33. package/lib/cjs/version.js +1 -1
  34. package/lib/esm/entry/dependenciesAny/dependenciesCumSum.generated.js +14 -0
  35. package/lib/esm/entry/dependenciesAny/dependenciesCumSumTransform.generated.js +14 -0
  36. package/lib/esm/entry/dependenciesAny.generated.js +2 -0
  37. package/lib/esm/entry/dependenciesNumber/dependenciesCumSum.generated.js +14 -0
  38. package/lib/esm/entry/dependenciesNumber/dependenciesCumSumTransform.generated.js +14 -0
  39. package/lib/esm/entry/dependenciesNumber.generated.js +2 -0
  40. package/lib/esm/entry/impureFunctionsAny.generated.js +8 -2
  41. package/lib/esm/entry/impureFunctionsNumber.generated.js +8 -2
  42. package/lib/esm/entry/pureFunctionsAny.generated.js +6 -1
  43. package/lib/esm/entry/pureFunctionsNumber.generated.js +6 -1
  44. package/lib/esm/expression/embeddedDocs/construction/fraction.js +3 -3
  45. package/lib/esm/expression/embeddedDocs/embeddedDocs.js +2 -0
  46. package/lib/esm/expression/embeddedDocs/function/statistics/cumsum.js +8 -0
  47. package/lib/esm/expression/transform/cumsum.transform.js +48 -0
  48. package/lib/esm/expression/transform/sum.transform.js +1 -1
  49. package/lib/esm/factoriesAny.js +2 -0
  50. package/lib/esm/factoriesNumber.js +2 -0
  51. package/lib/esm/function/algebra/simplifyCore.js +2 -2
  52. package/lib/esm/function/statistics/cumsum.js +139 -0
  53. package/lib/esm/function/statistics/sum.js +1 -1
  54. package/lib/esm/function/string/format.js +1 -1
  55. package/lib/esm/type/fraction/function/fraction.js +20 -8
  56. package/lib/esm/utils/collection.js +1 -26
  57. package/lib/esm/utils/switch.js +24 -0
  58. package/lib/esm/version.js +1 -1
  59. package/package.json +2 -2
  60. package/types/index.d.ts +107 -7
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCumSum = void 0;
7
+
8
+ var _collection = require("../../utils/collection.js");
9
+
10
+ var _factory = require("../../utils/factory.js");
11
+
12
+ var _switch2 = require("../../utils/switch.js");
13
+
14
+ var _improveErrorMessage = require("./utils/improveErrorMessage.js");
15
+
16
+ var _array = require("../../utils/array.js");
17
+
18
+ var _IndexError = require("../../error/IndexError.js");
19
+
20
+ var name = 'cumsum';
21
+ var dependencies = ['typed', 'add', 'unaryPlus'];
22
+ var createCumSum = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
23
+ var typed = _ref.typed,
24
+ add = _ref.add,
25
+ unaryPlus = _ref.unaryPlus;
26
+
27
+ /**
28
+ * Compute the cumulative sum of a matrix or a list with values.
29
+ * In case of a (multi dimensional) array or matrix, the cumulative sums
30
+ * along a specified dimension (defaulting to the first) will be calculated.
31
+ *
32
+ * Syntax:
33
+ *
34
+ * math.cumsum(a, b, c, ...)
35
+ * math.cumsum(A)
36
+ *
37
+ * Examples:
38
+ *
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
+ * See also:
47
+ *
48
+ * mean, median, min, max, prod, std, variance, sum
49
+ *
50
+ * @param {... *} args A single matrix or or multiple scalar values
51
+ * @return {*} The cumulative sum of all values
52
+ */
53
+ return typed(name, {
54
+ // sum([a, b, c, d, ...])
55
+ Array: _cumsum,
56
+ Matrix: function Matrix(matrix) {
57
+ return matrix.create(_cumsum(matrix.valueOf()));
58
+ },
59
+ // sum([a, b, c, d, ...], dim)
60
+ 'Array, number | BigNumber': _ncumSumDim,
61
+ 'Matrix, number | BigNumber': function MatrixNumberBigNumber(matrix, dim) {
62
+ return matrix.create(_ncumSumDim(matrix.valueOf(), dim));
63
+ },
64
+ // cumsum(a, b, c, d, ...)
65
+ '...': function _(args) {
66
+ if ((0, _collection.containsCollections)(args)) {
67
+ throw new TypeError('All values expected to be scalar in function cumsum');
68
+ }
69
+
70
+ return _cumsum(args);
71
+ }
72
+ });
73
+ /**
74
+ * Recursively calculate the cumulative sum of an n-dimensional array
75
+ * @param {Array} array
76
+ * @return {number} cumsum
77
+ * @private
78
+ */
79
+
80
+ function _cumsum(array) {
81
+ try {
82
+ return _cumsummap(array);
83
+ } catch (err) {
84
+ throw (0, _improveErrorMessage.improveErrorMessage)(err, name);
85
+ }
86
+ }
87
+
88
+ function _cumsummap(array) {
89
+ if (array.length === 0) {
90
+ return [];
91
+ }
92
+
93
+ var sums = [unaryPlus(array[0])]; // unaryPlus converts to number if need be
94
+
95
+ for (var i = 1; i < array.length; ++i) {
96
+ // Must use add below and not addScalar for the case of summing a
97
+ // 2+-dimensional array along the 0th dimension (the row vectors,
98
+ // or higher-d analogues, are literally added to each other).
99
+ sums.push(add(sums[i - 1], array[i]));
100
+ }
101
+
102
+ return sums;
103
+ }
104
+
105
+ function _ncumSumDim(array, dim) {
106
+ var size = (0, _array.arraySize)(array);
107
+
108
+ if (dim < 0 || dim >= size.length) {
109
+ // TODO: would be more clear when throwing a DimensionError here
110
+ throw new _IndexError.IndexError(dim, size.length);
111
+ }
112
+
113
+ try {
114
+ return _cumsumDimensional(array, dim);
115
+ } catch (err) {
116
+ throw (0, _improveErrorMessage.improveErrorMessage)(err, name);
117
+ }
118
+ }
119
+ /* Possible TODO: Refactor _reduce in collection.js to be able to work here as well */
120
+
121
+
122
+ function _cumsumDimensional(mat, dim) {
123
+ var i, ret, tran;
124
+
125
+ if (dim <= 0) {
126
+ var initialValue = mat[0][0];
127
+
128
+ if (!Array.isArray(initialValue)) {
129
+ return _cumsummap(mat);
130
+ } else {
131
+ tran = (0, _switch2._switch)(mat);
132
+ ret = [];
133
+
134
+ for (i = 0; i < tran.length; i++) {
135
+ ret[i] = _cumsumDimensional(tran[i], dim - 1);
136
+ }
137
+
138
+ return ret;
139
+ }
140
+ } else {
141
+ ret = [];
142
+
143
+ for (i = 0; i < mat.length; i++) {
144
+ ret[i] = _cumsumDimensional(mat[i], dim - 1);
145
+ }
146
+
147
+ return ret;
148
+ }
149
+ }
150
+ });
151
+ exports.createCumSum = createCumSum;
@@ -37,7 +37,7 @@ var createSum = /* #__PURE__ */(0, _factory.factory)(name, dependencies, functio
37
37
  *
38
38
  * See also:
39
39
  *
40
- * mean, median, min, max, prod, std, variance
40
+ * mean, median, min, max, prod, std, variance, cumsum
41
41
  *
42
42
  * @param {... *} args A single matrix or or multiple scalar values
43
43
  * @return {*} The sum of all values
@@ -119,7 +119,7 @@ var createFormat = /* #__PURE__ */(0, _factory.factory)(name, dependencies, func
119
119
  * // you could also use math.format inside the callback:
120
120
  * // return '$' + math.format(value, {notation: 'fixed', precision: 2})
121
121
  * }
122
- * math.format([2.1, 3, 0.016], formatCurrency} // returns '[$2.10, $3.00, $0.02]'
122
+ * math.format([2.1, 3, 0.016], formatCurrency) // returns '[$2.10, $3.00, $0.02]'
123
123
  *
124
124
  * See also:
125
125
  *
package/lib/cjs/header.js CHANGED
@@ -6,8 +6,8 @@
6
6
  * It features real and complex numbers, units, matrices, a large set of
7
7
  * mathematical functions, and a flexible expression parser.
8
8
  *
9
- * @version 10.3.0
10
- * @date 2022-03-02
9
+ * @version 10.4.0
10
+ * @date 2022-03-07
11
11
  *
12
12
  * @license
13
13
  * Copyright (C) 2013-2022 Jos de Jong <wjosdejong@gmail.com>
@@ -16,27 +16,39 @@ var createFraction = /* #__PURE__ */(0, _factory.factory)(name, dependencies, fu
16
16
  Fraction = _ref.Fraction;
17
17
 
18
18
  /**
19
- * Create a fraction convert a value to a fraction.
19
+ * Create a fraction or convert a value to a fraction.
20
+ *
21
+ * With one numeric argument, produces the closest rational approximation to the
22
+ * input.
23
+ * With two arguments, the first is the numerator and the second is the denominator,
24
+ * and creates the corresponding fraction. Both numerator and denominator must be
25
+ * integers.
26
+ * With one object argument, looks for the integer numerator as the value of property
27
+ * 'n' and the integer denominator as the value of property 'd'.
28
+ * With a matrix argument, creates a matrix of the same shape with entries
29
+ * converted into fractions.
20
30
  *
21
31
  * Syntax:
32
+ * math.fraction(value)
22
33
  * math.fraction(numerator, denominator)
23
34
  * math.fraction({n: numerator, d: denominator})
24
- * math.fraction(matrix: Array | Matrix) Turn all matrix entries
25
- * into fractions
35
+ * math.fraction(matrix: Array | Matrix)
26
36
  *
27
37
  * Examples:
28
38
  *
29
- * math.fraction(1, 3)
30
- * math.fraction('2/3')
31
- * math.fraction({n: 2, d: 3})
32
- * math.fraction([0.2, 0.25, 1.25])
39
+ * math.fraction(6.283) // returns Fraction 6283/1000
40
+ * math.fraction(1, 3) // returns Fraction 1/3
41
+ * math.fraction('2/3') // returns Fraction 2/3
42
+ * math.fraction({n: 2, d: 3}) // returns Fraction 2/3
43
+ * math.fraction([0.2, 0.25, 1.25]) // returns Array [1/5, 1/4, 5/4]
44
+ * math.fraction(4, 5.1) // throws Error: Parameters must be integer
33
45
  *
34
46
  * See also:
35
47
  *
36
48
  * bignumber, number, string, unit
37
49
  *
38
50
  * @param {number | string | Fraction | BigNumber | Array | Matrix} [args]
39
- * Arguments specifying the numerator and denominator of
51
+ * Arguments specifying the value, or numerator and denominator of
40
52
  * the fraction
41
53
  * @return {Fraction | Array | Matrix} Returns a fraction
42
54
  */
@@ -15,6 +15,8 @@ var _IndexError = require("../error/IndexError.js");
15
15
 
16
16
  var _array = require("./array.js");
17
17
 
18
+ var _switch2 = require("./switch.js");
19
+
18
20
  /**
19
21
  * Test whether an array contains collections
20
22
  * @param {Array} array
@@ -126,7 +128,7 @@ function _reduce(mat, dim, callback) {
126
128
 
127
129
  return val;
128
130
  } else {
129
- tran = _switch(mat);
131
+ tran = (0, _switch2._switch)(mat);
130
132
  ret = [];
131
133
 
132
134
  for (i = 0; i < tran.length; i++) {
@@ -144,32 +146,6 @@ function _reduce(mat, dim, callback) {
144
146
 
145
147
  return ret;
146
148
  }
147
- }
148
- /**
149
- * Transpose a matrix
150
- * @param {Array} mat
151
- * @returns {Array} ret
152
- * @private
153
- */
154
-
155
-
156
- function _switch(mat) {
157
- var I = mat.length;
158
- var J = mat[0].length;
159
- var i, j;
160
- var ret = [];
161
-
162
- for (j = 0; j < J; j++) {
163
- var tmp = [];
164
-
165
- for (i = 0; i < I; i++) {
166
- tmp.push(mat[i][j]);
167
- }
168
-
169
- ret.push(tmp);
170
- }
171
-
172
- return ret;
173
149
  } // TODO: document function scatter
174
150
 
175
151
 
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports._switch = _switch;
7
+
8
+ /**
9
+ * Transpose a matrix
10
+ * @param {Array} mat
11
+ * @returns {Array} ret
12
+ * @private
13
+ */
14
+ function _switch(mat) {
15
+ var I = mat.length;
16
+ var J = mat[0].length;
17
+ var i, j;
18
+ var ret = [];
19
+
20
+ for (j = 0; j < J; j++) {
21
+ var tmp = [];
22
+
23
+ for (i = 0; i < I; i++) {
24
+ tmp.push(mat[i][j]);
25
+ }
26
+
27
+ ret.push(tmp);
28
+ }
29
+
30
+ return ret;
31
+ }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = '10.3.0'; // Note: This file is automatically generated when building math.js.
7
+ var version = '10.4.0'; // Note: This file is automatically generated when building math.js.
8
8
  // Changes made in this file will be overwritten.
9
9
 
10
10
  exports.version = version;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * THIS FILE IS AUTO-GENERATED
3
+ * DON'T MAKE CHANGES HERE
4
+ */
5
+ import { addDependencies } from './dependenciesAdd.generated.js';
6
+ import { typedDependencies } from './dependenciesTyped.generated.js';
7
+ import { unaryPlusDependencies } from './dependenciesUnaryPlus.generated.js';
8
+ import { createCumSum } from '../../factoriesAny.js';
9
+ export var cumsumDependencies = {
10
+ addDependencies,
11
+ typedDependencies,
12
+ unaryPlusDependencies,
13
+ createCumSum
14
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * THIS FILE IS AUTO-GENERATED
3
+ * DON'T MAKE CHANGES HERE
4
+ */
5
+ import { addDependencies } from './dependenciesAdd.generated.js';
6
+ import { typedDependencies } from './dependenciesTyped.generated.js';
7
+ import { unaryPlusDependencies } from './dependenciesUnaryPlus.generated.js';
8
+ import { createCumSumTransform } from '../../factoriesAny.js';
9
+ export var cumsumTransformDependencies = {
10
+ addDependencies,
11
+ typedDependencies,
12
+ unaryPlusDependencies,
13
+ createCumSumTransform
14
+ };
@@ -76,6 +76,8 @@ export { cscDependencies } from './dependenciesAny/dependenciesCsc.generated.js'
76
76
  export { cschDependencies } from './dependenciesAny/dependenciesCsch.generated.js';
77
77
  export { ctransposeDependencies } from './dependenciesAny/dependenciesCtranspose.generated.js';
78
78
  export { cubeDependencies } from './dependenciesAny/dependenciesCube.generated.js';
79
+ export { cumsumDependencies } from './dependenciesAny/dependenciesCumSum.generated.js';
80
+ export { cumsumTransformDependencies } from './dependenciesAny/dependenciesCumSumTransform.generated.js';
79
81
  export { deepEqualDependencies } from './dependenciesAny/dependenciesDeepEqual.generated.js';
80
82
  export { DenseMatrixDependencies } from './dependenciesAny/dependenciesDenseMatrixClass.generated.js';
81
83
  export { derivativeDependencies } from './dependenciesAny/dependenciesDerivative.generated.js';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * THIS FILE IS AUTO-GENERATED
3
+ * DON'T MAKE CHANGES HERE
4
+ */
5
+ import { addDependencies } from './dependenciesAdd.generated.js';
6
+ import { typedDependencies } from './dependenciesTyped.generated.js';
7
+ import { unaryPlusDependencies } from './dependenciesUnaryPlus.generated.js';
8
+ import { createCumSum } from '../../factoriesNumber.js';
9
+ export var cumsumDependencies = {
10
+ addDependencies,
11
+ typedDependencies,
12
+ unaryPlusDependencies,
13
+ createCumSum
14
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * THIS FILE IS AUTO-GENERATED
3
+ * DON'T MAKE CHANGES HERE
4
+ */
5
+ import { addDependencies } from './dependenciesAdd.generated.js';
6
+ import { typedDependencies } from './dependenciesTyped.generated.js';
7
+ import { unaryPlusDependencies } from './dependenciesUnaryPlus.generated.js';
8
+ import { createCumSumTransform } from '../../factoriesNumber.js';
9
+ export var cumsumTransformDependencies = {
10
+ addDependencies,
11
+ typedDependencies,
12
+ unaryPlusDependencies,
13
+ createCumSumTransform
14
+ };
@@ -53,6 +53,8 @@ export { cothDependencies } from './dependenciesNumber/dependenciesCoth.generate
53
53
  export { cscDependencies } from './dependenciesNumber/dependenciesCsc.generated.js';
54
54
  export { cschDependencies } from './dependenciesNumber/dependenciesCsch.generated.js';
55
55
  export { cubeDependencies } from './dependenciesNumber/dependenciesCube.generated.js';
56
+ export { cumsumDependencies } from './dependenciesNumber/dependenciesCumSum.generated.js';
57
+ export { cumsumTransformDependencies } from './dependenciesNumber/dependenciesCumSumTransform.generated.js';
56
58
  export { deepEqualDependencies } from './dependenciesNumber/dependenciesDeepEqual.generated.js';
57
59
  export { derivativeDependencies } from './dependenciesNumber/dependenciesDerivative.generated.js';
58
60
  export { divideDependencies } from './dependenciesNumber/dependenciesDivide.generated.js';
@@ -5,9 +5,9 @@ import _extends from "@babel/runtime/helpers/extends";
5
5
  * DON'T MAKE CHANGES HERE
6
6
  */
7
7
  import { config } from './configReadonly.js';
8
- import { createChainClass, createNode, createObjectNode, createOperatorNode, createParenthesisNode, createRelationalNode, createArrayNode, createBlockNode, createConditionalNode, createConstantNode, createRangeNode, createReviver, createChain, createFunctionAssignmentNode, createAccessorNode, createAssignmentNode, createIndexNode, createSymbolNode, createFunctionNode, createParse, createResolve, createCompile, createEvaluate, createHelpClass, createLeafCount, createParserClass, createParser, createSimplifyCore, createSimplify, createDerivative, createRationalize, createHelp, createSymbolicEqual, createFilterTransform, createForEachTransform, createMapTransform, createApplyTransform, createDiffTransform, createIndexTransform, createSubsetTransform, createConcatTransform, createMaxTransform, createMinTransform, createRangeTransform, createRowTransform, createSumTransform, createColumnTransform, createStdTransform, createVarianceTransform, createMeanTransform } from '../factoriesAny.js';
8
+ import { createChainClass, createNode, createObjectNode, createOperatorNode, createParenthesisNode, createRelationalNode, createArrayNode, createBlockNode, createConditionalNode, createConstantNode, createRangeNode, createReviver, createChain, createFunctionAssignmentNode, createAccessorNode, createAssignmentNode, createIndexNode, createSymbolNode, createFunctionNode, createParse, createResolve, createCompile, createEvaluate, createHelpClass, createLeafCount, createParserClass, createParser, createSimplifyCore, createSimplify, createDerivative, createRationalize, createHelp, createSymbolicEqual, createFilterTransform, createForEachTransform, createMapTransform, createApplyTransform, createDiffTransform, createIndexTransform, createSubsetTransform, createConcatTransform, createMaxTransform, createMinTransform, createRangeTransform, createRowTransform, createSumTransform, createColumnTransform, createCumSumTransform, createStdTransform, createVarianceTransform, createMeanTransform } from '../factoriesAny.js';
9
9
  import { BigNumber, Complex, e, _false, fineStructure, Fraction, i, _Infinity, LN10, LOG10E, Matrix, _NaN, _null, phi, Range, ResultSet, SQRT1_2, // eslint-disable-line camelcase
10
- sackurTetrode, tau, _true, version, DenseMatrix, efimovFactor, LN2, pi, replacer, SQRT2, typed, unaryPlus, weakMixingAngle, abs, acos, acot, acsc, addScalar, arg, asech, asinh, atan, atanh, bignumber, bitNot, boolean, clone, combinations, complex, conj, cosh, coth, csc, cube, equalScalar, erf, exp, expm1, filter, forEach, format, getMatrixDataType, hex, im, isInteger, isNegative, isPositive, isZero, LOG2E, log10, log2, map, multiplyScalar, not, number, oct, pickRandom, print, random, re, sec, sign, sin, SparseMatrix, splitUnit, square, string, tan, typeOf, acosh, acsch, apply, asec, bin, combinationsWithRep, cos, csch, isNaN, isPrime, randomInt, sech, sinh, sparse, sqrt, tanh, unaryMinus, acoth, cot, fraction, isNumeric, matrix, matrixFromFunction, mod, nthRoot, numeric, or, prod, reshape, size, smaller, squeeze, subset, subtract, to, transpose, xgcd, zeros, and, bitAnd, bitXor, cbrt, compare, compareText, concat, count, ctranspose, diag, divideScalar, dotDivide, equal, flatten, gcd, hasNumericValue, hypot, ImmutableDenseMatrix, Index, kron, largerEq, leftShift, lsolve, matrixFromColumns, min, mode, nthRoots, ones, partitionSelect, resize, rightArithShift, round, smallerEq, unequal, usolve, xor, add, atan2, bitOr, catalan, compareNatural, deepEqual, diff, dot, equalText, floor, identity, invmod, larger, log, lsolveAll, matrixFromRows, multiply, pow, qr, range, rightLogShift, row, setCartesian, setDistinct, setIsSubset, setPowerset, slu, sum, trace, usolveAll, asin, ceil, column, composition, cross, distance, dotMultiply, FibonacciHeap, fix, gamma, index, lcm, log1p, max, quantileSeq, setDifference, setMultiplicity, setSymDifference, sort, Unit, vacuumImpedance, wienDisplacement, atomicMass, bohrMagneton, boltzmann, conductanceQuantum, createUnit, deuteronMass, dotPow, electricConstant, elementaryCharge, factorial, fermiCoupling, gasConstant, gravity, intersect, inverseConductanceQuantum, klitzing, loschmidt, magneticConstant, molarMass, molarPlanckConstant, neutronMass, nuclearMagneton, permutations, planckConstant, planckMass, planckTime, quantumOfCirculation, reducedPlanckConstant, rydberg, setIntersect, setUnion, Spa, stefanBoltzmann, thomsonCrossSection, avogadro, bohrRadius, coulomb, electronMass, faraday, hartreeEnergy, lup, magneticFluxQuantum, molarMassC12, planckCharge, planckTemperature, secondRadiation, speedOfLight, stirlingS2, unit, bellNumbers, det, firstRadiation, molarVolume, protonMass, setSize, classicalElectronRadius, gravitationConstant, inv, lusolve, sqrtm, divide, expm, kldivergence, mean, median, planckLength, variance, eigs, mad, multinomial, std, norm, rotationMatrix, rotate } from './pureFunctionsAny.generated.js';
10
+ sackurTetrode, tau, _true, version, DenseMatrix, efimovFactor, LN2, pi, replacer, SQRT2, typed, unaryPlus, weakMixingAngle, abs, acos, acot, acsc, addScalar, arg, asech, asinh, atan, atanh, bignumber, bitNot, boolean, clone, combinations, complex, conj, cosh, coth, csc, cube, equalScalar, erf, exp, expm1, filter, forEach, format, getMatrixDataType, hex, im, isInteger, isNegative, isPositive, isZero, LOG2E, log10, log2, map, multiplyScalar, not, number, oct, pickRandom, print, random, re, sec, sign, sin, SparseMatrix, splitUnit, square, string, tan, typeOf, acosh, acsch, apply, asec, bin, combinationsWithRep, cos, csch, isNaN, isPrime, randomInt, sech, sinh, sparse, sqrt, tanh, unaryMinus, acoth, cot, fraction, isNumeric, matrix, matrixFromFunction, mod, nthRoot, numeric, or, prod, reshape, size, smaller, squeeze, subset, subtract, to, transpose, xgcd, zeros, and, bitAnd, bitXor, cbrt, compare, compareText, concat, count, ctranspose, diag, divideScalar, dotDivide, equal, flatten, gcd, hasNumericValue, hypot, ImmutableDenseMatrix, Index, kron, largerEq, leftShift, lsolve, matrixFromColumns, min, mode, nthRoots, ones, partitionSelect, resize, rightArithShift, round, smallerEq, unequal, usolve, xor, add, atan2, bitOr, catalan, compareNatural, cumsum, deepEqual, diff, dot, equalText, floor, identity, invmod, larger, log, lsolveAll, matrixFromRows, multiply, pow, qr, range, rightLogShift, row, setCartesian, setDistinct, setIsSubset, setPowerset, slu, sum, trace, usolveAll, asin, ceil, column, composition, cross, distance, dotMultiply, FibonacciHeap, fix, gamma, index, lcm, log1p, max, quantileSeq, setDifference, setMultiplicity, setSymDifference, sort, Unit, vacuumImpedance, wienDisplacement, atomicMass, bohrMagneton, boltzmann, conductanceQuantum, createUnit, deuteronMass, dotPow, electricConstant, elementaryCharge, factorial, fermiCoupling, gasConstant, gravity, intersect, inverseConductanceQuantum, klitzing, loschmidt, magneticConstant, molarMass, molarPlanckConstant, neutronMass, nuclearMagneton, permutations, planckConstant, planckMass, planckTime, quantumOfCirculation, reducedPlanckConstant, rydberg, setIntersect, setUnion, Spa, stefanBoltzmann, thomsonCrossSection, avogadro, bohrRadius, coulomb, electronMass, faraday, hartreeEnergy, lup, magneticFluxQuantum, molarMassC12, planckCharge, planckTemperature, secondRadiation, speedOfLight, stirlingS2, unit, bellNumbers, det, firstRadiation, molarVolume, protonMass, setSize, classicalElectronRadius, gravitationConstant, inv, lusolve, sqrtm, divide, expm, kldivergence, mean, median, planckLength, variance, eigs, mad, multinomial, std, norm, rotationMatrix, rotate } from './pureFunctionsAny.generated.js';
11
11
  var math = {}; // NOT pure!
12
12
 
13
13
  var mathWithTransform = {}; // NOT pure!
@@ -390,6 +390,7 @@ _extends(math, {
390
390
  bitOr,
391
391
  catalan,
392
392
  compareNatural,
393
+ cumsum,
393
394
  deepEqual,
394
395
  diff,
395
396
  dot,
@@ -596,6 +597,11 @@ _extends(mathWithTransform, math, {
596
597
  range,
597
598
  typed
598
599
  }),
600
+ cumsum: createCumSumTransform({
601
+ add,
602
+ typed,
603
+ unaryPlus
604
+ }),
599
605
  std: createStdTransform({
600
606
  sqrt,
601
607
  typed,
@@ -5,9 +5,9 @@ import _extends from "@babel/runtime/helpers/extends";
5
5
  * DON'T MAKE CHANGES HERE
6
6
  */
7
7
  import { config } from './configReadonly.js';
8
- import { createChainClass, createChain, createNode, createObjectNode, createRangeNode, createRelationalNode, createReviver, createSymbolNode, createAccessorNode, createAssignmentNode, createBlockNode, createConditionalNode, createFunctionNode, createIndexNode, createOperatorNode, createConstantNode, createFunctionAssignmentNode, createParenthesisNode, createArrayNode, createSimplifyCore, createParse, createResolve, createCompile, createEvaluate, createHelpClass, createParserClass, createSimplify, createDerivative, createRationalize, createHelp, createParser, createApplyTransform, createFilterTransform, createForEachTransform, createMapTransform, createMeanTransform, createSubsetTransform, createVarianceTransform, createMaxTransform, createMinTransform, createRangeTransform, createStdTransform, createSumTransform } from '../factoriesNumber.js';
8
+ import { createChainClass, createChain, createNode, createObjectNode, createRangeNode, createRelationalNode, createReviver, createSymbolNode, createAccessorNode, createAssignmentNode, createBlockNode, createConditionalNode, createFunctionNode, createIndexNode, createOperatorNode, createConstantNode, createFunctionAssignmentNode, createParenthesisNode, createArrayNode, createSimplifyCore, createParse, createResolve, createCompile, createEvaluate, createHelpClass, createParserClass, createSimplify, createDerivative, createRationalize, createHelp, createParser, createCumSumTransform, createApplyTransform, createFilterTransform, createForEachTransform, createMapTransform, createMeanTransform, createSubsetTransform, createVarianceTransform, createMaxTransform, createMinTransform, createRangeTransform, createStdTransform, createSumTransform } from '../factoriesNumber.js';
9
9
  import { e, _false, index, _Infinity, LN10, LOG10E, matrix, _NaN, _null, phi, Range, replacer, ResultSet, SQRT1_2, // eslint-disable-line camelcase
10
- subset, tau, typed, unaryPlus, version, xor, abs, acos, acot, acsc, add, and, asec, asin, atan, atanh, bitAnd, bitOr, boolean, cbrt, combinations, compare, compareText, cos, cot, csc, cube, divide, equalScalar, erf, exp, filter, fix, forEach, format, gamma, isInteger, isNegative, isPositive, isZero, LOG2E, largerEq, leftShift, log10, log2, map, mean, mod, multiply, not, number, or, pi, pow, random, rightLogShift, SQRT2, sech, sin, size, smallerEq, square, string, subtract, tanh, typeOf, unequal, xgcd, acoth, addScalar, asech, bitNot, ceil, combinationsWithRep, cosh, csch, divideScalar, equalText, expm1, isNumeric, LN2, lcm, log1p, multiplyScalar, nthRoot, pickRandom, randomInt, rightArithShift, sec, sinh, sqrt, tan, unaryMinus, acosh, apply, asinh, bitXor, clone, equal, factorial, hasNumericValue, isNaN, larger, mode, norm, partitionSelect, print, quantileSeq, round, smaller, stirlingS2, _true, variance, acsch, atan2, catalan, composition, deepEqual, floor, hypot, log, median, multinomial, permutations, range, sign, std, compareNatural, coth, gcd, isPrime, numeric, prod, sum, bellNumbers, mad, max, min } from './pureFunctionsNumber.generated.js';
10
+ subset, tau, typed, unaryPlus, version, xor, abs, acos, acot, acsc, add, and, asec, asin, atan, atanh, bitAnd, bitOr, boolean, cbrt, combinations, compare, compareText, cos, cot, csc, cube, divide, equalScalar, erf, exp, filter, fix, forEach, format, gamma, isInteger, isNegative, isPositive, isZero, LOG2E, largerEq, leftShift, log10, log2, map, mean, mod, multiply, not, number, or, pi, pow, random, rightLogShift, SQRT2, sech, sin, size, smallerEq, square, string, subtract, tanh, typeOf, unequal, xgcd, acoth, addScalar, asech, bitNot, ceil, combinationsWithRep, cosh, csch, divideScalar, equalText, expm1, isNumeric, LN2, lcm, log1p, multiplyScalar, nthRoot, pickRandom, randomInt, rightArithShift, sec, sinh, sqrt, tan, unaryMinus, acosh, apply, asinh, bitXor, clone, cumsum, equal, factorial, hasNumericValue, isNaN, larger, mode, norm, partitionSelect, print, quantileSeq, round, smaller, stirlingS2, _true, variance, acsch, atan2, catalan, composition, deepEqual, floor, hypot, log, median, multinomial, permutations, range, sign, std, compareNatural, coth, gcd, isPrime, numeric, prod, sum, bellNumbers, mad, max, min } from './pureFunctionsNumber.generated.js';
11
11
  var math = {}; // NOT pure!
12
12
 
13
13
  var mathWithTransform = {}; // NOT pure!
@@ -329,6 +329,7 @@ _extends(math, {
329
329
  asinh,
330
330
  bitXor,
331
331
  clone,
332
+ cumsum,
332
333
  equal,
333
334
  factorial,
334
335
  hasNumericValue,
@@ -384,6 +385,11 @@ _extends(math, {
384
385
  });
385
386
 
386
387
  _extends(mathWithTransform, math, {
388
+ cumsum: createCumSumTransform({
389
+ add,
390
+ typed,
391
+ unaryPlus
392
+ }),
387
393
  apply: createApplyTransform({
388
394
  isInteger,
389
395
  typed
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { config } from './configReadonly.js';
6
6
  import { createBigNumberClass, createComplexClass, createE, createFalse, createFineStructure, createFractionClass, createI, createInfinity, createLN10, createLOG10E, createMatrixClass, createNaN, createNull, createPhi, createRangeClass, createResultSet, createSQRT1_2, // eslint-disable-line camelcase
7
- createSackurTetrode, createTau, createTrue, createVersion, createDenseMatrixClass, createEfimovFactor, createLN2, createPi, createReplacer, createSQRT2, createTyped, createUnaryPlus, createWeakMixingAngle, createAbs, createAcos, createAcot, createAcsc, createAddScalar, createArg, createAsech, createAsinh, createAtan, createAtanh, createBignumber, createBitNot, createBoolean, createClone, createCombinations, createComplex, createConj, createCosh, createCoth, createCsc, createCube, createEqualScalar, createErf, createExp, createExpm1, createFilter, createForEach, createFormat, createGetMatrixDataType, createHex, createIm, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLog10, createLog2, createMap, createMultiplyScalar, createNot, createNumber, createOct, createPickRandom, createPrint, createRandom, createRe, createSec, createSign, createSin, createSparseMatrixClass, createSplitUnit, createSquare, createString, createTan, createTypeOf, createAcosh, createAcsch, createApply, createAsec, createBin, createCombinationsWithRep, createCos, createCsch, createIsNaN, createIsPrime, createRandomInt, createSech, createSinh, createSparse, createSqrt, createTanh, createUnaryMinus, createAcoth, createCot, createFraction, createIsNumeric, createMatrix, createMatrixFromFunction, createMod, createNthRoot, createNumeric, createOr, createProd, createReshape, createSize, createSmaller, createSqueeze, createSubset, createSubtract, createTo, createTranspose, createXgcd, createZeros, createAnd, createBitAnd, createBitXor, createCbrt, createCompare, createCompareText, createConcat, createCount, createCtranspose, createDiag, createDivideScalar, createDotDivide, createEqual, createFlatten, createGcd, createHasNumericValue, createHypot, createImmutableDenseMatrixClass, createIndexClass, createKron, createLargerEq, createLeftShift, createLsolve, createMatrixFromColumns, createMin, createMode, createNthRoots, createOnes, createPartitionSelect, createResize, createRightArithShift, createRound, createSmallerEq, createUnequal, createUsolve, createXor, createAdd, createAtan2, createBitOr, createCatalan, createCompareNatural, createDeepEqual, createDiff, createDot, createEqualText, createFloor, createIdentity, createInvmod, createLarger, createLog, createLsolveAll, createMatrixFromRows, createMultiply, createPow, createQr, createRange, createRightLogShift, createRow, createSetCartesian, createSetDistinct, createSetIsSubset, createSetPowerset, createSlu, createSum, createTrace, createUsolveAll, createAsin, createCeil, createColumn, createComposition, createCross, createDistance, createDotMultiply, createFibonacciHeapClass, createFix, createGamma, createIndex, createLcm, createLog1p, createMax, createQuantileSeq, createSetDifference, createSetMultiplicity, createSetSymDifference, createSort, createUnitClass, createVacuumImpedance, createWienDisplacement, createAtomicMass, createBohrMagneton, createBoltzmann, createConductanceQuantum, createCreateUnit, createDeuteronMass, createDotPow, createElectricConstant, createElementaryCharge, createFactorial, createFermiCoupling, createGasConstant, createGravity, createIntersect, createInverseConductanceQuantum, createKlitzing, createLoschmidt, createMagneticConstant, createMolarMass, createMolarPlanckConstant, createNeutronMass, createNuclearMagneton, createPermutations, createPlanckConstant, createPlanckMass, createPlanckTime, createQuantumOfCirculation, createReducedPlanckConstant, createRydberg, createSetIntersect, createSetUnion, createSpaClass, createStefanBoltzmann, createThomsonCrossSection, createAvogadro, createBohrRadius, createCoulomb, createElectronMass, createFaraday, createHartreeEnergy, createLup, createMagneticFluxQuantum, createMolarMassC12, createPlanckCharge, createPlanckTemperature, createSecondRadiation, createSpeedOfLight, createStirlingS2, createUnitFunction, createBellNumbers, createDet, createFirstRadiation, createMolarVolume, createProtonMass, createSetSize, createClassicalElectronRadius, createGravitationConstant, createInv, createLusolve, createSqrtm, createDivide, createExpm, createKldivergence, createMean, createMedian, createPlanckLength, createVariance, createEigs, createMad, createMultinomial, createStd, createNorm, createRotationMatrix, createRotate } from '../factoriesAny.js';
7
+ createSackurTetrode, createTau, createTrue, createVersion, createDenseMatrixClass, createEfimovFactor, createLN2, createPi, createReplacer, createSQRT2, createTyped, createUnaryPlus, createWeakMixingAngle, createAbs, createAcos, createAcot, createAcsc, createAddScalar, createArg, createAsech, createAsinh, createAtan, createAtanh, createBignumber, createBitNot, createBoolean, createClone, createCombinations, createComplex, createConj, createCosh, createCoth, createCsc, createCube, createEqualScalar, createErf, createExp, createExpm1, createFilter, createForEach, createFormat, createGetMatrixDataType, createHex, createIm, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLog10, createLog2, createMap, createMultiplyScalar, createNot, createNumber, createOct, createPickRandom, createPrint, createRandom, createRe, createSec, createSign, createSin, createSparseMatrixClass, createSplitUnit, createSquare, createString, createTan, createTypeOf, createAcosh, createAcsch, createApply, createAsec, createBin, createCombinationsWithRep, createCos, createCsch, createIsNaN, createIsPrime, createRandomInt, createSech, createSinh, createSparse, createSqrt, createTanh, createUnaryMinus, createAcoth, createCot, createFraction, createIsNumeric, createMatrix, createMatrixFromFunction, createMod, createNthRoot, createNumeric, createOr, createProd, createReshape, createSize, createSmaller, createSqueeze, createSubset, createSubtract, createTo, createTranspose, createXgcd, createZeros, createAnd, createBitAnd, createBitXor, createCbrt, createCompare, createCompareText, createConcat, createCount, createCtranspose, createDiag, createDivideScalar, createDotDivide, createEqual, createFlatten, createGcd, createHasNumericValue, createHypot, createImmutableDenseMatrixClass, createIndexClass, createKron, createLargerEq, createLeftShift, createLsolve, createMatrixFromColumns, createMin, createMode, createNthRoots, createOnes, createPartitionSelect, createResize, createRightArithShift, createRound, createSmallerEq, createUnequal, createUsolve, createXor, createAdd, createAtan2, createBitOr, createCatalan, createCompareNatural, createCumSum, createDeepEqual, createDiff, createDot, createEqualText, createFloor, createIdentity, createInvmod, createLarger, createLog, createLsolveAll, createMatrixFromRows, createMultiply, createPow, createQr, createRange, createRightLogShift, createRow, createSetCartesian, createSetDistinct, createSetIsSubset, createSetPowerset, createSlu, createSum, createTrace, createUsolveAll, createAsin, createCeil, createColumn, createComposition, createCross, createDistance, createDotMultiply, createFibonacciHeapClass, createFix, createGamma, createIndex, createLcm, createLog1p, createMax, createQuantileSeq, createSetDifference, createSetMultiplicity, createSetSymDifference, createSort, createUnitClass, createVacuumImpedance, createWienDisplacement, createAtomicMass, createBohrMagneton, createBoltzmann, createConductanceQuantum, createCreateUnit, createDeuteronMass, createDotPow, createElectricConstant, createElementaryCharge, createFactorial, createFermiCoupling, createGasConstant, createGravity, createIntersect, createInverseConductanceQuantum, createKlitzing, createLoschmidt, createMagneticConstant, createMolarMass, createMolarPlanckConstant, createNeutronMass, createNuclearMagneton, createPermutations, createPlanckConstant, createPlanckMass, createPlanckTime, createQuantumOfCirculation, createReducedPlanckConstant, createRydberg, createSetIntersect, createSetUnion, createSpaClass, createStefanBoltzmann, createThomsonCrossSection, createAvogadro, createBohrRadius, createCoulomb, createElectronMass, createFaraday, createHartreeEnergy, createLup, createMagneticFluxQuantum, createMolarMassC12, createPlanckCharge, createPlanckTemperature, createSecondRadiation, createSpeedOfLight, createStirlingS2, createUnitFunction, createBellNumbers, createDet, createFirstRadiation, createMolarVolume, createProtonMass, createSetSize, createClassicalElectronRadius, createGravitationConstant, createInv, createLusolve, createSqrtm, createDivide, createExpm, createKldivergence, createMean, createMedian, createPlanckLength, createVariance, createEigs, createMad, createMultinomial, createStd, createNorm, createRotationMatrix, createRotate } from '../factoriesAny.js';
8
8
  export var BigNumber = /* #__PURE__ */createBigNumberClass({
9
9
  config
10
10
  });
@@ -721,6 +721,11 @@ export var compareNatural = /* #__PURE__ */createCompareNatural({
721
721
  compare,
722
722
  typed
723
723
  });
724
+ export var cumsum = /* #__PURE__ */createCumSum({
725
+ add,
726
+ typed,
727
+ unaryPlus
728
+ });
724
729
  export var deepEqual = /* #__PURE__ */createDeepEqual({
725
730
  equal,
726
731
  typed
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { config } from './configReadonly.js';
6
6
  import { createE, createFalse, createIndex, createInfinity, createLN10, createLOG10E, createMatrix, createNaN, createNull, createPhi, createRangeClass, createReplacer, createResultSet, createSQRT1_2, // eslint-disable-line camelcase
7
- createSubset, createTau, createTyped, createUnaryPlus, createVersion, createXor, createAbs, createAcos, createAcot, createAcsc, createAdd, createAnd, createAsec, createAsin, createAtan, createAtanh, createBitAnd, createBitOr, createBoolean, createCbrt, createCombinations, createCompare, createCompareText, createCos, createCot, createCsc, createCube, createDivide, createEqualScalar, createErf, createExp, createFilter, createFix, createForEach, createFormat, createGamma, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLargerEq, createLeftShift, createLog10, createLog2, createMap, createMean, createMod, createMultiply, createNot, createNumber, createOr, createPi, createPow, createRandom, createRightLogShift, createSQRT2, createSech, createSin, createSize, createSmallerEq, createSquare, createString, createSubtract, createTanh, createTypeOf, createUnequal, createXgcd, createAcoth, createAddScalar, createAsech, createBitNot, createCeil, createCombinationsWithRep, createCosh, createCsch, createDivideScalar, createEqualText, createExpm1, createIsNumeric, createLN2, createLcm, createLog1p, createMultiplyScalar, createNthRoot, createPickRandom, createRandomInt, createRightArithShift, createSec, createSinh, createSqrt, createTan, createUnaryMinus, createAcosh, createApply, createAsinh, createBitXor, createClone, createEqual, createFactorial, createHasNumericValue, createIsNaN, createLarger, createMode, createNorm, createPartitionSelect, createPrint, createQuantileSeq, createRound, createSmaller, createStirlingS2, createTrue, createVariance, createAcsch, createAtan2, createCatalan, createComposition, createDeepEqual, createFloor, createHypot, createLog, createMedian, createMultinomial, createPermutations, createRange, createSign, createStd, createCompareNatural, createCoth, createGcd, createIsPrime, createNumeric, createProd, createSum, createBellNumbers, createMad, createMax, createMin } from '../factoriesNumber.js';
7
+ createSubset, createTau, createTyped, createUnaryPlus, createVersion, createXor, createAbs, createAcos, createAcot, createAcsc, createAdd, createAnd, createAsec, createAsin, createAtan, createAtanh, createBitAnd, createBitOr, createBoolean, createCbrt, createCombinations, createCompare, createCompareText, createCos, createCot, createCsc, createCube, createDivide, createEqualScalar, createErf, createExp, createFilter, createFix, createForEach, createFormat, createGamma, createIsInteger, createIsNegative, createIsPositive, createIsZero, createLOG2E, createLargerEq, createLeftShift, createLog10, createLog2, createMap, createMean, createMod, createMultiply, createNot, createNumber, createOr, createPi, createPow, createRandom, createRightLogShift, createSQRT2, createSech, createSin, createSize, createSmallerEq, createSquare, createString, createSubtract, createTanh, createTypeOf, createUnequal, createXgcd, createAcoth, createAddScalar, createAsech, createBitNot, createCeil, createCombinationsWithRep, createCosh, createCsch, createDivideScalar, createEqualText, createExpm1, createIsNumeric, createLN2, createLcm, createLog1p, createMultiplyScalar, createNthRoot, createPickRandom, createRandomInt, createRightArithShift, createSec, createSinh, createSqrt, createTan, createUnaryMinus, createAcosh, createApply, createAsinh, createBitXor, createClone, createCumSum, createEqual, createFactorial, createHasNumericValue, createIsNaN, createLarger, createMode, createNorm, createPartitionSelect, createPrint, createQuantileSeq, createRound, createSmaller, createStirlingS2, createTrue, createVariance, createAcsch, createAtan2, createCatalan, createComposition, createDeepEqual, createFloor, createHypot, createLog, createMedian, createMultinomial, createPermutations, createRange, createSign, createStd, createCompareNatural, createCoth, createGcd, createIsPrime, createNumeric, createProd, createSum, createBellNumbers, createMad, createMax, createMin } from '../factoriesNumber.js';
8
8
  export var e = /* #__PURE__ */createE({
9
9
  config
10
10
  });
@@ -336,6 +336,11 @@ export var bitXor = /* #__PURE__ */createBitXor({
336
336
  export var clone = /* #__PURE__ */createClone({
337
337
  typed
338
338
  });
339
+ export var cumsum = /* #__PURE__ */createCumSum({
340
+ add,
341
+ typed,
342
+ unaryPlus
343
+ });
339
344
  export var equal = /* #__PURE__ */createEqual({
340
345
  equalScalar,
341
346
  typed
@@ -1,8 +1,8 @@
1
1
  export var fractionDocs = {
2
2
  name: 'fraction',
3
3
  category: 'Construction',
4
- syntax: ['fraction(num)', 'fraction(num,den)'],
5
- description: 'Create a fraction from a number or from a numerator and denominator.',
6
- examples: ['fraction(0.125)', 'fraction(1, 3) + fraction(2, 5)'],
4
+ syntax: ['fraction(num)', 'fraction(matrix)', 'fraction(num,den)', 'fraction({n: num, d: den})'],
5
+ description: 'Create a fraction from a number or from integer numerator and denominator.',
6
+ examples: ['fraction(0.125)', 'fraction(1, 3) + fraction(2, 5)', 'fraction({n: 333, d: 53})', 'fraction([sqrt(9), sqrt(10), sqrt(11)])'],
7
7
  seealso: ['bignumber', 'boolean', 'complex', 'index', 'matrix', 'string', 'unit']
8
8
  };
@@ -182,6 +182,7 @@ import { modeDocs } from './function/statistics/mode.js';
182
182
  import { prodDocs } from './function/statistics/prod.js';
183
183
  import { quantileSeqDocs } from './function/statistics/quantileSeq.js';
184
184
  import { stdDocs } from './function/statistics/std.js';
185
+ import { cumSumDocs } from './function/statistics/cumsum.js';
185
186
  import { sumDocs } from './function/statistics/sum.js';
186
187
  import { varianceDocs } from './function/statistics/variance.js';
187
188
  import { acosDocs } from './function/trigonometry/acos.js';
@@ -626,6 +627,7 @@ export var embeddedDocs = {
626
627
  // functions - special
627
628
  erf: erfDocs,
628
629
  // functions - statistics
630
+ cumsum: cumSumDocs,
629
631
  mad: madDocs,
630
632
  max: maxDocs,
631
633
  mean: meanDocs,
@@ -0,0 +1,8 @@
1
+ export var cumSumDocs = {
2
+ name: 'cumsum',
3
+ category: 'Statistics',
4
+ syntax: ['cumsum(a, b, c, ...)', 'cumsum(A)'],
5
+ description: 'Compute the cumulative sum of all values.',
6
+ examples: ['cumsum(2, 3, 4, 1)', 'cumsum([2, 3, 4, 1])', 'cumsum([1, 2; 3, 4])', 'cumsum([1, 2; 3, 4], 1)', 'cumsum([1, 2; 3, 4], 2)'],
7
+ seealso: ['max', 'mean', 'median', 'min', 'prod', 'std', 'sum', 'variance']
8
+ };
@@ -0,0 +1,48 @@
1
+ import { isBigNumber, isCollection, isNumber } from '../../utils/is.js';
2
+ import { factory } from '../../utils/factory.js';
3
+ import { errorTransform } from './utils/errorTransform.js';
4
+ import { createCumSum } from '../../function/statistics/cumsum.js';
5
+ /**
6
+ * Attach a transform function to math.sum
7
+ * Adds a property transform containing the transform function.
8
+ *
9
+ * This transform changed the last `dim` parameter of function sum
10
+ * from one-based to zero based
11
+ */
12
+
13
+ var name = 'cumsum';
14
+ var dependencies = ['typed', 'add', 'unaryPlus'];
15
+ export var createCumSumTransform = /* #__PURE__ */factory(name, dependencies, _ref => {
16
+ var {
17
+ typed,
18
+ add,
19
+ unaryPlus
20
+ } = _ref;
21
+ var cumsum = createCumSum({
22
+ typed,
23
+ add,
24
+ unaryPlus
25
+ });
26
+ return typed(name, {
27
+ '...any': function any(args) {
28
+ // change last argument dim from one-based to zero-based
29
+ if (args.length === 2 && isCollection(args[0])) {
30
+ var dim = args[1];
31
+
32
+ if (isNumber(dim)) {
33
+ args[1] = dim - 1;
34
+ } else if (isBigNumber(dim)) {
35
+ args[1] = dim.minus(1);
36
+ }
37
+ }
38
+
39
+ try {
40
+ return cumsum.apply(null, args);
41
+ } catch (err) {
42
+ throw errorTransform(err);
43
+ }
44
+ }
45
+ });
46
+ }, {
47
+ isTransformFunction: true
48
+ });