@syncfusion/ej2-calculate 35.1.37
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/.eslintrc.json +263 -0
- package/README.md +132 -0
- package/base.d.ts +4 -0
- package/base.js +4 -0
- package/common.d.ts +4 -0
- package/common.js +4 -0
- package/dist/ej2-calculate.umd.min.js +11 -0
- package/dist/ej2-calculate.umd.min.js.map +1 -0
- package/dist/es6/ej2-calculate.es2015.js +24801 -0
- package/dist/es6/ej2-calculate.es2015.js.map +1 -0
- package/dist/es6/ej2-calculate.es5.js +27229 -0
- package/dist/es6/ej2-calculate.es5.js.map +1 -0
- package/dist/global/ej2-calculate.min.js +11 -0
- package/dist/global/ej2-calculate.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/formulas.d.ts +4 -0
- package/formulas.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +30 -0
- package/src/base/calculate-model.d.ts +4 -0
- package/src/base/calculate-model.js +0 -0
- package/src/base/calculate.d.ts +1105 -0
- package/src/base/calculate.js +4720 -0
- package/src/base/index.d.ts +8 -0
- package/src/base/index.js +7 -0
- package/src/base/parser.d.ts +208 -0
- package/src/base/parser.js +1512 -0
- package/src/common/address.d.ts +59 -0
- package/src/common/address.js +96 -0
- package/src/common/cell-ref.d.ts +32 -0
- package/src/common/cell-ref.js +112 -0
- package/src/common/common.d.ts +44 -0
- package/src/common/common.js +134 -0
- package/src/common/enum.d.ts +94 -0
- package/src/common/enum.js +97 -0
- package/src/common/index.d.ts +9 -0
- package/src/common/index.js +8 -0
- package/src/common/interface.d.ts +122 -0
- package/src/common/interface.js +0 -0
- package/src/common/l10n.d.ts +24 -0
- package/src/common/l10n.js +54 -0
- package/src/common/number-date.d.ts +26 -0
- package/src/common/number-date.js +38 -0
- package/src/common/sheet-info.d.ts +10 -0
- package/src/common/sheet-info.js +17 -0
- package/src/common/sort.d.ts +17 -0
- package/src/common/sort.js +44 -0
- package/src/formulas/array.d.ts +47 -0
- package/src/formulas/array.js +718 -0
- package/src/formulas/basic.d.ts +47 -0
- package/src/formulas/basic.js +181 -0
- package/src/formulas/complex-numbers.d.ts +207 -0
- package/src/formulas/complex-numbers.js +549 -0
- package/src/formulas/database.d.ts +152 -0
- package/src/formulas/database.js +579 -0
- package/src/formulas/date-time-extra.d.ts +97 -0
- package/src/formulas/date-time-extra.js +415 -0
- package/src/formulas/date-time-intl.d.ts +57 -0
- package/src/formulas/date-time-intl.js +309 -0
- package/src/formulas/date-time.d.ts +164 -0
- package/src/formulas/date-time.js +1021 -0
- package/src/formulas/engineering-base.d.ts +150 -0
- package/src/formulas/engineering-base.js +404 -0
- package/src/formulas/engineering-bessel.d.ts +65 -0
- package/src/formulas/engineering-bessel.js +167 -0
- package/src/formulas/engineering-convert.d.ts +35 -0
- package/src/formulas/engineering-convert.js +120 -0
- package/src/formulas/engineering-misc.d.ts +64 -0
- package/src/formulas/engineering-misc.js +168 -0
- package/src/formulas/financial-amortization-ecma.d.ts +87 -0
- package/src/formulas/financial-amortization-ecma.js +288 -0
- package/src/formulas/financial-annuity.d.ts +104 -0
- package/src/formulas/financial-annuity.js +419 -0
- package/src/formulas/financial-bond-helpers.d.ts +106 -0
- package/src/formulas/financial-bond-helpers.js +190 -0
- package/src/formulas/financial-cashflow.d.ts +47 -0
- package/src/formulas/financial-cashflow.js +203 -0
- package/src/formulas/financial-coupons.d.ts +227 -0
- package/src/formulas/financial-coupons.js +810 -0
- package/src/formulas/financial-depreciation.d.ts +64 -0
- package/src/formulas/financial-depreciation.js +247 -0
- package/src/formulas/financial-rates.d.ts +54 -0
- package/src/formulas/financial-rates.js +140 -0
- package/src/formulas/financial-securities.d.ts +126 -0
- package/src/formulas/financial-securities.js +488 -0
- package/src/formulas/formula-math-helpers.d.ts +212 -0
- package/src/formulas/formula-math-helpers.js +599 -0
- package/src/formulas/formula-module-base.d.ts +54 -0
- package/src/formulas/formula-module-base.js +125 -0
- package/src/formulas/formula-owner.d.ts +17 -0
- package/src/formulas/formula-owner.js +0 -0
- package/src/formulas/index.d.ts +68 -0
- package/src/formulas/index.js +67 -0
- package/src/formulas/information-advanced.d.ts +44 -0
- package/src/formulas/information-advanced.js +157 -0
- package/src/formulas/information-ecma.d.ts +33 -0
- package/src/formulas/information-ecma.js +88 -0
- package/src/formulas/information-extra.d.ts +146 -0
- package/src/formulas/information-extra.js +351 -0
- package/src/formulas/information.d.ts +34 -0
- package/src/formulas/information.js +78 -0
- package/src/formulas/logical-extra.d.ts +75 -0
- package/src/formulas/logical-extra.js +217 -0
- package/src/formulas/logical.d.ts +83 -0
- package/src/formulas/logical.js +296 -0
- package/src/formulas/lookup-array.d.ts +98 -0
- package/src/formulas/lookup-array.js +364 -0
- package/src/formulas/lookup-ref-extra.d.ts +64 -0
- package/src/formulas/lookup-ref-extra.js +180 -0
- package/src/formulas/lookup-ref.d.ts +84 -0
- package/src/formulas/lookup-ref.js +263 -0
- package/src/formulas/lookup.d.ts +114 -0
- package/src/formulas/lookup.js +881 -0
- package/src/formulas/math-aggregate.d.ts +74 -0
- package/src/formulas/math-aggregate.js +376 -0
- package/src/formulas/math-ceiling-ecma.d.ts +42 -0
- package/src/formulas/math-ceiling-ecma.js +123 -0
- package/src/formulas/math-combinatorics.d.ts +75 -0
- package/src/formulas/math-combinatorics.js +290 -0
- package/src/formulas/math-misc.d.ts +164 -0
- package/src/formulas/math-misc.js +889 -0
- package/src/formulas/math-number.d.ts +76 -0
- package/src/formulas/math-number.js +261 -0
- package/src/formulas/math-rounding.d.ts +115 -0
- package/src/formulas/math-rounding.js +728 -0
- package/src/formulas/math-trig-hyperbolic.d.ts +55 -0
- package/src/formulas/math-trig-hyperbolic.js +113 -0
- package/src/formulas/math-trig.d.ts +165 -0
- package/src/formulas/math-trig.js +334 -0
- package/src/formulas/matrix-base.d.ts +13 -0
- package/src/formulas/matrix-base.js +169 -0
- package/src/formulas/matrix.d.ts +64 -0
- package/src/formulas/matrix.js +161 -0
- package/src/formulas/regression-ecma.d.ts +66 -0
- package/src/formulas/regression-ecma.js +234 -0
- package/src/formulas/statistical-advanced.d.ts +125 -0
- package/src/formulas/statistical-advanced.js +756 -0
- package/src/formulas/statistical-correlation.d.ts +75 -0
- package/src/formulas/statistical-correlation.js +198 -0
- package/src/formulas/statistical-dispersion.d.ts +108 -0
- package/src/formulas/statistical-dispersion.js +337 -0
- package/src/formulas/statistical-distribution-extended.d.ts +176 -0
- package/src/formulas/statistical-distribution-extended.js +668 -0
- package/src/formulas/statistical-distribution.d.ts +104 -0
- package/src/formulas/statistical-distribution.js +368 -0
- package/src/formulas/statistical-ecma.d.ts +95 -0
- package/src/formulas/statistical-ecma.js +392 -0
- package/src/formulas/statistical-extended.d.ts +136 -0
- package/src/formulas/statistical-extended.js +340 -0
- package/src/formulas/statistical-ifs.d.ts +46 -0
- package/src/formulas/statistical-ifs.js +180 -0
- package/src/formulas/statistical-moments.d.ts +84 -0
- package/src/formulas/statistical-moments.js +269 -0
- package/src/formulas/statistical-percentile.d.ts +56 -0
- package/src/formulas/statistical-percentile.js +195 -0
- package/src/formulas/statistical-sample-base.d.ts +14 -0
- package/src/formulas/statistical-sample-base.js +124 -0
- package/src/formulas/statistical.d.ts +135 -0
- package/src/formulas/statistical.js +542 -0
- package/src/formulas/text-advanced.d.ts +64 -0
- package/src/formulas/text-advanced.js +222 -0
- package/src/formulas/text-ecma.d.ts +54 -0
- package/src/formulas/text-ecma.js +106 -0
- package/src/formulas/text-extra.d.ts +216 -0
- package/src/formulas/text-extra.js +657 -0
- package/src/formulas/text.d.ts +125 -0
- package/src/formulas/text.js +628 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +14 -0
- package/tslint.json +111 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { CommonErrors } from '../common/index';
|
|
15
|
+
import { getRangeIndexes } from '../common/address';
|
|
16
|
+
import { FormulaModuleBase } from './formula-module-base';
|
|
17
|
+
/**
|
|
18
|
+
* Shared matrix helpers for MDETERM / MINVERSE / MMULT / TRANSPOSE.
|
|
19
|
+
*
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
var MatrixFormulaBase = /** @class */ (function (_super) {
|
|
23
|
+
__extends(MatrixFormulaBase, _super);
|
|
24
|
+
function MatrixFormulaBase() {
|
|
25
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
}
|
|
27
|
+
MatrixFormulaBase.prototype.readMatrix = function (ref) {
|
|
28
|
+
var errCollection = this.parent.getErrorStrings();
|
|
29
|
+
var stripped = ref.split('$').join('');
|
|
30
|
+
if (!this.parent.isCellReference(stripped.split(':')[0])) {
|
|
31
|
+
return errCollection[CommonErrors.Value];
|
|
32
|
+
}
|
|
33
|
+
var indexes = getRangeIndexes(stripped);
|
|
34
|
+
var rows = indexes[2] - indexes[0] + 1;
|
|
35
|
+
var cols = indexes[3] - indexes[1] + 1;
|
|
36
|
+
var cells = this.parent.getCellCollection(stripped);
|
|
37
|
+
var list = Array.isArray(cells) ? cells : [cells];
|
|
38
|
+
if (list.length !== rows * cols) {
|
|
39
|
+
return errCollection[CommonErrors.Value];
|
|
40
|
+
}
|
|
41
|
+
var matrix = [];
|
|
42
|
+
for (var r = 0; r < rows; r++) {
|
|
43
|
+
var row = [];
|
|
44
|
+
for (var c = 0; c < cols; c++) {
|
|
45
|
+
var val = this.parent.getValueFromArg(list[r * cols + c]);
|
|
46
|
+
if (errCollection.indexOf(val) > -1) {
|
|
47
|
+
return val;
|
|
48
|
+
}
|
|
49
|
+
if (val === '' || !this.parent.isNumber(val)) {
|
|
50
|
+
return errCollection[CommonErrors.Value];
|
|
51
|
+
}
|
|
52
|
+
row.push(this.parent.parseFloat(val));
|
|
53
|
+
}
|
|
54
|
+
matrix.push(row);
|
|
55
|
+
}
|
|
56
|
+
return matrix;
|
|
57
|
+
};
|
|
58
|
+
MatrixFormulaBase.prototype.flattenMatrix = function (matrix, transpose) {
|
|
59
|
+
if (transpose === void 0) { transpose = false; }
|
|
60
|
+
var sep = this.parent.getParseArgumentSeparator();
|
|
61
|
+
var rows = matrix.length;
|
|
62
|
+
var cols = matrix[0].length;
|
|
63
|
+
var parts = [];
|
|
64
|
+
if (transpose) {
|
|
65
|
+
for (var c = 0; c < cols; c++) {
|
|
66
|
+
for (var r = 0; r < rows; r++) {
|
|
67
|
+
parts.push(matrix[r][c].toString());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
for (var r = 0; r < rows; r++) {
|
|
73
|
+
for (var c = 0; c < cols; c++) {
|
|
74
|
+
parts.push(matrix[r][c].toString());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return parts.join(sep);
|
|
79
|
+
};
|
|
80
|
+
MatrixFormulaBase.prototype.determinant = function (m) {
|
|
81
|
+
var n = m.length;
|
|
82
|
+
if (n === 1) {
|
|
83
|
+
return m[0][0];
|
|
84
|
+
}
|
|
85
|
+
if (n === 2) {
|
|
86
|
+
return m[0][0] * m[1][1] - m[0][1] * m[1][0];
|
|
87
|
+
}
|
|
88
|
+
var det = 0;
|
|
89
|
+
for (var c = 0; c < n; c++) {
|
|
90
|
+
var minor = [];
|
|
91
|
+
for (var r = 1; r < n; r++) {
|
|
92
|
+
var row = [];
|
|
93
|
+
for (var k = 0; k < n; k++) {
|
|
94
|
+
if (k !== c) {
|
|
95
|
+
row.push(m[r][k]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
minor.push(row);
|
|
99
|
+
}
|
|
100
|
+
det += (c % 2 === 0 ? 1 : -1) * m[0][c] * this.determinant(minor);
|
|
101
|
+
}
|
|
102
|
+
return det;
|
|
103
|
+
};
|
|
104
|
+
MatrixFormulaBase.prototype.inverse = function (m) {
|
|
105
|
+
var n = m.length;
|
|
106
|
+
var aug = [];
|
|
107
|
+
for (var i = 0; i < n; i++) {
|
|
108
|
+
aug.push(m[i].slice());
|
|
109
|
+
for (var j = 0; j < n; j++) {
|
|
110
|
+
aug[i].push(i === j ? 1 : 0);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (var i = 0; i < n; i++) {
|
|
114
|
+
var maxRow = i;
|
|
115
|
+
for (var k = i + 1; k < n; k++) {
|
|
116
|
+
if (Math.abs(aug[k][i]) > Math.abs(aug[maxRow][i])) {
|
|
117
|
+
maxRow = k;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
var tmp = aug[i];
|
|
121
|
+
aug[i] = aug[maxRow];
|
|
122
|
+
aug[maxRow] = tmp;
|
|
123
|
+
var pivot = aug[i][i];
|
|
124
|
+
if (Math.abs(pivot) < 1e-12) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
for (var j = 0; j < 2 * n; j++) {
|
|
128
|
+
aug[i][j] /= pivot;
|
|
129
|
+
}
|
|
130
|
+
for (var k = 0; k < n; k++) {
|
|
131
|
+
if (k === i) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
var factor = aug[k][i];
|
|
135
|
+
for (var j = 0; j < 2 * n; j++) {
|
|
136
|
+
aug[k][j] -= factor * aug[i][j];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
var inv = [];
|
|
141
|
+
for (var i = 0; i < n; i++) {
|
|
142
|
+
inv.push(aug[i].slice(n));
|
|
143
|
+
}
|
|
144
|
+
return inv;
|
|
145
|
+
};
|
|
146
|
+
MatrixFormulaBase.prototype.multiply = function (a, b) {
|
|
147
|
+
if (a[0].length !== b.length) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
var rows = a.length;
|
|
151
|
+
var cols = b[0].length;
|
|
152
|
+
var inner = b.length;
|
|
153
|
+
var result = [];
|
|
154
|
+
for (var i = 0; i < rows; i++) {
|
|
155
|
+
var row = [];
|
|
156
|
+
for (var j = 0; j < cols; j++) {
|
|
157
|
+
var sum = 0;
|
|
158
|
+
for (var k = 0; k < inner; k++) {
|
|
159
|
+
sum += a[i][k] * b[k][j];
|
|
160
|
+
}
|
|
161
|
+
row.push(sum);
|
|
162
|
+
}
|
|
163
|
+
result.push(row);
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
};
|
|
167
|
+
return MatrixFormulaBase;
|
|
168
|
+
}(FormulaModuleBase));
|
|
169
|
+
export { MatrixFormulaBase };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { IBasicFormula } from '../common/index';
|
|
2
|
+
import { FormulaOwner } from './formula-owner';
|
|
3
|
+
import { MatrixFormulaBase } from './matrix-base';
|
|
4
|
+
/**
|
|
5
|
+
* Matrix and linear-algebra helpers for array-oriented spreadsheet calculations.
|
|
6
|
+
*
|
|
7
|
+
* Registered functions: MDETERM, MINVERSE, MMULT, TRANSPOSE.
|
|
8
|
+
*
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare class MatrixFormulas extends MatrixFormulaBase {
|
|
12
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
13
|
+
formulas: IBasicFormula[];
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
17
|
+
*/
|
|
18
|
+
constructor(owner: FormulaOwner);
|
|
19
|
+
/**
|
|
20
|
+
* Returns the matrix determinant of an array.
|
|
21
|
+
*
|
|
22
|
+
* Excel: `MDETERM(...)`.
|
|
23
|
+
*
|
|
24
|
+
* @hidden
|
|
25
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
26
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* engine.computeFormula('=MDETERM(1)');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
ComputeMDETERM(...args: string[]): string | number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the matrix inverse of an array.
|
|
36
|
+
*
|
|
37
|
+
* Excel: `MINVERSE(...)`.
|
|
38
|
+
*
|
|
39
|
+
* @hidden
|
|
40
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
41
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
42
|
+
*/
|
|
43
|
+
ComputeMINVERSE(...args: string[]): string | number;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the matrix product of two arrays.
|
|
46
|
+
*
|
|
47
|
+
* Excel: `MMULT(...)`.
|
|
48
|
+
*
|
|
49
|
+
* @hidden
|
|
50
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
51
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
52
|
+
*/
|
|
53
|
+
ComputeMMULT(...args: string[]): string | number;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the transpose of an array.
|
|
56
|
+
*
|
|
57
|
+
* Excel: `TRANSPOSE(...)`.
|
|
58
|
+
*
|
|
59
|
+
* @hidden
|
|
60
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
61
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
62
|
+
*/
|
|
63
|
+
ComputeTRANSPOSE(...args: string[]): string | number;
|
|
64
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { FormulasErrorsStrings, CommonErrors } from '../common/index';
|
|
15
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
|
+
import { MatrixFormulaBase } from './matrix-base';
|
|
17
|
+
/**
|
|
18
|
+
* Matrix and linear-algebra helpers for array-oriented spreadsheet calculations.
|
|
19
|
+
*
|
|
20
|
+
* Registered functions: MDETERM, MINVERSE, MMULT, TRANSPOSE.
|
|
21
|
+
*
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
var MatrixFormulas = /** @class */ (function (_super) {
|
|
25
|
+
__extends(MatrixFormulas, _super);
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
29
|
+
*/
|
|
30
|
+
function MatrixFormulas(owner) {
|
|
31
|
+
var _this = _super.call(this, owner) || this;
|
|
32
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
33
|
+
_this.formulas = [
|
|
34
|
+
{ formulaName: 'MDETERM', category: 'Math & Trig', description: 'Returns the matrix determinant of an array.' },
|
|
35
|
+
{ formulaName: 'MINVERSE', category: 'Math & Trig', description: 'Returns the matrix inverse of an array.' },
|
|
36
|
+
{ formulaName: 'MMULT', category: 'Math & Trig', description: 'Returns the matrix product of two arrays.' },
|
|
37
|
+
{ formulaName: 'TRANSPOSE', category: 'Math & Trig', description: 'Returns the transpose of an array.' }
|
|
38
|
+
];
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns the matrix determinant of an array.
|
|
43
|
+
*
|
|
44
|
+
* Excel: `MDETERM(...)`.
|
|
45
|
+
*
|
|
46
|
+
* @hidden
|
|
47
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
48
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* engine.computeFormula('=MDETERM(1)');
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
MatrixFormulas.prototype.ComputeMDETERM = function () {
|
|
56
|
+
var args = [];
|
|
57
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58
|
+
args[_i] = arguments[_i];
|
|
59
|
+
}
|
|
60
|
+
var errCollection = this.parent.getErrorStrings();
|
|
61
|
+
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
62
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
63
|
+
}
|
|
64
|
+
var matrix = this.readMatrix(args[0]);
|
|
65
|
+
if (typeof matrix === 'string') {
|
|
66
|
+
return matrix;
|
|
67
|
+
}
|
|
68
|
+
if (matrix.length !== matrix[0].length) {
|
|
69
|
+
return errCollection[CommonErrors.Value];
|
|
70
|
+
}
|
|
71
|
+
return this.determinant(matrix).toString();
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Returns the matrix inverse of an array.
|
|
75
|
+
*
|
|
76
|
+
* Excel: `MINVERSE(...)`.
|
|
77
|
+
*
|
|
78
|
+
* @hidden
|
|
79
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
80
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
81
|
+
*/
|
|
82
|
+
MatrixFormulas.prototype.ComputeMINVERSE = function () {
|
|
83
|
+
var args = [];
|
|
84
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
85
|
+
args[_i] = arguments[_i];
|
|
86
|
+
}
|
|
87
|
+
var errCollection = this.parent.getErrorStrings();
|
|
88
|
+
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
89
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
90
|
+
}
|
|
91
|
+
var matrix = this.readMatrix(args[0]);
|
|
92
|
+
if (typeof matrix === 'string') {
|
|
93
|
+
return matrix;
|
|
94
|
+
}
|
|
95
|
+
if (matrix.length !== matrix[0].length) {
|
|
96
|
+
return errCollection[CommonErrors.Value];
|
|
97
|
+
}
|
|
98
|
+
var inv = this.inverse(matrix);
|
|
99
|
+
if (!inv) {
|
|
100
|
+
return errCollection[CommonErrors.Num];
|
|
101
|
+
}
|
|
102
|
+
return this.flattenMatrix(inv);
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Returns the matrix product of two arrays.
|
|
106
|
+
*
|
|
107
|
+
* Excel: `MMULT(...)`.
|
|
108
|
+
*
|
|
109
|
+
* @hidden
|
|
110
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
111
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
112
|
+
*/
|
|
113
|
+
MatrixFormulas.prototype.ComputeMMULT = function () {
|
|
114
|
+
var args = [];
|
|
115
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
116
|
+
args[_i] = arguments[_i];
|
|
117
|
+
}
|
|
118
|
+
var errCollection = this.parent.getErrorStrings();
|
|
119
|
+
if (isNullOrUndefined(args) || args.length !== 2) {
|
|
120
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
121
|
+
}
|
|
122
|
+
var a = this.readMatrix(args[0]);
|
|
123
|
+
var b = this.readMatrix(args[1]);
|
|
124
|
+
if (typeof a === 'string') {
|
|
125
|
+
return a;
|
|
126
|
+
}
|
|
127
|
+
if (typeof b === 'string') {
|
|
128
|
+
return b;
|
|
129
|
+
}
|
|
130
|
+
var product = this.multiply(a, b);
|
|
131
|
+
if (!product) {
|
|
132
|
+
return errCollection[CommonErrors.Value];
|
|
133
|
+
}
|
|
134
|
+
return this.flattenMatrix(product);
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Returns the transpose of an array.
|
|
138
|
+
*
|
|
139
|
+
* Excel: `TRANSPOSE(...)`.
|
|
140
|
+
*
|
|
141
|
+
* @hidden
|
|
142
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
143
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
144
|
+
*/
|
|
145
|
+
MatrixFormulas.prototype.ComputeTRANSPOSE = function () {
|
|
146
|
+
var args = [];
|
|
147
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
148
|
+
args[_i] = arguments[_i];
|
|
149
|
+
}
|
|
150
|
+
if (isNullOrUndefined(args) || args.length !== 1) {
|
|
151
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
152
|
+
}
|
|
153
|
+
var matrix = this.readMatrix(args[0]);
|
|
154
|
+
if (typeof matrix === 'string') {
|
|
155
|
+
return matrix;
|
|
156
|
+
}
|
|
157
|
+
return this.flattenMatrix(matrix, true);
|
|
158
|
+
};
|
|
159
|
+
return MatrixFormulas;
|
|
160
|
+
}(MatrixFormulaBase));
|
|
161
|
+
export { MatrixFormulas };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { IBasicFormula } from '../common/index';
|
|
2
|
+
import { FormulaOwner } from './formula-owner';
|
|
3
|
+
import { StatisticalSampleBase } from './statistical-sample-base';
|
|
4
|
+
/**
|
|
5
|
+
* ECMA-376 linear and exponential regression/trend functions (LINEST, LOGEST, TREND, GROWTH).
|
|
6
|
+
*
|
|
7
|
+
* Registered functions: LINEST, LOGEST, GROWTH, TREND.
|
|
8
|
+
*
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare class RegressionEcmaFormulas extends StatisticalSampleBase {
|
|
12
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
13
|
+
formulas: IBasicFormula[];
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
17
|
+
*/
|
|
18
|
+
constructor(owner: FormulaOwner);
|
|
19
|
+
private linearRegression;
|
|
20
|
+
private expRegression;
|
|
21
|
+
/**
|
|
22
|
+
* Returns statistics that describe a linear trend (slope when spill unavailable).
|
|
23
|
+
*
|
|
24
|
+
* Excel: `LINEST(...)`.
|
|
25
|
+
*
|
|
26
|
+
* @hidden
|
|
27
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
28
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* engine.computeFormula('=LINEST(1)');
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
ComputeLINEST(...args: string[]): string | number;
|
|
36
|
+
/**
|
|
37
|
+
* Returns statistics that describe an exponential curve (first coefficient when spill unavailable).
|
|
38
|
+
*
|
|
39
|
+
* Excel: `LOGEST(...)`.
|
|
40
|
+
*
|
|
41
|
+
* @hidden
|
|
42
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
43
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
44
|
+
*/
|
|
45
|
+
ComputeLOGEST(...args: string[]): string | number;
|
|
46
|
+
/**
|
|
47
|
+
* Returns y values along a linear trend (first predicted value when spill unavailable).
|
|
48
|
+
*
|
|
49
|
+
* Excel: `TREND(...)`.
|
|
50
|
+
*
|
|
51
|
+
* @hidden
|
|
52
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
53
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
54
|
+
*/
|
|
55
|
+
ComputeTREND(...args: string[]): string | number;
|
|
56
|
+
/**
|
|
57
|
+
* Returns y values along an exponential growth trend (first predicted value when spill unavailable).
|
|
58
|
+
*
|
|
59
|
+
* Excel: `GROWTH(...)`.
|
|
60
|
+
*
|
|
61
|
+
* @hidden
|
|
62
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
63
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
64
|
+
*/
|
|
65
|
+
ComputeGROWTH(...args: string[]): string | number;
|
|
66
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
import { FormulasErrorsStrings, CommonErrors } from '../common/index';
|
|
15
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
|
+
import { StatisticalSampleBase } from './statistical-sample-base';
|
|
17
|
+
/**
|
|
18
|
+
* ECMA-376 linear and exponential regression/trend functions (LINEST, LOGEST, TREND, GROWTH).
|
|
19
|
+
*
|
|
20
|
+
* Registered functions: LINEST, LOGEST, GROWTH, TREND.
|
|
21
|
+
*
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
var RegressionEcmaFormulas = /** @class */ (function (_super) {
|
|
25
|
+
__extends(RegressionEcmaFormulas, _super);
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
* @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
|
|
29
|
+
*/
|
|
30
|
+
function RegressionEcmaFormulas(owner) {
|
|
31
|
+
var _this = _super.call(this, owner) || this;
|
|
32
|
+
/** Formula definitions registered with {@link BasicFormulas}. */
|
|
33
|
+
_this.formulas = [
|
|
34
|
+
{ formulaName: 'LINEST', category: 'Statistical', description: 'Returns statistics that describe a linear trend.' },
|
|
35
|
+
{ formulaName: 'LOGEST', category: 'Statistical', description: 'Returns statistics that describe an exponential curve.' },
|
|
36
|
+
{ formulaName: 'GROWTH', category: 'Statistical', description: 'Returns numbers in an exponential growth trend.' },
|
|
37
|
+
{ formulaName: 'TREND', category: 'Statistical', description: 'Returns numbers in a linear trend.' }
|
|
38
|
+
];
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
RegressionEcmaFormulas.prototype.linearRegression = function (yArg, xArg) {
|
|
42
|
+
var pair = this.collectPair([xArg, yArg]);
|
|
43
|
+
if (typeof pair === 'string') {
|
|
44
|
+
return pair;
|
|
45
|
+
}
|
|
46
|
+
var x = pair.x, y = pair.y;
|
|
47
|
+
if (x.length < 2) {
|
|
48
|
+
return this.parent.getErrorStrings()[CommonErrors.NA];
|
|
49
|
+
}
|
|
50
|
+
var meanX = this.mean(x);
|
|
51
|
+
var meanY = this.mean(y);
|
|
52
|
+
var sxx = 0;
|
|
53
|
+
var sxy = 0;
|
|
54
|
+
for (var i = 0; i < x.length; i++) {
|
|
55
|
+
var dx = x[i] - meanX;
|
|
56
|
+
sxx += dx * dx;
|
|
57
|
+
sxy += dx * (y[i] - meanY);
|
|
58
|
+
}
|
|
59
|
+
if (sxx === 0) {
|
|
60
|
+
return this.parent.getErrorStrings()[CommonErrors.DivZero];
|
|
61
|
+
}
|
|
62
|
+
var slope = sxy / sxx;
|
|
63
|
+
var intercept = meanY - slope * meanX;
|
|
64
|
+
return { slope: slope, intercept: intercept };
|
|
65
|
+
};
|
|
66
|
+
RegressionEcmaFormulas.prototype.expRegression = function (yArg, xArg) {
|
|
67
|
+
var pair = this.collectPair([xArg, yArg]);
|
|
68
|
+
if (typeof pair === 'string') {
|
|
69
|
+
return pair;
|
|
70
|
+
}
|
|
71
|
+
var x = pair.x, y = pair.y;
|
|
72
|
+
var errCollection = this.parent.getErrorStrings();
|
|
73
|
+
if (x.length < 2) {
|
|
74
|
+
return errCollection[CommonErrors.NA];
|
|
75
|
+
}
|
|
76
|
+
var lnY = [];
|
|
77
|
+
for (var i = 0; i < y.length; i++) {
|
|
78
|
+
if (y[i] <= 0) {
|
|
79
|
+
return errCollection[CommonErrors.Num];
|
|
80
|
+
}
|
|
81
|
+
lnY.push(Math.log(y[i]));
|
|
82
|
+
}
|
|
83
|
+
var meanX = this.mean(x);
|
|
84
|
+
var meanLnY = this.mean(lnY);
|
|
85
|
+
var sxx = 0;
|
|
86
|
+
var sxy = 0;
|
|
87
|
+
for (var i = 0; i < x.length; i++) {
|
|
88
|
+
var dx = x[i] - meanX;
|
|
89
|
+
sxx += dx * dx;
|
|
90
|
+
sxy += dx * (lnY[i] - meanLnY);
|
|
91
|
+
}
|
|
92
|
+
if (sxx === 0) {
|
|
93
|
+
return errCollection[CommonErrors.DivZero];
|
|
94
|
+
}
|
|
95
|
+
var m = sxy / sxx;
|
|
96
|
+
var b = Math.exp(meanLnY - m * meanX);
|
|
97
|
+
return { b: b, m: m };
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Returns statistics that describe a linear trend (slope when spill unavailable).
|
|
101
|
+
*
|
|
102
|
+
* Excel: `LINEST(...)`.
|
|
103
|
+
*
|
|
104
|
+
* @hidden
|
|
105
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
106
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* engine.computeFormula('=LINEST(1)');
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
RegressionEcmaFormulas.prototype.ComputeLINEST = function () {
|
|
114
|
+
var args = [];
|
|
115
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
116
|
+
args[_i] = arguments[_i];
|
|
117
|
+
}
|
|
118
|
+
if (isNullOrUndefined(args) || args.length < 2 || args.length > 4) {
|
|
119
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
120
|
+
}
|
|
121
|
+
var reg = this.linearRegression(args[0], args[1]);
|
|
122
|
+
if (typeof reg === 'string') {
|
|
123
|
+
return reg;
|
|
124
|
+
}
|
|
125
|
+
return reg.slope.toString();
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Returns statistics that describe an exponential curve (first coefficient when spill unavailable).
|
|
129
|
+
*
|
|
130
|
+
* Excel: `LOGEST(...)`.
|
|
131
|
+
*
|
|
132
|
+
* @hidden
|
|
133
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
134
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
135
|
+
*/
|
|
136
|
+
RegressionEcmaFormulas.prototype.ComputeLOGEST = function () {
|
|
137
|
+
var args = [];
|
|
138
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
139
|
+
args[_i] = arguments[_i];
|
|
140
|
+
}
|
|
141
|
+
if (isNullOrUndefined(args) || args.length < 2 || args.length > 4) {
|
|
142
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
143
|
+
}
|
|
144
|
+
var reg = this.expRegression(args[0], args[1]);
|
|
145
|
+
if (typeof reg === 'string') {
|
|
146
|
+
return reg;
|
|
147
|
+
}
|
|
148
|
+
return reg.b.toString();
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Returns y values along a linear trend (first predicted value when spill unavailable).
|
|
152
|
+
*
|
|
153
|
+
* Excel: `TREND(...)`.
|
|
154
|
+
*
|
|
155
|
+
* @hidden
|
|
156
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
157
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
158
|
+
*/
|
|
159
|
+
RegressionEcmaFormulas.prototype.ComputeTREND = function () {
|
|
160
|
+
var args = [];
|
|
161
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
162
|
+
args[_i] = arguments[_i];
|
|
163
|
+
}
|
|
164
|
+
if (isNullOrUndefined(args) || args.length < 2 || args.length > 3) {
|
|
165
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
166
|
+
}
|
|
167
|
+
var reg = this.linearRegression(args[0], args[1]);
|
|
168
|
+
if (typeof reg === 'string') {
|
|
169
|
+
return reg;
|
|
170
|
+
}
|
|
171
|
+
var xVal;
|
|
172
|
+
if (args.length === 3 && args[2] !== '') {
|
|
173
|
+
var xNew = this.collectSample([args[2]], false);
|
|
174
|
+
if (typeof xNew === 'string') {
|
|
175
|
+
return xNew;
|
|
176
|
+
}
|
|
177
|
+
if (xNew.length === 0) {
|
|
178
|
+
return this.parent.getErrorStrings()[CommonErrors.NA];
|
|
179
|
+
}
|
|
180
|
+
xVal = xNew[0];
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
var xData = this.collectSample([args[1]], false);
|
|
184
|
+
if (typeof xData === 'string') {
|
|
185
|
+
return xData;
|
|
186
|
+
}
|
|
187
|
+
xVal = xData[xData.length - 1] + 1;
|
|
188
|
+
}
|
|
189
|
+
return (reg.intercept + reg.slope * xVal).toString();
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Returns y values along an exponential growth trend (first predicted value when spill unavailable).
|
|
193
|
+
*
|
|
194
|
+
* Excel: `GROWTH(...)`.
|
|
195
|
+
*
|
|
196
|
+
* @hidden
|
|
197
|
+
* @param {string[]} args - Formula argument tokens from the Calculate engine.
|
|
198
|
+
* @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
|
|
199
|
+
*/
|
|
200
|
+
RegressionEcmaFormulas.prototype.ComputeGROWTH = function () {
|
|
201
|
+
var args = [];
|
|
202
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
203
|
+
args[_i] = arguments[_i];
|
|
204
|
+
}
|
|
205
|
+
if (isNullOrUndefined(args) || args.length < 2 || args.length > 3) {
|
|
206
|
+
return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
|
|
207
|
+
}
|
|
208
|
+
var reg = this.expRegression(args[0], args[1]);
|
|
209
|
+
if (typeof reg === 'string') {
|
|
210
|
+
return reg;
|
|
211
|
+
}
|
|
212
|
+
var xVal;
|
|
213
|
+
if (args.length === 3 && args[2] !== '') {
|
|
214
|
+
var xNew = this.collectSample([args[2]], false);
|
|
215
|
+
if (typeof xNew === 'string') {
|
|
216
|
+
return xNew;
|
|
217
|
+
}
|
|
218
|
+
if (xNew.length === 0) {
|
|
219
|
+
return this.parent.getErrorStrings()[CommonErrors.NA];
|
|
220
|
+
}
|
|
221
|
+
xVal = xNew[0];
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
var xData = this.collectSample([args[1]], false);
|
|
225
|
+
if (typeof xData === 'string') {
|
|
226
|
+
return xData;
|
|
227
|
+
}
|
|
228
|
+
xVal = xData[xData.length - 1] + 1;
|
|
229
|
+
}
|
|
230
|
+
return (reg.b * Math.pow(Math.E, reg.m * xVal)).toString();
|
|
231
|
+
};
|
|
232
|
+
return RegressionEcmaFormulas;
|
|
233
|
+
}(StatisticalSampleBase));
|
|
234
|
+
export { RegressionEcmaFormulas };
|