@danielsimonjr/mathts-functions 0.46.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cas-integration.d.ts +6 -0
- package/dist/cas-integration.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +480 -169
- package/dist/probability/util/gammaSample.d.ts +19 -0
- package/dist/probability/util/gammaSample.d.ts.map +1 -0
- package/dist/stats/gaussian-process.d.ts +49 -0
- package/dist/stats/gaussian-process.d.ts.map +1 -0
- package/dist/stats/multivariate-sampling.d.ts +41 -0
- package/dist/stats/multivariate-sampling.d.ts.map +1 -0
- package/dist/typed/algebra.d.ts +18 -6
- package/dist/typed/algebra.d.ts.map +1 -1
- package/dist/typed/cas.d.ts +31 -27
- package/dist/typed/cas.d.ts.map +1 -1
- package/dist/typed/dist-objects.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
* returned as an expression string (without the constant of integration). If the
|
|
4
4
|
* integrand is outside the supported subset, returns `integral(expr, variable)`.
|
|
5
5
|
*
|
|
6
|
+
* The direct recursion is tried first; on failure, partial-fraction integration
|
|
7
|
+
* (for rational integrands) and tabular integration by parts (for
|
|
8
|
+
* polynomial·{exp,sin,cos}) are attempted before giving up with the marker.
|
|
9
|
+
*
|
|
6
10
|
* @example symbolicIntegral('x^3') // 'x^4 / 4'
|
|
7
11
|
* @example symbolicIntegral('cos(3*x + 1)') // 'sin(3 * x + 1) / 3'
|
|
12
|
+
* @example symbolicIntegral('1/(x^2 - 1)') // partial fractions → sum of logs
|
|
13
|
+
* @example symbolicIntegral('x * sin(x)') // by parts → 'sin(x) - x*cos(x)'
|
|
8
14
|
*/
|
|
9
15
|
export declare function symbolicIntegral(expr: string, variable?: string): string;
|
|
10
16
|
//# sourceMappingURL=cas-integration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas-integration.d.ts","sourceRoot":"","sources":["../src/cas-integration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cas-integration.d.ts","sourceRoot":"","sources":["../src/cas-integration.ts"],"names":[],"mappings":"AAoWA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,CAWrE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -118,4 +118,8 @@ export { mvnPdf, mvnSample } from './stats/mvn.js';
|
|
|
118
118
|
export type { MvnVector, MvnCov, MvnSampleOptions } from './stats/mvn.js';
|
|
119
119
|
export { tTestPower } from './stats/power-analysis.js';
|
|
120
120
|
export type { TTestPowerAlternative, TTestPowerOptions } from './stats/power-analysis.js';
|
|
121
|
+
export { gaussianProcessRegression, gpRegression } from './stats/gaussian-process.js';
|
|
122
|
+
export type { GPKernel, GPOptions, GPPrediction, GPModel } from './stats/gaussian-process.js';
|
|
123
|
+
export { dirichletSample, dirichletPdf, wishartSample } from './stats/multivariate-sampling.js';
|
|
124
|
+
export type { SampleSeedOptions } from './stats/multivariate-sampling.js';
|
|
121
125
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,kBAAkB,CAAC;AAKjC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAOzC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGlG,OAAO,EAAE,IAAI,EAA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AAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAI9F,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAChG,YAAY,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10230,10 +10230,10 @@ function splitProductChain(term) {
|
|
|
10230
10230
|
return { nums, dens };
|
|
10231
10231
|
}
|
|
10232
10232
|
function expand(expr) {
|
|
10233
|
-
const
|
|
10234
|
-
if (
|
|
10233
|
+
const vars = variables(expr);
|
|
10234
|
+
if (vars.length >= 1) {
|
|
10235
10235
|
try {
|
|
10236
|
-
return polyToString(polyFromExpression(expr,
|
|
10236
|
+
return polyToString(polyFromExpression(expr, vars), vars);
|
|
10237
10237
|
} catch {
|
|
10238
10238
|
}
|
|
10239
10239
|
}
|
|
@@ -10256,8 +10256,71 @@ function expand(expr) {
|
|
|
10256
10256
|
}
|
|
10257
10257
|
return result;
|
|
10258
10258
|
}
|
|
10259
|
+
function monomialString(powers, vars) {
|
|
10260
|
+
return powers.map((e, i) => e === 0 ? "" : e === 1 ? vars[i] : `${vars[i]}^${e}`).filter(Boolean).join("*");
|
|
10261
|
+
}
|
|
10262
|
+
function perfectIntSqrt(n) {
|
|
10263
|
+
if (n < 0) return null;
|
|
10264
|
+
const r = Math.round(Math.sqrt(n));
|
|
10265
|
+
return r * r === n ? r : null;
|
|
10266
|
+
}
|
|
10267
|
+
function tryMonomialDiffOfSquares(poly, vars) {
|
|
10268
|
+
if (poly.length !== 2) return null;
|
|
10269
|
+
const [t1, t2] = poly;
|
|
10270
|
+
if (Math.sign(t1.coeff) === Math.sign(t2.coeff)) return null;
|
|
10271
|
+
const pos = t1.coeff > 0 ? t1 : t2;
|
|
10272
|
+
const neg = t1.coeff > 0 ? t2 : t1;
|
|
10273
|
+
const cp = perfectIntSqrt(Math.round(pos.coeff));
|
|
10274
|
+
const cn = perfectIntSqrt(Math.round(-neg.coeff));
|
|
10275
|
+
if (cp === null || cn === null) return null;
|
|
10276
|
+
if (!pos.powers.every((e) => e % 2 === 0) || !neg.powers.every((e) => e % 2 === 0)) return null;
|
|
10277
|
+
const half = (t) => t.powers.map((e) => e / 2);
|
|
10278
|
+
const term = (c, powers) => {
|
|
10279
|
+
const mon = monomialString(powers, vars);
|
|
10280
|
+
if (!mon) return String(c);
|
|
10281
|
+
return c === 1 ? mon : `${c}*${mon}`;
|
|
10282
|
+
};
|
|
10283
|
+
const A = term(cp, half(pos));
|
|
10284
|
+
const B = term(cn, half(neg));
|
|
10285
|
+
return [`(${A} - ${B})`, `(${A} + ${B})`];
|
|
10286
|
+
}
|
|
10287
|
+
function factorMultivariate(expr, vars) {
|
|
10288
|
+
let poly;
|
|
10289
|
+
try {
|
|
10290
|
+
poly = polyFromExpression(expr, vars);
|
|
10291
|
+
} catch {
|
|
10292
|
+
return null;
|
|
10293
|
+
}
|
|
10294
|
+
if (poly.length < 2 || !poly.every((t) => isNearInt(t.coeff))) return null;
|
|
10295
|
+
let content = 0;
|
|
10296
|
+
for (const t of poly) content = gcdNum(content, Math.abs(Math.round(t.coeff)));
|
|
10297
|
+
if (content === 0) return null;
|
|
10298
|
+
const nVars = vars.length;
|
|
10299
|
+
const monPow = new Array(nVars).fill(Infinity);
|
|
10300
|
+
for (const t of poly)
|
|
10301
|
+
for (let i = 0; i < nVars; i++) monPow[i] = Math.min(monPow[i], t.powers[i]);
|
|
10302
|
+
const hasMonomial = monPow.some((e) => e > 0);
|
|
10303
|
+
const cofactor = normalize(
|
|
10304
|
+
poly.map((t) => ({
|
|
10305
|
+
coeff: Math.round(t.coeff) / content,
|
|
10306
|
+
powers: t.powers.map((e, i) => e - monPow[i])
|
|
10307
|
+
}))
|
|
10308
|
+
);
|
|
10309
|
+
const dsq = tryMonomialDiffOfSquares(cofactor, vars);
|
|
10310
|
+
if (!hasMonomial && !dsq) return null;
|
|
10311
|
+
const parts = [];
|
|
10312
|
+
if (content > 1) parts.push(String(content));
|
|
10313
|
+
if (hasMonomial) parts.push(monomialString(monPow, vars));
|
|
10314
|
+
if (dsq) parts.push(dsq[0], dsq[1]);
|
|
10315
|
+
else parts.push(`(${polyToString(cofactor, vars)})`);
|
|
10316
|
+
return parts.join("*");
|
|
10317
|
+
}
|
|
10259
10318
|
function factor(expr) {
|
|
10260
10319
|
const univariateVars = variables(expr);
|
|
10320
|
+
if (univariateVars.length >= 2) {
|
|
10321
|
+
const mv = factorMultivariate(expr, univariateVars);
|
|
10322
|
+
if (mv !== null) return mv;
|
|
10323
|
+
}
|
|
10261
10324
|
if (univariateVars.length === 1) {
|
|
10262
10325
|
try {
|
|
10263
10326
|
const v = univariateVars[0];
|
|
@@ -15178,6 +15241,34 @@ async function eigenvectorCentrality(adj, opts) {
|
|
|
15178
15241
|
|
|
15179
15242
|
// src/typed/dist-objects.ts
|
|
15180
15243
|
import { computePool as computePool9 } from "@danielsimonjr/mathts-parallel";
|
|
15244
|
+
|
|
15245
|
+
// src/probability/util/gammaSample.ts
|
|
15246
|
+
function normalSampleRng(rng) {
|
|
15247
|
+
const u1 = rng();
|
|
15248
|
+
const u2 = rng();
|
|
15249
|
+
return Math.sqrt(-2 * Math.log(u1 < 1e-300 ? 1e-300 : u1)) * Math.cos(2 * Math.PI * u2);
|
|
15250
|
+
}
|
|
15251
|
+
function gammaSampleRng(alpha, rng) {
|
|
15252
|
+
if (alpha < 1) {
|
|
15253
|
+
return gammaSampleRng(alpha + 1, rng) * Math.pow(rng(), 1 / alpha);
|
|
15254
|
+
}
|
|
15255
|
+
const d = alpha - 1 / 3;
|
|
15256
|
+
const c = 1 / Math.sqrt(9 * d);
|
|
15257
|
+
for (; ; ) {
|
|
15258
|
+
let x;
|
|
15259
|
+
let v;
|
|
15260
|
+
do {
|
|
15261
|
+
x = normalSampleRng(rng);
|
|
15262
|
+
v = 1 + c * x;
|
|
15263
|
+
} while (v <= 0);
|
|
15264
|
+
v = v * v * v;
|
|
15265
|
+
const u = rng();
|
|
15266
|
+
if (u < 1 - 0.0331 * (x * x) * (x * x)) return d * v;
|
|
15267
|
+
if (Math.log(u) < 0.5 * x * x + d * (1 - v + Math.log(v))) return d * v;
|
|
15268
|
+
}
|
|
15269
|
+
}
|
|
15270
|
+
|
|
15271
|
+
// src/typed/dist-objects.ts
|
|
15181
15272
|
var DIST_WORKER_THRESHOLD = 1e5;
|
|
15182
15273
|
var SQRT_2PI = Math.sqrt(2 * Math.PI);
|
|
15183
15274
|
function _normalCdfStd(z) {
|
|
@@ -15425,49 +15516,13 @@ function betaDist(alpha, beta_) {
|
|
|
15425
15516
|
};
|
|
15426
15517
|
}
|
|
15427
15518
|
function _gammaRandom(alpha) {
|
|
15428
|
-
|
|
15429
|
-
return _gammaRandom(alpha + 1) * Math.pow(Math.random(), 1 / alpha);
|
|
15430
|
-
}
|
|
15431
|
-
const d = alpha - 1 / 3;
|
|
15432
|
-
const c = 1 / Math.sqrt(9 * d);
|
|
15433
|
-
while (true) {
|
|
15434
|
-
let x;
|
|
15435
|
-
let v;
|
|
15436
|
-
do {
|
|
15437
|
-
x = _normalRandom();
|
|
15438
|
-
v = 1 + c * x;
|
|
15439
|
-
} while (v <= 0);
|
|
15440
|
-
v = v * v * v;
|
|
15441
|
-
const u = Math.random();
|
|
15442
|
-
if (u < 1 - 0.0331 * (x * x) * (x * x)) return d * v;
|
|
15443
|
-
if (Math.log(u) < 0.5 * x * x + d * (1 - v + Math.log(v))) return d * v;
|
|
15444
|
-
}
|
|
15519
|
+
return gammaSampleRng(alpha, Math.random);
|
|
15445
15520
|
}
|
|
15446
15521
|
function _normalRandom() {
|
|
15447
|
-
|
|
15448
|
-
const u2 = Math.random();
|
|
15449
|
-
return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
|
|
15522
|
+
return normalSampleRng(Math.random);
|
|
15450
15523
|
}
|
|
15451
15524
|
function _gammaRandomRng(alpha, rng) {
|
|
15452
|
-
|
|
15453
|
-
return _gammaRandomRng(alpha + 1, rng) * Math.pow(rng(), 1 / alpha);
|
|
15454
|
-
}
|
|
15455
|
-
const d = alpha - 1 / 3;
|
|
15456
|
-
const c = 1 / Math.sqrt(9 * d);
|
|
15457
|
-
while (true) {
|
|
15458
|
-
let x;
|
|
15459
|
-
let v;
|
|
15460
|
-
do {
|
|
15461
|
-
const u1 = rng();
|
|
15462
|
-
const u2 = rng();
|
|
15463
|
-
x = Math.sqrt(-2 * Math.log(u1 < 1e-300 ? 1e-300 : u1)) * Math.cos(2 * Math.PI * u2);
|
|
15464
|
-
v = 1 + c * x;
|
|
15465
|
-
} while (v <= 0);
|
|
15466
|
-
v = v * v * v;
|
|
15467
|
-
const u = rng();
|
|
15468
|
-
if (u < 1 - 0.0331 * (x * x) * (x * x)) return d * v;
|
|
15469
|
-
if (Math.log(u) < 0.5 * x * x + d * (1 - v + Math.log(v))) return d * v;
|
|
15470
|
-
}
|
|
15525
|
+
return gammaSampleRng(alpha, rng);
|
|
15471
15526
|
}
|
|
15472
15527
|
function binomialDist(n, p) {
|
|
15473
15528
|
if (!Number.isInteger(n) || n < 0)
|
|
@@ -43792,65 +43847,6 @@ function _combineLikeTerms(expr) {
|
|
|
43792
43847
|
if (parts.length === 0) return "0";
|
|
43793
43848
|
return parts.join(" + ").replace(/\+\s*-/g, "- ");
|
|
43794
43849
|
}
|
|
43795
|
-
function _casExpandOne(expr) {
|
|
43796
|
-
let result = expr;
|
|
43797
|
-
result = result.replace(/\(([^()]+)\)\^2/g, "($1)*($1)");
|
|
43798
|
-
const mulPattern = /\(([^()]+)\)\s*\*\s*\(([^()]+)\)/g;
|
|
43799
|
-
let match;
|
|
43800
|
-
let safetyCount = 0;
|
|
43801
|
-
while ((match = mulPattern.exec(result)) !== null && safetyCount++ < 20) {
|
|
43802
|
-
const leftTerms = match[1].split(/\s*\+\s*/);
|
|
43803
|
-
const rightTerms = match[2].split(/\s*\+\s*/);
|
|
43804
|
-
const products = [];
|
|
43805
|
-
for (const l of leftTerms) {
|
|
43806
|
-
for (const rv of rightTerms) {
|
|
43807
|
-
products.push(l.trim() + "*" + rv.trim());
|
|
43808
|
-
}
|
|
43809
|
-
}
|
|
43810
|
-
result = result.slice(0, match.index) + products.join(" + ") + result.slice(match.index + match[0].length);
|
|
43811
|
-
mulPattern.lastIndex = 0;
|
|
43812
|
-
}
|
|
43813
|
-
return result;
|
|
43814
|
-
}
|
|
43815
|
-
function _casFactorOne(expr) {
|
|
43816
|
-
function _gcd2(a, b) {
|
|
43817
|
-
a = Math.abs(a);
|
|
43818
|
-
b = Math.abs(b);
|
|
43819
|
-
while (b !== 0) {
|
|
43820
|
-
const tmp = b;
|
|
43821
|
-
b = a % b;
|
|
43822
|
-
a = tmp;
|
|
43823
|
-
}
|
|
43824
|
-
return a;
|
|
43825
|
-
}
|
|
43826
|
-
const normalized = expr.replace(/\s*-\s*/g, " + -");
|
|
43827
|
-
const terms = normalized.split(/\s*\+\s*/).filter((t) => t.trim() !== "");
|
|
43828
|
-
if (terms.length < 2) return expr;
|
|
43829
|
-
const coeffs = [];
|
|
43830
|
-
const varParts = [];
|
|
43831
|
-
for (const term of terms) {
|
|
43832
|
-
const numMatch = term.match(/^(-?\d+)\s*\*?\s*(.*)$/);
|
|
43833
|
-
if (numMatch) {
|
|
43834
|
-
coeffs.push(parseInt(numMatch[1], 10));
|
|
43835
|
-
varParts.push(numMatch[2] || "1");
|
|
43836
|
-
} else {
|
|
43837
|
-
return expr;
|
|
43838
|
-
}
|
|
43839
|
-
}
|
|
43840
|
-
let g = Math.abs(coeffs[0]);
|
|
43841
|
-
for (let i = 1; i < coeffs.length; i++) {
|
|
43842
|
-
g = _gcd2(g, Math.abs(coeffs[i]));
|
|
43843
|
-
}
|
|
43844
|
-
if (g <= 1) return expr;
|
|
43845
|
-
const inner = coeffs.map((c, i) => {
|
|
43846
|
-
const reduced = c / g;
|
|
43847
|
-
if (varParts[i] === "1") return String(reduced);
|
|
43848
|
-
if (reduced === 1) return varParts[i];
|
|
43849
|
-
if (reduced === -1) return "-" + varParts[i];
|
|
43850
|
-
return reduced + "*" + varParts[i];
|
|
43851
|
-
}).join(" + ");
|
|
43852
|
-
return g + "*(" + inner + ")";
|
|
43853
|
-
}
|
|
43854
43850
|
function _casDerivativeOne(expr, variable) {
|
|
43855
43851
|
const terms = expr.split(/\s*\+\s*/);
|
|
43856
43852
|
const derivedTerms = [];
|
|
@@ -44109,76 +44105,15 @@ function casDerivative(input, variable) {
|
|
|
44109
44105
|
}
|
|
44110
44106
|
function casExpand(input) {
|
|
44111
44107
|
if (!Array.isArray(input)) {
|
|
44112
|
-
return
|
|
44113
|
-
}
|
|
44114
|
-
const strs = input.map(_nodeToStr);
|
|
44115
|
-
if (strs.length < CAS_BATCH_THRESHOLD || !computePool12.isReady()) {
|
|
44116
|
-
return Promise.resolve(strs.map(_casExpandOne));
|
|
44108
|
+
return expand(_nodeToStr(input));
|
|
44117
44109
|
}
|
|
44118
|
-
return
|
|
44119
|
-
let result = exprStr;
|
|
44120
|
-
result = result.replace(/\(([^()]+)\)\^2/g, "($1)*($1)");
|
|
44121
|
-
const mulPattern = /\(([^()]+)\)\s*\*\s*\(([^()]+)\)/g;
|
|
44122
|
-
let match;
|
|
44123
|
-
let safetyCount = 0;
|
|
44124
|
-
while ((match = mulPattern.exec(result)) !== null && safetyCount++ < 20) {
|
|
44125
|
-
const leftTerms = match[1].split(/\s*\+\s*/);
|
|
44126
|
-
const rightTerms = match[2].split(/\s*\+\s*/);
|
|
44127
|
-
const products = [];
|
|
44128
|
-
for (const l of leftTerms) {
|
|
44129
|
-
for (const rv of rightTerms) {
|
|
44130
|
-
products.push(l.trim() + "*" + rv.trim());
|
|
44131
|
-
}
|
|
44132
|
-
}
|
|
44133
|
-
result = result.slice(0, match.index) + products.join(" + ") + result.slice(match.index + match[0].length);
|
|
44134
|
-
mulPattern.lastIndex = 0;
|
|
44135
|
-
}
|
|
44136
|
-
return result;
|
|
44137
|
-
}).then((r) => r.result);
|
|
44110
|
+
return Promise.resolve(input.map((e) => expand(_nodeToStr(e))));
|
|
44138
44111
|
}
|
|
44139
44112
|
function casFactor(input) {
|
|
44140
44113
|
if (!Array.isArray(input)) {
|
|
44141
|
-
return
|
|
44114
|
+
return factor(_nodeToStr(input));
|
|
44142
44115
|
}
|
|
44143
|
-
|
|
44144
|
-
if (strs.length < CAS_BATCH_THRESHOLD || !computePool12.isReady()) {
|
|
44145
|
-
return Promise.resolve(strs.map(_casFactorOne));
|
|
44146
|
-
}
|
|
44147
|
-
return computePool12.map(strs, (exprStr) => {
|
|
44148
|
-
function _gcdW(a, b) {
|
|
44149
|
-
a = Math.abs(a);
|
|
44150
|
-
b = Math.abs(b);
|
|
44151
|
-
while (b !== 0) {
|
|
44152
|
-
const tmp = b;
|
|
44153
|
-
b = a % b;
|
|
44154
|
-
a = tmp;
|
|
44155
|
-
}
|
|
44156
|
-
return a;
|
|
44157
|
-
}
|
|
44158
|
-
const normalized = exprStr.replace(/\s*-\s*/g, " + -");
|
|
44159
|
-
const terms = normalized.split(/\s*\+\s*/).filter((t) => t.trim() !== "");
|
|
44160
|
-
if (terms.length < 2) return exprStr;
|
|
44161
|
-
const coeffs = [];
|
|
44162
|
-
const varParts = [];
|
|
44163
|
-
for (const term of terms) {
|
|
44164
|
-
const numMatch = term.match(/^(-?\d+)\s*\*?\s*(.*)$/);
|
|
44165
|
-
if (numMatch) {
|
|
44166
|
-
coeffs.push(parseInt(numMatch[1], 10));
|
|
44167
|
-
varParts.push(numMatch[2] || "1");
|
|
44168
|
-
} else return exprStr;
|
|
44169
|
-
}
|
|
44170
|
-
let g = Math.abs(coeffs[0]);
|
|
44171
|
-
for (let i = 1; i < coeffs.length; i++) g = _gcdW(g, Math.abs(coeffs[i]));
|
|
44172
|
-
if (g <= 1) return exprStr;
|
|
44173
|
-
const inner = coeffs.map((c, i) => {
|
|
44174
|
-
const reduced = c / g;
|
|
44175
|
-
if (varParts[i] === "1") return String(reduced);
|
|
44176
|
-
if (reduced === 1) return varParts[i];
|
|
44177
|
-
if (reduced === -1) return "-" + varParts[i];
|
|
44178
|
-
return reduced + "*" + varParts[i];
|
|
44179
|
-
}).join(" + ");
|
|
44180
|
-
return g + "*(" + inner + ")";
|
|
44181
|
-
}).then((r) => r.result);
|
|
44116
|
+
return Promise.resolve(input.map((e) => factor(_nodeToStr(e))));
|
|
44182
44117
|
}
|
|
44183
44118
|
|
|
44184
44119
|
// src/config-api.ts
|
|
@@ -48334,7 +48269,9 @@ function isConst(n, x) {
|
|
|
48334
48269
|
const node = unwrap(n);
|
|
48335
48270
|
if (node.type === "SymbolNode") return node.name !== x;
|
|
48336
48271
|
if (node.type === "ConstantNode") return true;
|
|
48337
|
-
return [...node.args ?? [], ...node.content ? [node.content] : []].every(
|
|
48272
|
+
return [...node.args ?? [], ...node.content ? [node.content] : []].every(
|
|
48273
|
+
(a) => isConst(a, x)
|
|
48274
|
+
);
|
|
48338
48275
|
}
|
|
48339
48276
|
function num(v) {
|
|
48340
48277
|
return Number.isInteger(v) ? String(v) : String(Number(v.toPrecision(15)));
|
|
@@ -48430,12 +48367,126 @@ function integrateNode(raw, x) {
|
|
|
48430
48367
|
throw new NotIntegrable(node.type);
|
|
48431
48368
|
}
|
|
48432
48369
|
}
|
|
48370
|
+
var stripWs = (s) => s.replace(/\s+/g, "");
|
|
48371
|
+
function tryPartialFractions(expr, x) {
|
|
48372
|
+
const vars = variables(expr);
|
|
48373
|
+
if (vars.length !== 1 || vars[0] !== x) return null;
|
|
48374
|
+
let decomposed;
|
|
48375
|
+
try {
|
|
48376
|
+
decomposed = apart(expr);
|
|
48377
|
+
} catch {
|
|
48378
|
+
return null;
|
|
48379
|
+
}
|
|
48380
|
+
if (stripWs(decomposed) === stripWs(expr)) return null;
|
|
48381
|
+
try {
|
|
48382
|
+
return integrateNode(parse2(decomposed), x);
|
|
48383
|
+
} catch {
|
|
48384
|
+
return null;
|
|
48385
|
+
}
|
|
48386
|
+
}
|
|
48387
|
+
function flattenMul(raw) {
|
|
48388
|
+
const n = unwrap(raw);
|
|
48389
|
+
if (n.type === "OperatorNode" && n.op === "*") {
|
|
48390
|
+
return (n.args ?? []).flatMap(flattenMul);
|
|
48391
|
+
}
|
|
48392
|
+
return [n];
|
|
48393
|
+
}
|
|
48394
|
+
function polyDenseFromStr(s, x) {
|
|
48395
|
+
const poly = polyFromExpression(s, [x]);
|
|
48396
|
+
let maxPow = 0;
|
|
48397
|
+
for (const t of poly) maxPow = Math.max(maxPow, t.powers[0] ?? 0);
|
|
48398
|
+
const dense = new Array(maxPow + 1).fill(0);
|
|
48399
|
+
for (const t of poly) dense[t.powers[0]] += t.coeff;
|
|
48400
|
+
return dense;
|
|
48401
|
+
}
|
|
48402
|
+
function derivDense(c) {
|
|
48403
|
+
if (c.length <= 1) return [0];
|
|
48404
|
+
return c.slice(1).map((v, i) => v * (i + 1));
|
|
48405
|
+
}
|
|
48406
|
+
function densePolyToStr(coeffs, x) {
|
|
48407
|
+
const parts = [];
|
|
48408
|
+
for (let i = coeffs.length - 1; i >= 0; i--) {
|
|
48409
|
+
const c = coeffs[i];
|
|
48410
|
+
if (Math.abs(c) < 1e-12) continue;
|
|
48411
|
+
if (i === 0) parts.push(num(c));
|
|
48412
|
+
else {
|
|
48413
|
+
const v = i === 1 ? x : `${x}^${i}`;
|
|
48414
|
+
if (Math.abs(c - 1) < 1e-12) parts.push(v);
|
|
48415
|
+
else if (Math.abs(c + 1) < 1e-12) parts.push(`-${v}`);
|
|
48416
|
+
else parts.push(`${num(c)}*${v}`);
|
|
48417
|
+
}
|
|
48418
|
+
}
|
|
48419
|
+
if (parts.length === 0) return "0";
|
|
48420
|
+
return parts.join(" + ").replace(/\+ -/g, "- ");
|
|
48421
|
+
}
|
|
48422
|
+
var isZeroDense = (c) => c.every((v) => Math.abs(v) < 1e-12);
|
|
48423
|
+
function repeatedAntideriv(fn, u, m) {
|
|
48424
|
+
if (fn === "exp") return { str: `exp(${u})`, sign: 1 };
|
|
48425
|
+
const rem = ((m - 1) % 4 + 4) % 4;
|
|
48426
|
+
if (fn === "sin") {
|
|
48427
|
+
return [
|
|
48428
|
+
{ str: `cos(${u})`, sign: -1 },
|
|
48429
|
+
{ str: `sin(${u})`, sign: -1 },
|
|
48430
|
+
{ str: `cos(${u})`, sign: 1 },
|
|
48431
|
+
{ str: `sin(${u})`, sign: 1 }
|
|
48432
|
+
][rem];
|
|
48433
|
+
}
|
|
48434
|
+
return [
|
|
48435
|
+
{ str: `sin(${u})`, sign: 1 },
|
|
48436
|
+
{ str: `cos(${u})`, sign: -1 },
|
|
48437
|
+
{ str: `sin(${u})`, sign: -1 },
|
|
48438
|
+
{ str: `cos(${u})`, sign: 1 }
|
|
48439
|
+
][rem];
|
|
48440
|
+
}
|
|
48441
|
+
function tryByParts(expr, x) {
|
|
48442
|
+
let root2;
|
|
48443
|
+
try {
|
|
48444
|
+
root2 = unwrap(parse2(expr));
|
|
48445
|
+
} catch {
|
|
48446
|
+
return null;
|
|
48447
|
+
}
|
|
48448
|
+
if (root2.type !== "OperatorNode" || root2.op !== "*") return null;
|
|
48449
|
+
const factors = flattenMul(root2);
|
|
48450
|
+
const gFactors = factors.filter((f) => f.type === "FunctionNode");
|
|
48451
|
+
if (gFactors.length !== 1) return null;
|
|
48452
|
+
const g = gFactors[0];
|
|
48453
|
+
const fn = g.fn?.name ?? g.name ?? "";
|
|
48454
|
+
if (fn !== "exp" && fn !== "sin" && fn !== "cos") return null;
|
|
48455
|
+
const arg3 = (g.args ?? [])[0];
|
|
48456
|
+
if (!arg3) return null;
|
|
48457
|
+
const u = arg3.toString();
|
|
48458
|
+
const a = linearSlope(u, x);
|
|
48459
|
+
if (a === null) return null;
|
|
48460
|
+
const rest = factors.filter((f) => f !== g);
|
|
48461
|
+
const pStr = rest.length ? rest.map((f) => `(${f.toString()})`).join("*") : "1";
|
|
48462
|
+
let pk;
|
|
48463
|
+
try {
|
|
48464
|
+
pk = polyDenseFromStr(pStr, x);
|
|
48465
|
+
} catch {
|
|
48466
|
+
return null;
|
|
48467
|
+
}
|
|
48468
|
+
const terms = [];
|
|
48469
|
+
for (let k = 0; !isZeroDense(pk); k++) {
|
|
48470
|
+
const m = k + 1;
|
|
48471
|
+
const { str: gStr, sign: sign3 } = repeatedAntideriv(fn, u, m);
|
|
48472
|
+
const coeff = (k % 2 === 0 ? 1 : -1) * sign3 * Math.pow(1 / a, m);
|
|
48473
|
+
const polyStr = densePolyToStr(pk, x);
|
|
48474
|
+
if (polyStr !== "0") {
|
|
48475
|
+
const polyFactor = polyStr === "1" ? "" : `(${polyStr}) * `;
|
|
48476
|
+
terms.push(`${num(coeff)} * ${polyFactor}${gStr}`);
|
|
48477
|
+
}
|
|
48478
|
+
pk = derivDense(pk);
|
|
48479
|
+
if (k > 64) break;
|
|
48480
|
+
}
|
|
48481
|
+
if (terms.length === 0) return null;
|
|
48482
|
+
return terms.join(" + ").replace(/\+ -/g, "- ");
|
|
48483
|
+
}
|
|
48433
48484
|
function symbolicIntegral(expr, variable = "x") {
|
|
48434
48485
|
try {
|
|
48435
48486
|
return integrateNode(parse2(expr), variable);
|
|
48436
48487
|
} catch (e) {
|
|
48437
|
-
if (e instanceof NotIntegrable)
|
|
48438
|
-
|
|
48488
|
+
if (!(e instanceof NotIntegrable)) throw e;
|
|
48489
|
+
return tryPartialFractions(expr, variable) ?? tryByParts(expr, variable) ?? `integral(${expr}, ${variable})`;
|
|
48439
48490
|
}
|
|
48440
48491
|
}
|
|
48441
48492
|
|
|
@@ -52034,6 +52085,261 @@ function tTestPower(effectSize, nobsOrPower, alpha, opts = {}) {
|
|
|
52034
52085
|
if (!(nobs > 1)) throw new Error("tTestPower: nobs must be greater than 1");
|
|
52035
52086
|
return powerAt(effectSize, nobs, alpha, alt);
|
|
52036
52087
|
}
|
|
52088
|
+
|
|
52089
|
+
// src/stats/gaussian-process.ts
|
|
52090
|
+
var SQRT3 = Math.sqrt(3);
|
|
52091
|
+
var SQRT5 = Math.sqrt(5);
|
|
52092
|
+
function euclidean2(a, b) {
|
|
52093
|
+
let s = 0;
|
|
52094
|
+
for (let i = 0; i < a.length; i++) {
|
|
52095
|
+
const d = a[i] - b[i];
|
|
52096
|
+
s += d * d;
|
|
52097
|
+
}
|
|
52098
|
+
return Math.sqrt(s);
|
|
52099
|
+
}
|
|
52100
|
+
function makeKernel(kernel, ell, sf2) {
|
|
52101
|
+
switch (kernel) {
|
|
52102
|
+
case "rbf":
|
|
52103
|
+
return (a, b) => {
|
|
52104
|
+
const r = euclidean2(a, b);
|
|
52105
|
+
return sf2 * Math.exp(-(r * r) / (2 * ell * ell));
|
|
52106
|
+
};
|
|
52107
|
+
case "matern32":
|
|
52108
|
+
return (a, b) => {
|
|
52109
|
+
const u = SQRT3 * euclidean2(a, b) / ell;
|
|
52110
|
+
return sf2 * (1 + u) * Math.exp(-u);
|
|
52111
|
+
};
|
|
52112
|
+
case "matern52":
|
|
52113
|
+
return (a, b) => {
|
|
52114
|
+
const r = euclidean2(a, b);
|
|
52115
|
+
const u = SQRT5 * r / ell;
|
|
52116
|
+
return sf2 * (1 + u + 5 * r * r / (3 * ell * ell)) * Math.exp(-u);
|
|
52117
|
+
};
|
|
52118
|
+
default:
|
|
52119
|
+
throw new Error(`gaussianProcessRegression: unknown kernel '${String(kernel)}'`);
|
|
52120
|
+
}
|
|
52121
|
+
}
|
|
52122
|
+
function forwardSolve(L, b) {
|
|
52123
|
+
const n = b.length;
|
|
52124
|
+
const x = new Array(n);
|
|
52125
|
+
for (let i = 0; i < n; i++) {
|
|
52126
|
+
let s = b[i];
|
|
52127
|
+
for (let j = 0; j < i; j++) s -= L[i][j] * x[j];
|
|
52128
|
+
x[i] = s / L[i][i];
|
|
52129
|
+
}
|
|
52130
|
+
return x;
|
|
52131
|
+
}
|
|
52132
|
+
function backSolveTranspose(L, b) {
|
|
52133
|
+
const n = b.length;
|
|
52134
|
+
const x = new Array(n);
|
|
52135
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
52136
|
+
let s = b[i];
|
|
52137
|
+
for (let j = i + 1; j < n; j++) s -= L[j][i] * x[j];
|
|
52138
|
+
x[i] = s / L[i][i];
|
|
52139
|
+
}
|
|
52140
|
+
return x;
|
|
52141
|
+
}
|
|
52142
|
+
function normalizeTrainingInputs(X, y) {
|
|
52143
|
+
if (!Array.isArray(X) || X.length === 0) {
|
|
52144
|
+
throw new Error("gaussianProcessRegression: X must be a non-empty array of feature vectors");
|
|
52145
|
+
}
|
|
52146
|
+
if (y.length !== X.length) {
|
|
52147
|
+
throw new Error(
|
|
52148
|
+
`gaussianProcessRegression: y length ${y.length} must match number of rows ${X.length}`
|
|
52149
|
+
);
|
|
52150
|
+
}
|
|
52151
|
+
const dim = X[0].length;
|
|
52152
|
+
if (dim === 0) throw new Error("gaussianProcessRegression: feature vectors must be non-empty");
|
|
52153
|
+
const Xa = X.map((row2) => {
|
|
52154
|
+
if (row2.length !== dim) {
|
|
52155
|
+
throw new Error("gaussianProcessRegression: all feature vectors must have the same length");
|
|
52156
|
+
}
|
|
52157
|
+
return [...row2];
|
|
52158
|
+
});
|
|
52159
|
+
return { Xa, ya: [...y], dim };
|
|
52160
|
+
}
|
|
52161
|
+
function gaussianProcessRegression(X, y, options = {}) {
|
|
52162
|
+
const kernel = options.kernel ?? "rbf";
|
|
52163
|
+
const ell = options.lengthScale ?? 1;
|
|
52164
|
+
const sf2 = options.signalVariance ?? 1;
|
|
52165
|
+
const noise = options.noise ?? 1e-10;
|
|
52166
|
+
if (!(ell > 0)) throw new Error("gaussianProcessRegression: lengthScale must be positive");
|
|
52167
|
+
if (!(sf2 > 0)) throw new Error("gaussianProcessRegression: signalVariance must be positive");
|
|
52168
|
+
if (!(noise >= 0)) throw new Error("gaussianProcessRegression: noise must be non-negative");
|
|
52169
|
+
const { Xa, ya } = normalizeTrainingInputs(X, y);
|
|
52170
|
+
const n = Xa.length;
|
|
52171
|
+
const k = makeKernel(kernel, ell, sf2);
|
|
52172
|
+
const K = Array.from({ length: n }, () => new Array(n).fill(0));
|
|
52173
|
+
for (let i = 0; i < n; i++) {
|
|
52174
|
+
for (let j = i; j < n; j++) {
|
|
52175
|
+
const kij = k(Xa[i], Xa[j]);
|
|
52176
|
+
K[i][j] = kij;
|
|
52177
|
+
K[j][i] = kij;
|
|
52178
|
+
}
|
|
52179
|
+
K[i][i] += noise;
|
|
52180
|
+
}
|
|
52181
|
+
const { L } = cholesky(K);
|
|
52182
|
+
const Linvy = forwardSolve(L, ya);
|
|
52183
|
+
const alphaBar = backSolveTranspose(L, Linvy);
|
|
52184
|
+
let logDetHalf = 0;
|
|
52185
|
+
for (let i = 0; i < n; i++) logDetHalf += Math.log(L[i][i]);
|
|
52186
|
+
let yTa = 0;
|
|
52187
|
+
for (let i = 0; i < n; i++) yTa += ya[i] * alphaBar[i];
|
|
52188
|
+
const logMarginalLikelihood = -0.5 * yTa - logDetHalf - n / 2 * Math.log(2 * Math.PI);
|
|
52189
|
+
return {
|
|
52190
|
+
kernel,
|
|
52191
|
+
logMarginalLikelihood,
|
|
52192
|
+
predict(Xstar) {
|
|
52193
|
+
const m = Xstar.length;
|
|
52194
|
+
const mean7 = new Array(m);
|
|
52195
|
+
const variance2 = new Array(m);
|
|
52196
|
+
const std2 = new Array(m);
|
|
52197
|
+
for (let t = 0; t < m; t++) {
|
|
52198
|
+
const xt = Xstar[t];
|
|
52199
|
+
if (xt.length !== Xa[0].length) {
|
|
52200
|
+
throw new Error("gaussianProcessRegression.predict: test point dimensionality mismatch");
|
|
52201
|
+
}
|
|
52202
|
+
const ks = new Array(n);
|
|
52203
|
+
for (let i = 0; i < n; i++) ks[i] = k(Xa[i], xt);
|
|
52204
|
+
let mu = 0;
|
|
52205
|
+
for (let i = 0; i < n; i++) mu += ks[i] * alphaBar[i];
|
|
52206
|
+
const v = forwardSolve(L, ks);
|
|
52207
|
+
let vtv = 0;
|
|
52208
|
+
for (let i = 0; i < n; i++) vtv += v[i] * v[i];
|
|
52209
|
+
const kss = k(xt, xt);
|
|
52210
|
+
const varT = Math.max(kss - vtv, 0);
|
|
52211
|
+
mean7[t] = mu;
|
|
52212
|
+
variance2[t] = varT;
|
|
52213
|
+
std2[t] = Math.sqrt(varT);
|
|
52214
|
+
}
|
|
52215
|
+
return { mean: mean7, variance: variance2, std: std2 };
|
|
52216
|
+
}
|
|
52217
|
+
};
|
|
52218
|
+
}
|
|
52219
|
+
var gpRegression = gaussianProcessRegression;
|
|
52220
|
+
|
|
52221
|
+
// src/stats/multivariate-sampling.ts
|
|
52222
|
+
function validateAlpha(alpha, fn) {
|
|
52223
|
+
if (!Array.isArray(alpha) || alpha.length < 2) {
|
|
52224
|
+
throw new Error(`${fn}: alpha must be an array of at least 2 concentration parameters`);
|
|
52225
|
+
}
|
|
52226
|
+
for (const a of alpha) {
|
|
52227
|
+
if (!(a > 0) || !Number.isFinite(a)) {
|
|
52228
|
+
throw new Error(`${fn}: all concentration parameters must be positive and finite`);
|
|
52229
|
+
}
|
|
52230
|
+
}
|
|
52231
|
+
}
|
|
52232
|
+
function dirichletSample(alpha, n = 1, opts) {
|
|
52233
|
+
validateAlpha(alpha, "dirichletSample");
|
|
52234
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
52235
|
+
throw new Error("dirichletSample: n must be a positive integer");
|
|
52236
|
+
}
|
|
52237
|
+
const k = alpha.length;
|
|
52238
|
+
const rng = createRng(opts?.seed ?? null);
|
|
52239
|
+
const samples = new Array(n);
|
|
52240
|
+
for (let s = 0; s < n; s++) {
|
|
52241
|
+
const g = new Array(k);
|
|
52242
|
+
let total = 0;
|
|
52243
|
+
for (let i = 0; i < k; i++) {
|
|
52244
|
+
const gi = gammaSampleRng(alpha[i], rng);
|
|
52245
|
+
g[i] = gi;
|
|
52246
|
+
total += gi;
|
|
52247
|
+
}
|
|
52248
|
+
const row2 = new Array(k);
|
|
52249
|
+
for (let i = 0; i < k; i++) row2[i] = g[i] / total;
|
|
52250
|
+
samples[s] = row2;
|
|
52251
|
+
}
|
|
52252
|
+
return samples;
|
|
52253
|
+
}
|
|
52254
|
+
function dirichletPdf(x, alpha) {
|
|
52255
|
+
validateAlpha(alpha, "dirichletPdf");
|
|
52256
|
+
if (x.length !== alpha.length) {
|
|
52257
|
+
throw new Error(`dirichletPdf: x length ${x.length} must match alpha length ${alpha.length}`);
|
|
52258
|
+
}
|
|
52259
|
+
let sum3 = 0;
|
|
52260
|
+
for (const xi of x) {
|
|
52261
|
+
if (!(xi >= 0) || !(xi <= 1)) {
|
|
52262
|
+
throw new Error("dirichletPdf: x must lie on the simplex (each component in [0, 1])");
|
|
52263
|
+
}
|
|
52264
|
+
sum3 += xi;
|
|
52265
|
+
}
|
|
52266
|
+
if (Math.abs(sum3 - 1) > 1e-8) {
|
|
52267
|
+
throw new Error("dirichletPdf: x components must sum to 1");
|
|
52268
|
+
}
|
|
52269
|
+
let a0 = 0;
|
|
52270
|
+
let logB = 0;
|
|
52271
|
+
for (const a of alpha) {
|
|
52272
|
+
logB += lgammaNumber(a);
|
|
52273
|
+
a0 += a;
|
|
52274
|
+
}
|
|
52275
|
+
logB -= lgammaNumber(a0);
|
|
52276
|
+
let logpdf = -logB;
|
|
52277
|
+
for (let i = 0; i < x.length; i++) {
|
|
52278
|
+
const xi = x[i];
|
|
52279
|
+
const p = alpha[i] - 1;
|
|
52280
|
+
if (p !== 0) {
|
|
52281
|
+
logpdf += p * Math.log(xi);
|
|
52282
|
+
}
|
|
52283
|
+
}
|
|
52284
|
+
return Math.exp(logpdf);
|
|
52285
|
+
}
|
|
52286
|
+
function validateScale(scale4, fn) {
|
|
52287
|
+
if (!Array.isArray(scale4) || scale4.length === 0) {
|
|
52288
|
+
throw new Error(`${fn}: scale must be a non-empty square matrix`);
|
|
52289
|
+
}
|
|
52290
|
+
const p = scale4.length;
|
|
52291
|
+
for (const row2 of scale4) {
|
|
52292
|
+
if (row2.length !== p) throw new Error(`${fn}: scale must be a ${p}x${p} square matrix`);
|
|
52293
|
+
}
|
|
52294
|
+
for (let i = 0; i < p; i++) {
|
|
52295
|
+
for (let j = i + 1; j < p; j++) {
|
|
52296
|
+
const tol = 1e-9 * (1 + Math.abs(scale4[i][j]));
|
|
52297
|
+
if (Math.abs(scale4[i][j] - scale4[j][i]) > tol) {
|
|
52298
|
+
throw new Error(`${fn}: scale must be symmetric`);
|
|
52299
|
+
}
|
|
52300
|
+
}
|
|
52301
|
+
}
|
|
52302
|
+
return p;
|
|
52303
|
+
}
|
|
52304
|
+
function wishartSample(df, scale4, n = 1, opts) {
|
|
52305
|
+
const p = validateScale(scale4, "wishartSample");
|
|
52306
|
+
if (!(df > p - 1)) {
|
|
52307
|
+
throw new Error(`wishartSample: df must be greater than p\u22121 = ${p - 1}`);
|
|
52308
|
+
}
|
|
52309
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
52310
|
+
throw new Error("wishartSample: n must be a positive integer");
|
|
52311
|
+
}
|
|
52312
|
+
const { L } = cholesky(scale4.map((row2) => [...row2]));
|
|
52313
|
+
const rng = createRng(opts?.seed ?? null);
|
|
52314
|
+
const samples = new Array(n);
|
|
52315
|
+
for (let s = 0; s < n; s++) {
|
|
52316
|
+
const A = Array.from({ length: p }, () => new Array(p).fill(0));
|
|
52317
|
+
for (let i = 0; i < p; i++) {
|
|
52318
|
+
A[i][i] = Math.sqrt(2 * gammaSampleRng((df - i) / 2, rng));
|
|
52319
|
+
for (let j = 0; j < i; j++) A[i][j] = normalSampleRng(rng);
|
|
52320
|
+
}
|
|
52321
|
+
const M = Array.from({ length: p }, () => new Array(p).fill(0));
|
|
52322
|
+
for (let i = 0; i < p; i++) {
|
|
52323
|
+
for (let j = 0; j <= i; j++) {
|
|
52324
|
+
let sum3 = 0;
|
|
52325
|
+
for (let m = j; m <= i; m++) sum3 += L[i][m] * A[m][j];
|
|
52326
|
+
M[i][j] = sum3;
|
|
52327
|
+
}
|
|
52328
|
+
}
|
|
52329
|
+
const W = Array.from({ length: p }, () => new Array(p).fill(0));
|
|
52330
|
+
for (let i = 0; i < p; i++) {
|
|
52331
|
+
for (let j = i; j < p; j++) {
|
|
52332
|
+
let sum3 = 0;
|
|
52333
|
+
const lim = Math.min(i, j);
|
|
52334
|
+
for (let m = 0; m <= lim; m++) sum3 += M[i][m] * M[j][m];
|
|
52335
|
+
W[i][j] = sum3;
|
|
52336
|
+
W[j][i] = sum3;
|
|
52337
|
+
}
|
|
52338
|
+
}
|
|
52339
|
+
samples[s] = W;
|
|
52340
|
+
}
|
|
52341
|
+
return samples;
|
|
52342
|
+
}
|
|
52037
52343
|
export {
|
|
52038
52344
|
ARRAY_WORKER_THRESHOLD,
|
|
52039
52345
|
CAS_BATCH_THRESHOLD,
|
|
@@ -52268,6 +52574,8 @@ export {
|
|
|
52268
52574
|
differences,
|
|
52269
52575
|
digamma,
|
|
52270
52576
|
directionalDerivative,
|
|
52577
|
+
dirichletPdf,
|
|
52578
|
+
dirichletSample,
|
|
52271
52579
|
disableGpu,
|
|
52272
52580
|
discreteLog,
|
|
52273
52581
|
discreteUniformDist,
|
|
@@ -52457,6 +52765,7 @@ export {
|
|
|
52457
52765
|
gasConstant,
|
|
52458
52766
|
gaussQuad,
|
|
52459
52767
|
gaussianKDE,
|
|
52768
|
+
gaussianProcessRegression,
|
|
52460
52769
|
gcd,
|
|
52461
52770
|
gegenbauerC,
|
|
52462
52771
|
generalizedEig,
|
|
@@ -52469,6 +52778,7 @@ export {
|
|
|
52469
52778
|
gmean,
|
|
52470
52779
|
gmres,
|
|
52471
52780
|
goertzel,
|
|
52781
|
+
gpRegression,
|
|
52472
52782
|
gpuAdd,
|
|
52473
52783
|
gpuMatmul,
|
|
52474
52784
|
gpuScale,
|
|
@@ -53066,6 +53376,7 @@ export {
|
|
|
53066
53376
|
wiener,
|
|
53067
53377
|
wilcoxon,
|
|
53068
53378
|
windowFunction,
|
|
53379
|
+
wishartSample,
|
|
53069
53380
|
xgcd,
|
|
53070
53381
|
xor,
|
|
53071
53382
|
zTransform,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared RNG-driven Gamma / standard-normal variate generators.
|
|
3
|
+
*
|
|
4
|
+
* Extracted so the distribution objects (`typed/dist-objects.ts`) and the
|
|
5
|
+
* multivariate samplers (`stats/multivariate-sampling.ts`) share ONE
|
|
6
|
+
* Marsaglia & Tsang gamma implementation rather than each carrying a copy.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Standard normal N(0,1) variate via Box-Muller, driven by a caller-supplied
|
|
10
|
+
* uniform PRNG (so seeded draws are reproducible). Guards `log(0)`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalSampleRng(rng: () => number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Gamma(alpha, 1) variate (shape `alpha`, unit scale) via Marsaglia & Tsang's
|
|
15
|
+
* method, driven by a caller-supplied uniform PRNG. For `alpha < 1` it uses the
|
|
16
|
+
* boosting identity `Gamma(a) = Gamma(a+1)·U^(1/a)`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function gammaSampleRng(alpha: number, rng: () => number): number;
|
|
19
|
+
//# sourceMappingURL=gammaSample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gammaSample.d.ts","sourceRoot":"","sources":["../../../src/probability/util/gammaSample.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,MAAM,GAAG,MAAM,CAIzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,MAAM,GAAG,MAAM,CAkBvE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Supported covariance kernels. */
|
|
2
|
+
export type GPKernel = 'rbf' | 'matern32' | 'matern52';
|
|
3
|
+
/** Options for {@link gaussianProcessRegression}. */
|
|
4
|
+
export interface GPOptions {
|
|
5
|
+
/** Covariance kernel. Default `'rbf'` (squared-exponential). */
|
|
6
|
+
kernel?: GPKernel;
|
|
7
|
+
/** Kernel length-scale ℓ (> 0). Default `1`. */
|
|
8
|
+
lengthScale?: number;
|
|
9
|
+
/** Signal variance σ_f² (kernel amplitude, > 0). Default `1`. */
|
|
10
|
+
signalVariance?: number;
|
|
11
|
+
/** I.i.d. Gaussian noise variance α added to the diagonal (≥ 0). Default `1e-10`. */
|
|
12
|
+
noise?: number;
|
|
13
|
+
}
|
|
14
|
+
/** Posterior prediction at a set of test points. */
|
|
15
|
+
export interface GPPrediction {
|
|
16
|
+
/** Posterior mean at each test point. */
|
|
17
|
+
mean: number[];
|
|
18
|
+
/** Posterior variance at each test point (≥ 0). */
|
|
19
|
+
variance: number[];
|
|
20
|
+
/** Posterior standard deviation at each test point (= √variance). */
|
|
21
|
+
std: number[];
|
|
22
|
+
}
|
|
23
|
+
/** A fitted Gaussian-process regressor. */
|
|
24
|
+
export interface GPModel {
|
|
25
|
+
/** Predict the posterior mean/variance/std at the given test points. */
|
|
26
|
+
predict(Xstar: readonly (readonly number[])[]): GPPrediction;
|
|
27
|
+
/** Log marginal likelihood log p(y | X) of the training data under the prior. */
|
|
28
|
+
logMarginalLikelihood: number;
|
|
29
|
+
/** The resolved kernel name. */
|
|
30
|
+
kernel: GPKernel;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Fit a Gaussian-process regressor to training points `X` (array of
|
|
34
|
+
* length-d feature vectors) and targets `y`, then return a model exposing
|
|
35
|
+
* `.predict(Xstar)` (posterior mean/variance/std) and the log marginal
|
|
36
|
+
* likelihood.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const gp = gaussianProcessRegression(
|
|
40
|
+
* [[-4], [-3], [-1], [0], [2]],
|
|
41
|
+
* [-2, 0, 1, 2, -1],
|
|
42
|
+
* { kernel: 'rbf', lengthScale: 1.2, signalVariance: 1.5, noise: 1e-2 }
|
|
43
|
+
* );
|
|
44
|
+
* gp.predict([[-0.5], [10]]); // mean ≈ [1.5872, ~0], std ≈ [0.1453, 1.2247]
|
|
45
|
+
*/
|
|
46
|
+
export declare function gaussianProcessRegression(X: readonly (readonly number[])[], y: readonly number[], options?: GPOptions): GPModel;
|
|
47
|
+
/** Alias of {@link gaussianProcessRegression}. */
|
|
48
|
+
export declare const gpRegression: typeof gaussianProcessRegression;
|
|
49
|
+
//# sourceMappingURL=gaussian-process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gaussian-process.d.ts","sourceRoot":"","sources":["../../src/stats/gaussian-process.ts"],"names":[],"mappings":"AAuBA,oCAAoC;AACpC,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvD,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,gEAAgE;IAChE,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,mDAAmD;IACnD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,2CAA2C;AAC3C,MAAM,WAAW,OAAO;IACtB,wEAAwE;IACxE,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC;IAC7D,iFAAiF;IACjF,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gCAAgC;IAChC,MAAM,EAAE,QAAQ,CAAC;CAClB;AA0FD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,EACjC,CAAC,EAAE,SAAS,MAAM,EAAE,EACpB,OAAO,GAAE,SAAc,GACtB,OAAO,CAoET;AAED,kDAAkD;AAClD,eAAO,MAAM,YAAY,kCAA4B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Options for the multivariate samplers (shared shape with mvnSample). */
|
|
2
|
+
export interface SampleSeedOptions {
|
|
3
|
+
/** Seed for the deterministic RNG (reproducible draws). Omit for a
|
|
4
|
+
* time-seeded, non-reproducible generator. */
|
|
5
|
+
seed?: string | number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Draw `n` samples from a Dirichlet(`alpha`) distribution via the
|
|
9
|
+
* Gamma-normalization method. Each sample is a length-k vector on the simplex
|
|
10
|
+
* (non-negative, summing to 1). Returns an `n`-length array of length-k vectors.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* dirichletSample([2, 3, 5], 10000, { seed: 42 });
|
|
14
|
+
* // empirical mean ≈ [0.2, 0.3, 0.5] = αᵢ / Σα
|
|
15
|
+
*/
|
|
16
|
+
export declare function dirichletSample(alpha: readonly number[], n?: number, opts?: SampleSeedOptions): number[][];
|
|
17
|
+
/**
|
|
18
|
+
* Dirichlet(`alpha`) probability density at a point `x` on the simplex.
|
|
19
|
+
* `pdf(x) = (1 / B(α)) · Πᵢ xᵢ^(αᵢ−1)` with
|
|
20
|
+
* `B(α) = Πᵢ Γ(αᵢ) / Γ(Σαᵢ)`. Matches `scipy.stats.dirichlet.pdf`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* dirichletPdf([0.2, 0.3, 0.5], [2, 3, 4]); // 7.56
|
|
24
|
+
*/
|
|
25
|
+
export declare function dirichletPdf(x: readonly number[], alpha: readonly number[]): number;
|
|
26
|
+
/**
|
|
27
|
+
* Draw `n` samples from a Wishart(`df`, `scale`) distribution via the Bartlett
|
|
28
|
+
* decomposition: with `L = chol(scale)` and a lower-triangular `A` whose
|
|
29
|
+
* diagonal entries are `√χ²(df−i)` (0-indexed) and whose strictly-lower entries
|
|
30
|
+
* are N(0,1), each sample is `W = (L·A)(L·A)ᵀ` — a `p×p` symmetric
|
|
31
|
+
* positive-definite matrix. Returns an `n`-length array of `p×p` matrices.
|
|
32
|
+
*
|
|
33
|
+
* `df` must exceed `p − 1` (so every χ² degree-of-freedom is positive). The
|
|
34
|
+
* mean of the distribution is `df · scale`.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* wishartSample(6, [[2, 0.5], [0.5, 1]], 10000, { seed: 7 });
|
|
38
|
+
* // empirical mean ≈ [[12, 3], [3, 6]] = df · scale
|
|
39
|
+
*/
|
|
40
|
+
export declare function wishartSample(df: number, scale: readonly (readonly number[])[], n?: number, opts?: SampleSeedOptions): number[][][];
|
|
41
|
+
//# sourceMappingURL=multivariate-sampling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multivariate-sampling.d.ts","sourceRoot":"","sources":["../../src/stats/multivariate-sampling.ts"],"names":[],"mappings":"AAuBA,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC;kDAC8C;IAC9C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAaD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,CAAC,SAAI,EACL,IAAI,CAAC,EAAE,iBAAiB,GACvB,MAAM,EAAE,EAAE,CAqBZ;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAkCnF;AAqBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,EACrC,CAAC,SAAI,EACL,IAAI,CAAC,EAAE,iBAAiB,GACvB,MAAM,EAAE,EAAE,EAAE,CA0Cd"}
|
package/dist/typed/algebra.d.ts
CHANGED
|
@@ -192,12 +192,16 @@ export declare function substitute(expr: string, vars: Record<string, string>):
|
|
|
192
192
|
/**
|
|
193
193
|
* Expand an expression string by distributing multiplication over addition.
|
|
194
194
|
*
|
|
195
|
-
* **
|
|
196
|
-
* powers, no function calls
|
|
197
|
-
*
|
|
195
|
+
* **Polynomials in one OR MORE variables** (integer/non-negative-integer
|
|
196
|
+
* powers, no function calls, division only by numeric constants) are expanded
|
|
197
|
+
* EXACTLY via `polyFromExpression` + `polyToString`, collecting like terms:
|
|
198
|
+
* `expand('(x+1)^3')` → `'1*x^3 + 3*x^2 + 3*x + 1'`;
|
|
199
|
+
* `expand('(x+y)^2')` → `'1*y^2 + 2*x*y + 1*x^2'`;
|
|
200
|
+
* `expand('(x+y)*(x-y)')` → `'-1*y^2 + 1*x^2'` (the `x*y` terms cancel).
|
|
198
201
|
*
|
|
199
|
-
* Everything else (
|
|
200
|
-
* the original regex-based distributor below
|
|
202
|
+
* Everything else (function calls like `sin`, non-integer exponents, division
|
|
203
|
+
* by a variable) falls back to the original regex-based distributor below,
|
|
204
|
+
* which does NOT collect like terms.
|
|
201
205
|
*
|
|
202
206
|
* @param expr - Expression string
|
|
203
207
|
* @returns Expanded expression string
|
|
@@ -206,6 +210,7 @@ export declare function substitute(expr: string, vars: Record<string, string>):
|
|
|
206
210
|
* ```typescript
|
|
207
211
|
* expand('(a+b)*(c+d)'); // 'a*c + a*d + b*c + b*d'
|
|
208
212
|
* expand('(x+1)^3'); // '1*x^3 + 3*x^2 + 3*x + 1'
|
|
213
|
+
* expand('(x+y)^2'); // '1*y^2 + 2*x*y + 1*x^2'
|
|
209
214
|
* ```
|
|
210
215
|
*/
|
|
211
216
|
export declare function expand(expr: string): string;
|
|
@@ -219,7 +224,14 @@ export declare function expand(expr: string): string;
|
|
|
219
224
|
* out exactly, and any irreducible remainder is left as-is:
|
|
220
225
|
* `factor('x^2-1')` → `'(x - 1)*(x + 1)'`.
|
|
221
226
|
*
|
|
222
|
-
*
|
|
227
|
+
* **Multivariate polynomials** get the tractable subset (see
|
|
228
|
+
* {@link factorMultivariate}): integer-content + common-monomial extraction
|
|
229
|
+
* and monomial difference-of-squares — `x^2*y + x*y^2 → 'x*y*(x + y)'`,
|
|
230
|
+
* `4*x^2 - 9*y^2 → '(2*x - 3*y)*(2*x + 3*y)'`. Full multivariate factorization
|
|
231
|
+
* into irreducible factors (Wang/Zassenhaus/EEZ) is OUT OF SCOPE and returns
|
|
232
|
+
* the partially-factored or unchanged expression rather than a wrong answer.
|
|
233
|
+
*
|
|
234
|
+
* Everything else (no rational root, no common factor) falls back to the
|
|
223
235
|
* original common-integer-factor extraction below.
|
|
224
236
|
*
|
|
225
237
|
* @param expr - Expression string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebra.d.ts","sourceRoot":"","sources":["../../src/typed/algebra.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"algebra.d.ts","sourceRoot":"","sources":["../../src/typed/algebra.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,KAAK,GAAG,GAAG,MAAM,CAAC;AAkJlB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,CAOrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAO1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAgB1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,GAAE,MAAU,GAAG,MAAM,EAAE,CAUjE;AAED;;;;;;;;;;;;;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;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBjD;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAKrD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CA6BtE;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAmEhF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAgCvD;AAMD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CxB,CAAC"}
|
package/dist/typed/cas.d.ts
CHANGED
|
@@ -640,29 +640,33 @@ export declare function casDerivative(expr: string | MathNode, variable: string)
|
|
|
640
640
|
*/
|
|
641
641
|
export declare function casDerivative(exprs: Array<string | MathNode>, variable: string): Promise<string[]>;
|
|
642
642
|
/**
|
|
643
|
-
* Expand
|
|
644
|
-
* (CAS batch-capable variant).
|
|
643
|
+
* Expand an expression, distributing products over sums and collecting like
|
|
644
|
+
* terms (CAS batch-capable variant).
|
|
645
645
|
*
|
|
646
|
-
*
|
|
647
|
-
* `algebra.ts
|
|
648
|
-
*
|
|
646
|
+
* Delegates to the real polynomial engine {@link algebraExpand} (`expand` from
|
|
647
|
+
* `algebra.ts`): polynomials in one OR MORE variables are expanded EXACTLY
|
|
648
|
+
* (`'(x+1)^2'` → `'1*x^2 + 2*x + 1'`, `'(x+y)^2'` → `'1*y^2 + 2*x*y + 1*x^2'`).
|
|
649
|
+
* Non-polynomial pieces fall back to that engine's regex distributor.
|
|
650
|
+
*
|
|
651
|
+
* (Formerly a crude string stub that emitted uncollected products like
|
|
652
|
+
* `'x*x + x*1 + 1*x + 1*1'`; now wired to the maintained engine.)
|
|
649
653
|
*
|
|
650
654
|
* @param expr - Expression string or parsed MathNode
|
|
651
655
|
* @returns Expanded expression string
|
|
652
656
|
*
|
|
653
657
|
* @example
|
|
654
|
-
* casExpand('(x+1)^2')
|
|
655
|
-
* casExpand('(
|
|
658
|
+
* casExpand('(x+1)^2') // => '1*x^2 + 2*x + 1'
|
|
659
|
+
* casExpand('(x+y)*(x-y)') // => '-1*y^2 + 1*x^2'
|
|
656
660
|
*/
|
|
657
661
|
export declare function casExpand(expr: string | MathNode): string;
|
|
658
662
|
/**
|
|
659
|
-
* Expand an array of expressions (batch overload
|
|
660
|
-
*
|
|
661
|
-
* Arrays shorter than {@link CAS_BATCH_THRESHOLD} (16) are processed
|
|
662
|
-
* synchronously in-process. Longer arrays are dispatched to the worker pool.
|
|
663
|
+
* Expand an array of expressions (batch overload).
|
|
663
664
|
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
665
|
+
* Each element is expanded via the real engine {@link algebraExpand}. Kept
|
|
666
|
+
* async (resolves to `string[]`) for API compatibility; because the engine
|
|
667
|
+
* relies on the polynomial parser it runs in-process rather than fanning out
|
|
668
|
+
* to workers (a worker cannot import it), so batch results are always
|
|
669
|
+
* identical to the per-element single-expression call.
|
|
666
670
|
*
|
|
667
671
|
* @param exprs - Array of expression strings (or MathNodes)
|
|
668
672
|
* @returns Promise resolving to an array of expanded expression strings
|
|
@@ -672,32 +676,32 @@ export declare function casExpand(expr: string | MathNode): string;
|
|
|
672
676
|
*/
|
|
673
677
|
export declare function casExpand(exprs: Array<string | MathNode>): Promise<string[]>;
|
|
674
678
|
/**
|
|
675
|
-
* Factor
|
|
676
|
-
* (CAS batch-capable variant).
|
|
679
|
+
* Factor an expression (CAS batch-capable variant).
|
|
677
680
|
*
|
|
678
|
-
*
|
|
679
|
-
* `algebra.ts
|
|
680
|
-
*
|
|
681
|
+
* Delegates to the real factoring engine {@link algebraFactor} (`factor` from
|
|
682
|
+
* `algebra.ts`): univariate polynomials are factored over ℚ via the
|
|
683
|
+
* rational-root theorem (`'x^2 - 1'` → `'(x - 1)*(x + 1)'`), multivariate
|
|
684
|
+
* polynomials get integer-content / common-monomial / difference-of-squares
|
|
685
|
+
* extraction (`'x^2*y + x*y^2'` → `'x*y*(x + y)'`), and anything else falls
|
|
686
|
+
* back to integer-GCD extraction (`'2*x + 4*y'` → `'2*(x + 2*y)'`).
|
|
681
687
|
*
|
|
682
|
-
*
|
|
683
|
-
* greater than 1 is found, or when terms do not follow the `c*var` pattern.
|
|
688
|
+
* (Formerly a crude integer-GCD-only stub; now wired to the maintained engine.)
|
|
684
689
|
*
|
|
685
690
|
* @param expr - Expression string or parsed MathNode
|
|
686
691
|
* @returns Factored expression string
|
|
687
692
|
*
|
|
688
693
|
* @example
|
|
689
694
|
* casFactor('2*x + 4*y') // => '2*(x + 2*y)'
|
|
690
|
-
* casFactor('x^2 - 1') // => 'x
|
|
695
|
+
* casFactor('x^2 - 1') // => '(x - 1)*(x + 1)'
|
|
691
696
|
*/
|
|
692
697
|
export declare function casFactor(expr: string | MathNode): string;
|
|
693
698
|
/**
|
|
694
|
-
* Factor an array of expressions (batch overload
|
|
699
|
+
* Factor an array of expressions (batch overload).
|
|
695
700
|
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
* before dispatch.
|
|
701
|
+
* Each element is factored via the real engine {@link algebraFactor}. Kept
|
|
702
|
+
* async (resolves to `string[]`) for API compatibility; runs in-process (the
|
|
703
|
+
* engine cannot be serialised to a worker), so batch results are always
|
|
704
|
+
* identical to the per-element single-expression call.
|
|
701
705
|
*
|
|
702
706
|
* @param exprs - Array of expression strings (or MathNodes)
|
|
703
707
|
* @returns Promise resolving to an array of factored expression strings
|
package/dist/typed/cas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas.d.ts","sourceRoot":"","sources":["../../src/typed/cas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,EAAY,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"cas.d.ts","sourceRoot":"","sources":["../../src/typed/cas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,EAAY,MAAM,0BAA0B,CAAC;AAU3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAIrD,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAMnF,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AA+NzC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,CAgEvF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,GAAG,CAkE5F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,I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