@danielsimonjr/mathts-functions 0.32.0 → 0.33.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/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +469 -8
- package/dist/numbertheory/extra.d.ts +142 -0
- package/dist/numbertheory/extra.d.ts.map +1 -0
- package/dist/numeric/gauss-nodes.d.ts +35 -0
- package/dist/numeric/gauss-nodes.d.ts.map +1 -0
- package/dist/special/hypergeometric.d.ts +91 -0
- package/dist/special/hypergeometric.d.ts.map +1 -0
- package/dist/special/jacobi-elliptic.d.ts +60 -0
- package/dist/special/jacobi-elliptic.d.ts.map +1 -0
- package/dist/special/polygamma-orthopoly.d.ts +79 -0
- package/dist/special/polygamma-orthopoly.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { config } from './config-api.js';
|
|
|
15
15
|
export { to, toBest } from './typed/unit.js';
|
|
16
16
|
export { evaluate, compileExpr, parse, parser, reviver, replacer } from './factories/evaluate.js';
|
|
17
17
|
export { help } from './help.js';
|
|
18
|
+
export { continuedFraction, eulerNumbers, stirlingS1, discreteLog, primitiveRoot, multiplicativeOrder, kroneckerSymbol, permutationsGen, combinationsGen, } from './numbertheory/extra.js';
|
|
18
19
|
export { derivativeAt, valueAndDerivativeAt, gradientAt } from './grad-forward.js';
|
|
19
20
|
export type { DualFn } from './grad-forward.js';
|
|
20
21
|
export { gmean, hmean, moment, skewness, kurtosis, iqr, sem, zscore, cov, corrcoef, rankdata, spearman, kendallTau, linregress, pearsonr, spearmanr, kendalltau, kendallTauTest, ptp, variation, trimmedMean, describe, histogram, } from './descriptive-stats.js';
|
|
@@ -70,4 +71,9 @@ export { firwin, butter, lfilter, lfilterZi, filtfilt } from './signal-filter-ex
|
|
|
70
71
|
export { haversine, EARTH_RADIUS_KM, slerp, quaternionMultiply, quaternionConjugate, quaternionNormalize, quaternionFromAxisAngle, quaternionRotate, quaternionToRotationMatrix, } from './geometry-extra.js';
|
|
71
72
|
export { noncentralChi2CDF, noncentralFCDF, noncentralTCDF, circmean, circstd, circvar, vonMisesPDF, mcnemar, cochranQ, } from './stats/inference-extra2.js';
|
|
72
73
|
export type { CircularOptions, McNemarOptions, McNemarResult, CochranQResult, } from './stats/inference-extra2.js';
|
|
74
|
+
export { hyp0f1, hyp1f1, hyp2f1, pFq } from './special/hypergeometric.js';
|
|
75
|
+
export { polygamma, trigamma, jacobiP, gegenbauerC } from './special/polygamma-orthopoly.js';
|
|
76
|
+
export { jacobiSN, jacobiCN, jacobiDN } from './special/jacobi-elliptic.js';
|
|
77
|
+
export { rootsLegendre } from './numeric/gauss-nodes.js';
|
|
78
|
+
export type { RootsLegendreResult } from './numeric/gauss-nodes.js';
|
|
73
79
|
//# 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,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACnF,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ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ACjE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGxF,OAAO,EACL,SAAS,EACT,eAAe,EACf,KAAK,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,OAAO,EACP,QAAQ,GACT,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAK1E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAM7F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -31837,9 +31837,9 @@ var dependencies187 = ["typed", "factorial"];
|
|
|
31837
31837
|
var createPermutations = /* @__PURE__ */ factory(
|
|
31838
31838
|
name187,
|
|
31839
31839
|
dependencies187,
|
|
31840
|
-
({ typed: typed3, factorial:
|
|
31840
|
+
({ typed: typed3, factorial: factorial5 }) => {
|
|
31841
31841
|
return typed3(name187, {
|
|
31842
|
-
"number | BigNumber":
|
|
31842
|
+
"number | BigNumber": factorial5,
|
|
31843
31843
|
"number, number": function(n, k) {
|
|
31844
31844
|
if (!isInteger(n) || n < 0) {
|
|
31845
31845
|
throw new TypeError("Positive integer value expected in function permutations");
|
|
@@ -36105,7 +36105,7 @@ var dependencies224 = ["typed", "add", "divide", "multiply", "factorial", "isInt
|
|
|
36105
36105
|
var createMultinomial = /* @__PURE__ */ factory(
|
|
36106
36106
|
name224,
|
|
36107
36107
|
dependencies224,
|
|
36108
|
-
({ typed: typed3, add: add2, divide: divide2, multiply: multiply2, factorial:
|
|
36108
|
+
({ typed: typed3, add: add2, divide: divide2, multiply: multiply2, factorial: factorial5, isInteger: isInteger3, isPositive: isPositive2 }) => {
|
|
36109
36109
|
return typed3(name224, {
|
|
36110
36110
|
"Array | Matrix": function(a) {
|
|
36111
36111
|
let sum3 = 0;
|
|
@@ -36115,9 +36115,9 @@ var createMultinomial = /* @__PURE__ */ factory(
|
|
|
36115
36115
|
throw new TypeError("Positive integer value expected in function multinomial");
|
|
36116
36116
|
}
|
|
36117
36117
|
sum3 = add2(sum3, ai);
|
|
36118
|
-
denom = multiply2(denom,
|
|
36118
|
+
denom = multiply2(denom, factorial5(ai));
|
|
36119
36119
|
});
|
|
36120
|
-
return divide2(
|
|
36120
|
+
return divide2(factorial5(sum3), denom);
|
|
36121
36121
|
}
|
|
36122
36122
|
});
|
|
36123
36123
|
}
|
|
@@ -37174,7 +37174,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
37174
37174
|
multiply: multiply2,
|
|
37175
37175
|
pow: pow2,
|
|
37176
37176
|
divide: divide2,
|
|
37177
|
-
factorial:
|
|
37177
|
+
factorial: factorial5,
|
|
37178
37178
|
equal: equal2,
|
|
37179
37179
|
smallerEq: smallerEq2,
|
|
37180
37180
|
isBounded: isBounded2,
|
|
@@ -37252,8 +37252,8 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
37252
37252
|
let S = k;
|
|
37253
37253
|
for (let j = k; smallerEq2(j, n); j = add2(j, 1)) {
|
|
37254
37254
|
const factor2 = divide2(
|
|
37255
|
-
multiply2(
|
|
37256
|
-
multiply2(
|
|
37255
|
+
multiply2(factorial5(add2(n, subtract2(j, 1))), pow2(4, j)),
|
|
37256
|
+
multiply2(factorial5(subtract2(n, j)), factorial5(multiply2(2, j)))
|
|
37257
37257
|
);
|
|
37258
37258
|
S = add2(S, factor2);
|
|
37259
37259
|
}
|
|
@@ -44400,6 +44400,262 @@ function help(search) {
|
|
|
44400
44400
|
return new Help(doc);
|
|
44401
44401
|
}
|
|
44402
44402
|
|
|
44403
|
+
// src/numbertheory/extra.ts
|
|
44404
|
+
function continuedFraction(x, maxTerms = 20) {
|
|
44405
|
+
if (!Number.isFinite(x)) {
|
|
44406
|
+
throw new Error("continuedFraction requires a finite number");
|
|
44407
|
+
}
|
|
44408
|
+
const terms = [];
|
|
44409
|
+
let r = x;
|
|
44410
|
+
for (let i = 0; i < maxTerms; i++) {
|
|
44411
|
+
const a = Math.floor(r);
|
|
44412
|
+
terms.push(a);
|
|
44413
|
+
const frac = r - a;
|
|
44414
|
+
if (frac < 1e-12) break;
|
|
44415
|
+
r = 1 / frac;
|
|
44416
|
+
}
|
|
44417
|
+
return terms;
|
|
44418
|
+
}
|
|
44419
|
+
function binomialExact(n, k) {
|
|
44420
|
+
if (k < 0 || k > n) return 0;
|
|
44421
|
+
const kk = Math.min(k, n - k);
|
|
44422
|
+
let result = 1;
|
|
44423
|
+
for (let i = 0; i < kk; i++) {
|
|
44424
|
+
result = result * (n - i) / (i + 1);
|
|
44425
|
+
}
|
|
44426
|
+
return Math.round(result);
|
|
44427
|
+
}
|
|
44428
|
+
function eulerNumbers(n) {
|
|
44429
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
44430
|
+
throw new Error("eulerNumbers requires a non-negative integer");
|
|
44431
|
+
}
|
|
44432
|
+
const E = new Array(n + 1).fill(0);
|
|
44433
|
+
E[0] = 1;
|
|
44434
|
+
for (let m = 1; m <= n; m++) {
|
|
44435
|
+
if (m % 2 === 1) {
|
|
44436
|
+
E[m] = 0;
|
|
44437
|
+
continue;
|
|
44438
|
+
}
|
|
44439
|
+
let sum3 = 0;
|
|
44440
|
+
for (let k = 0; k < m / 2; k++) {
|
|
44441
|
+
sum3 += binomialExact(m, 2 * k) * E[2 * k];
|
|
44442
|
+
}
|
|
44443
|
+
E[m] = -sum3;
|
|
44444
|
+
}
|
|
44445
|
+
return E;
|
|
44446
|
+
}
|
|
44447
|
+
function stirlingS1(n, k) {
|
|
44448
|
+
if (!Number.isInteger(n) || !Number.isInteger(k) || n < 0 || k < 0) {
|
|
44449
|
+
throw new Error("stirlingS1 requires non-negative integers");
|
|
44450
|
+
}
|
|
44451
|
+
if (k > n) return 0;
|
|
44452
|
+
const s = Array.from({ length: n + 1 }, () => new Array(n + 1).fill(0));
|
|
44453
|
+
s[0][0] = 1;
|
|
44454
|
+
for (let i = 1; i <= n; i++) {
|
|
44455
|
+
for (let j = 0; j <= i; j++) {
|
|
44456
|
+
const prevDiag = j > 0 ? s[i - 1][j - 1] : 0;
|
|
44457
|
+
const prevSame = s[i - 1][j];
|
|
44458
|
+
s[i][j] = prevDiag - (i - 1) * prevSame;
|
|
44459
|
+
}
|
|
44460
|
+
}
|
|
44461
|
+
return s[n][k];
|
|
44462
|
+
}
|
|
44463
|
+
function modPowBig(base, exp2, mod2) {
|
|
44464
|
+
let b = (base % mod2 + mod2) % mod2;
|
|
44465
|
+
let e = exp2;
|
|
44466
|
+
let result = 1n;
|
|
44467
|
+
while (e > 0n) {
|
|
44468
|
+
if (e & 1n) result = result * b % mod2;
|
|
44469
|
+
b = b * b % mod2;
|
|
44470
|
+
e >>= 1n;
|
|
44471
|
+
}
|
|
44472
|
+
return result;
|
|
44473
|
+
}
|
|
44474
|
+
function modInverseBig(a, mod2) {
|
|
44475
|
+
let oldR = a;
|
|
44476
|
+
let r = mod2;
|
|
44477
|
+
let oldS = 1n;
|
|
44478
|
+
let s = 0n;
|
|
44479
|
+
while (r !== 0n) {
|
|
44480
|
+
const q = oldR / r;
|
|
44481
|
+
[oldR, r] = [r, oldR - q * r];
|
|
44482
|
+
[oldS, s] = [s, oldS - q * s];
|
|
44483
|
+
}
|
|
44484
|
+
return (oldS % mod2 + mod2) % mod2;
|
|
44485
|
+
}
|
|
44486
|
+
function discreteLog(g, h, p) {
|
|
44487
|
+
if (!Number.isInteger(g) || !Number.isInteger(h) || !Number.isInteger(p) || p < 2) {
|
|
44488
|
+
throw new Error("discreteLog requires integer g, h and a modulus p >= 2");
|
|
44489
|
+
}
|
|
44490
|
+
const P2 = BigInt(p);
|
|
44491
|
+
const G = (BigInt(g) % P2 + P2) % P2;
|
|
44492
|
+
const H = (BigInt(h) % P2 + P2) % P2;
|
|
44493
|
+
const m = BigInt(Math.max(1, Math.ceil(Math.sqrt(p - 1))));
|
|
44494
|
+
const table = /* @__PURE__ */ new Map();
|
|
44495
|
+
let cur = 1n;
|
|
44496
|
+
for (let j = 0n; j < m; j++) {
|
|
44497
|
+
const key = cur.toString();
|
|
44498
|
+
if (!table.has(key)) table.set(key, j);
|
|
44499
|
+
cur = cur * G % P2;
|
|
44500
|
+
}
|
|
44501
|
+
const gm = modPowBig(G, m, P2);
|
|
44502
|
+
const gInvM = modInverseBig(gm, P2);
|
|
44503
|
+
let gamma2 = H;
|
|
44504
|
+
for (let i = 0n; i < m; i++) {
|
|
44505
|
+
const key = gamma2.toString();
|
|
44506
|
+
const j = table.get(key);
|
|
44507
|
+
if (j !== void 0) {
|
|
44508
|
+
return Number(i * m + j);
|
|
44509
|
+
}
|
|
44510
|
+
gamma2 = gamma2 * gInvM % P2;
|
|
44511
|
+
}
|
|
44512
|
+
return -1;
|
|
44513
|
+
}
|
|
44514
|
+
function distinctPrimeFactors(nIn) {
|
|
44515
|
+
let n = nIn;
|
|
44516
|
+
const primes = [];
|
|
44517
|
+
for (let d = 2; d * d <= n; d++) {
|
|
44518
|
+
if (n % d === 0) {
|
|
44519
|
+
primes.push(d);
|
|
44520
|
+
while (n % d === 0) n /= d;
|
|
44521
|
+
}
|
|
44522
|
+
}
|
|
44523
|
+
if (n > 1) primes.push(n);
|
|
44524
|
+
return primes;
|
|
44525
|
+
}
|
|
44526
|
+
function primitiveRoot(p) {
|
|
44527
|
+
if (!Number.isInteger(p) || p < 2) {
|
|
44528
|
+
throw new Error("primitiveRoot requires an integer p >= 2");
|
|
44529
|
+
}
|
|
44530
|
+
if (p === 2) return 1;
|
|
44531
|
+
const phi = p - 1;
|
|
44532
|
+
const phiFactors = distinctPrimeFactors(phi);
|
|
44533
|
+
const P2 = BigInt(p);
|
|
44534
|
+
for (let g = 2; g < p; g++) {
|
|
44535
|
+
let isRoot = true;
|
|
44536
|
+
for (const q of phiFactors) {
|
|
44537
|
+
if (modPowBig(BigInt(g), BigInt(phi / q), P2) === 1n) {
|
|
44538
|
+
isRoot = false;
|
|
44539
|
+
break;
|
|
44540
|
+
}
|
|
44541
|
+
}
|
|
44542
|
+
if (isRoot) return g;
|
|
44543
|
+
}
|
|
44544
|
+
throw new Error("primitiveRoot: no primitive root found (p may not be prime)");
|
|
44545
|
+
}
|
|
44546
|
+
function gcdInt(aIn, bIn) {
|
|
44547
|
+
let a = Math.abs(aIn);
|
|
44548
|
+
let b = Math.abs(bIn);
|
|
44549
|
+
while (b !== 0) {
|
|
44550
|
+
[a, b] = [b, a % b];
|
|
44551
|
+
}
|
|
44552
|
+
return a;
|
|
44553
|
+
}
|
|
44554
|
+
function multiplicativeOrder(a, n) {
|
|
44555
|
+
if (!Number.isInteger(a) || !Number.isInteger(n) || n < 1) {
|
|
44556
|
+
throw new Error("multiplicativeOrder requires integers with modulus n >= 1");
|
|
44557
|
+
}
|
|
44558
|
+
const amod = (a % n + n) % n;
|
|
44559
|
+
if (gcdInt(amod, n) !== 1) return -1;
|
|
44560
|
+
if (n === 1) return 1;
|
|
44561
|
+
let cur = amod;
|
|
44562
|
+
let k = 1;
|
|
44563
|
+
while (cur !== 1) {
|
|
44564
|
+
cur = cur * amod % n;
|
|
44565
|
+
k++;
|
|
44566
|
+
}
|
|
44567
|
+
return k;
|
|
44568
|
+
}
|
|
44569
|
+
function kroneckerTwo(a) {
|
|
44570
|
+
if (a % 2 === 0) return 0;
|
|
44571
|
+
const r = (a % 8 + 8) % 8;
|
|
44572
|
+
return r === 1 || r === 7 ? 1 : -1;
|
|
44573
|
+
}
|
|
44574
|
+
function kroneckerSymbol(a, n) {
|
|
44575
|
+
if (!Number.isInteger(a) || !Number.isInteger(n)) {
|
|
44576
|
+
throw new Error("kroneckerSymbol requires integers");
|
|
44577
|
+
}
|
|
44578
|
+
if (n === 0) {
|
|
44579
|
+
return Math.abs(a) === 1 ? 1 : 0;
|
|
44580
|
+
}
|
|
44581
|
+
let sign3 = 1;
|
|
44582
|
+
let nn = n;
|
|
44583
|
+
if (nn < 0) {
|
|
44584
|
+
nn = -nn;
|
|
44585
|
+
if (a < 0) sign3 = -1;
|
|
44586
|
+
}
|
|
44587
|
+
let v = 0;
|
|
44588
|
+
while (nn % 2 === 0) {
|
|
44589
|
+
nn /= 2;
|
|
44590
|
+
v++;
|
|
44591
|
+
}
|
|
44592
|
+
if (v > 0) {
|
|
44593
|
+
const k2 = kroneckerTwo(a);
|
|
44594
|
+
if (k2 === 0) return 0;
|
|
44595
|
+
sign3 *= Math.pow(k2, v);
|
|
44596
|
+
}
|
|
44597
|
+
if (nn === 1) return sign3;
|
|
44598
|
+
let aa = (a % nn + nn) % nn;
|
|
44599
|
+
let N = nn;
|
|
44600
|
+
let jac = 1;
|
|
44601
|
+
while (aa !== 0) {
|
|
44602
|
+
while (aa % 2 === 0) {
|
|
44603
|
+
aa /= 2;
|
|
44604
|
+
if (N % 8 === 3 || N % 8 === 5) jac = -jac;
|
|
44605
|
+
}
|
|
44606
|
+
[aa, N] = [N, aa];
|
|
44607
|
+
if (aa % 4 === 3 && N % 4 === 3) jac = -jac;
|
|
44608
|
+
aa = aa % N;
|
|
44609
|
+
}
|
|
44610
|
+
return sign3 * (N === 1 ? jac : 0);
|
|
44611
|
+
}
|
|
44612
|
+
function combinationsGen(arr8, k) {
|
|
44613
|
+
const n = arr8.length;
|
|
44614
|
+
if (!Number.isInteger(k) || k < 0 || k > n) {
|
|
44615
|
+
throw new Error("combinationsGen: k must be an integer in [0, arr.length]");
|
|
44616
|
+
}
|
|
44617
|
+
const result = [];
|
|
44618
|
+
const combo = [];
|
|
44619
|
+
function backtrack(start) {
|
|
44620
|
+
if (combo.length === k) {
|
|
44621
|
+
result.push(combo.slice());
|
|
44622
|
+
return;
|
|
44623
|
+
}
|
|
44624
|
+
for (let i = start; i < n; i++) {
|
|
44625
|
+
combo.push(arr8[i]);
|
|
44626
|
+
backtrack(i + 1);
|
|
44627
|
+
combo.pop();
|
|
44628
|
+
}
|
|
44629
|
+
}
|
|
44630
|
+
backtrack(0);
|
|
44631
|
+
return result;
|
|
44632
|
+
}
|
|
44633
|
+
function permutationsGen(arr8, k = arr8.length) {
|
|
44634
|
+
const n = arr8.length;
|
|
44635
|
+
if (!Number.isInteger(k) || k < 0 || k > n) {
|
|
44636
|
+
throw new Error("permutationsGen: k must be an integer in [0, arr.length]");
|
|
44637
|
+
}
|
|
44638
|
+
const result = [];
|
|
44639
|
+
const used = new Array(n).fill(false);
|
|
44640
|
+
const perm = [];
|
|
44641
|
+
function backtrack() {
|
|
44642
|
+
if (perm.length === k) {
|
|
44643
|
+
result.push(perm.slice());
|
|
44644
|
+
return;
|
|
44645
|
+
}
|
|
44646
|
+
for (let i = 0; i < n; i++) {
|
|
44647
|
+
if (used[i]) continue;
|
|
44648
|
+
used[i] = true;
|
|
44649
|
+
perm.push(arr8[i]);
|
|
44650
|
+
backtrack();
|
|
44651
|
+
perm.pop();
|
|
44652
|
+
used[i] = false;
|
|
44653
|
+
}
|
|
44654
|
+
}
|
|
44655
|
+
backtrack();
|
|
44656
|
+
return result;
|
|
44657
|
+
}
|
|
44658
|
+
|
|
44403
44659
|
// src/grad-forward.ts
|
|
44404
44660
|
import { Dual as Dual3 } from "@danielsimonjr/mathts-core";
|
|
44405
44661
|
function derivativeAt(fn, x0) {
|
|
@@ -47170,6 +47426,190 @@ function cochranQ(data) {
|
|
|
47170
47426
|
const pValue = 1 - chiSquaredCDF(Q2, dof);
|
|
47171
47427
|
return { Q: Q2, pValue, dof };
|
|
47172
47428
|
}
|
|
47429
|
+
|
|
47430
|
+
// src/special/hypergeometric.ts
|
|
47431
|
+
var MAX_TERMS = 500;
|
|
47432
|
+
var RELTOL = 1e-16;
|
|
47433
|
+
function pFq(a, b, z) {
|
|
47434
|
+
let sum3 = 1;
|
|
47435
|
+
let term = 1;
|
|
47436
|
+
for (let n = 0; n < MAX_TERMS; n++) {
|
|
47437
|
+
let ratio = z / (n + 1);
|
|
47438
|
+
for (const ai of a) ratio *= ai + n;
|
|
47439
|
+
for (const bj of b) ratio /= bj + n;
|
|
47440
|
+
term *= ratio;
|
|
47441
|
+
sum3 += term;
|
|
47442
|
+
if (Math.abs(term) < RELTOL * Math.abs(sum3)) break;
|
|
47443
|
+
}
|
|
47444
|
+
return sum3;
|
|
47445
|
+
}
|
|
47446
|
+
function hyp0f1(b, z) {
|
|
47447
|
+
return pFq([], [b], z);
|
|
47448
|
+
}
|
|
47449
|
+
function hyp1f1(a, b, z) {
|
|
47450
|
+
return pFq([a], [b], z);
|
|
47451
|
+
}
|
|
47452
|
+
function hyp2f1(a, b, c, z) {
|
|
47453
|
+
if (Math.abs(z) >= 1) {
|
|
47454
|
+
throw new Error("hyp2f1: |z| must be < 1 (analytic continuation not yet implemented)");
|
|
47455
|
+
}
|
|
47456
|
+
return pFq([a, b], [c], z);
|
|
47457
|
+
}
|
|
47458
|
+
|
|
47459
|
+
// src/special/polygamma-orthopoly.ts
|
|
47460
|
+
var SHIFT_THRESHOLD = 12;
|
|
47461
|
+
var BERNOULLI_EVEN = [1 / 6, -1 / 30, 1 / 42, -1 / 30];
|
|
47462
|
+
function factorial4(n) {
|
|
47463
|
+
let result = 1;
|
|
47464
|
+
for (let i = 2; i <= n; i++) result *= i;
|
|
47465
|
+
return result;
|
|
47466
|
+
}
|
|
47467
|
+
function polygamma(n, x) {
|
|
47468
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
47469
|
+
throw new Error("polygamma: n must be a nonnegative integer");
|
|
47470
|
+
}
|
|
47471
|
+
if (n === 0) {
|
|
47472
|
+
return digamma(x);
|
|
47473
|
+
}
|
|
47474
|
+
if (x <= 0 && Number.isInteger(x)) {
|
|
47475
|
+
return NaN;
|
|
47476
|
+
}
|
|
47477
|
+
const sign3 = n % 2 === 1 ? 1 : -1;
|
|
47478
|
+
const nFactorial = factorial4(n);
|
|
47479
|
+
let recurrenceSum = 0;
|
|
47480
|
+
let shifted = x;
|
|
47481
|
+
while (shifted < SHIFT_THRESHOLD) {
|
|
47482
|
+
recurrenceSum += 1 / Math.pow(shifted, n + 1);
|
|
47483
|
+
shifted += 1;
|
|
47484
|
+
}
|
|
47485
|
+
let bracket = factorial4(n - 1) / Math.pow(shifted, n) + nFactorial / (2 * Math.pow(shifted, n + 1));
|
|
47486
|
+
for (let j = 1; j <= BERNOULLI_EVEN.length; j++) {
|
|
47487
|
+
const twoJ = 2 * j;
|
|
47488
|
+
const term = BERNOULLI_EVEN[j - 1] * factorial4(twoJ + n - 1) / factorial4(twoJ) / Math.pow(shifted, twoJ + n);
|
|
47489
|
+
bracket += term;
|
|
47490
|
+
}
|
|
47491
|
+
return sign3 * (nFactorial * recurrenceSum + bracket);
|
|
47492
|
+
}
|
|
47493
|
+
function trigamma(x) {
|
|
47494
|
+
return polygamma(1, x);
|
|
47495
|
+
}
|
|
47496
|
+
function jacobiP(n, alpha, beta2, x) {
|
|
47497
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
47498
|
+
throw new Error("jacobiP: n must be a nonnegative integer");
|
|
47499
|
+
}
|
|
47500
|
+
if (n === 0) return 1;
|
|
47501
|
+
let pPrev = 1;
|
|
47502
|
+
let pCurr = alpha + 1 + (alpha + beta2 + 2) * (x - 1) / 2;
|
|
47503
|
+
if (n === 1) return pCurr;
|
|
47504
|
+
for (let k = 2; k <= n; k++) {
|
|
47505
|
+
const a1 = 2 * k * (k + alpha + beta2) * (2 * k + alpha + beta2 - 2);
|
|
47506
|
+
const a2 = (2 * k + alpha + beta2 - 1) * ((2 * k + alpha + beta2) * (2 * k + alpha + beta2 - 2) * x + alpha * alpha - beta2 * beta2);
|
|
47507
|
+
const a3 = 2 * (k + alpha - 1) * (k + beta2 - 1) * (2 * k + alpha + beta2);
|
|
47508
|
+
const pNext = (a2 * pCurr - a3 * pPrev) / a1;
|
|
47509
|
+
pPrev = pCurr;
|
|
47510
|
+
pCurr = pNext;
|
|
47511
|
+
}
|
|
47512
|
+
return pCurr;
|
|
47513
|
+
}
|
|
47514
|
+
function gegenbauerC(n, alpha, x) {
|
|
47515
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
47516
|
+
throw new Error("gegenbauerC: n must be a nonnegative integer");
|
|
47517
|
+
}
|
|
47518
|
+
if (n === 0) return 1;
|
|
47519
|
+
let cPrev = 1;
|
|
47520
|
+
let cCurr = 2 * alpha * x;
|
|
47521
|
+
if (n === 1) return cCurr;
|
|
47522
|
+
for (let k = 2; k <= n; k++) {
|
|
47523
|
+
const cNext = (2 * x * (k + alpha - 1) * cCurr - (k + 2 * alpha - 2) * cPrev) / k;
|
|
47524
|
+
cPrev = cCurr;
|
|
47525
|
+
cCurr = cNext;
|
|
47526
|
+
}
|
|
47527
|
+
return cCurr;
|
|
47528
|
+
}
|
|
47529
|
+
|
|
47530
|
+
// src/special/jacobi-elliptic.ts
|
|
47531
|
+
var MAX_AGM_ITERATIONS = 12;
|
|
47532
|
+
var AGM_TOLERANCE = 1e-16;
|
|
47533
|
+
function jacobiElliptic(u, m) {
|
|
47534
|
+
if (m < 0 || m > 1) {
|
|
47535
|
+
throw new Error("jacobiElliptic: m (=k^2) must be in [0, 1]");
|
|
47536
|
+
}
|
|
47537
|
+
if (m === 0) {
|
|
47538
|
+
return { sn: Math.sin(u), cn: Math.cos(u), dn: 1 };
|
|
47539
|
+
}
|
|
47540
|
+
if (m === 1) {
|
|
47541
|
+
const sn2 = Math.tanh(u);
|
|
47542
|
+
const sech2 = 1 / Math.cosh(u);
|
|
47543
|
+
return { sn: sn2, cn: sech2, dn: sech2 };
|
|
47544
|
+
}
|
|
47545
|
+
const a = [1];
|
|
47546
|
+
const b = [Math.sqrt(1 - m)];
|
|
47547
|
+
const c = [Math.sqrt(m)];
|
|
47548
|
+
let n = 0;
|
|
47549
|
+
while (n < MAX_AGM_ITERATIONS && Math.abs(c[n]) > AGM_TOLERANCE) {
|
|
47550
|
+
a.push((a[n] + b[n]) / 2);
|
|
47551
|
+
b.push(Math.sqrt(a[n] * b[n]));
|
|
47552
|
+
c.push((a[n] - b[n]) / 2);
|
|
47553
|
+
n++;
|
|
47554
|
+
}
|
|
47555
|
+
let phi = Math.pow(2, n) * a[n] * u;
|
|
47556
|
+
for (let i = n; i >= 1; i--) {
|
|
47557
|
+
phi = (phi + Math.asin(c[i] / a[i] * Math.sin(phi))) / 2;
|
|
47558
|
+
}
|
|
47559
|
+
const sn = Math.sin(phi);
|
|
47560
|
+
const cn = Math.cos(phi);
|
|
47561
|
+
const dn = Math.sqrt(1 - m * sn * sn);
|
|
47562
|
+
return { sn, cn, dn };
|
|
47563
|
+
}
|
|
47564
|
+
function jacobiSN(u, m) {
|
|
47565
|
+
return jacobiElliptic(u, m).sn;
|
|
47566
|
+
}
|
|
47567
|
+
function jacobiCN(u, m) {
|
|
47568
|
+
return jacobiElliptic(u, m).cn;
|
|
47569
|
+
}
|
|
47570
|
+
function jacobiDN(u, m) {
|
|
47571
|
+
return jacobiElliptic(u, m).dn;
|
|
47572
|
+
}
|
|
47573
|
+
|
|
47574
|
+
// src/numeric/gauss-nodes.ts
|
|
47575
|
+
var NEWTON_MAX_ITERATIONS = 100;
|
|
47576
|
+
var NEWTON_TOLERANCE = 1e-15;
|
|
47577
|
+
function legendrePair(n, x) {
|
|
47578
|
+
let pPrev = 1;
|
|
47579
|
+
let pCurr = x;
|
|
47580
|
+
if (n === 0) return [1, x];
|
|
47581
|
+
for (let k = 2; k <= n; k++) {
|
|
47582
|
+
const pNext = ((2 * k - 1) * x * pCurr - (k - 1) * pPrev) / k;
|
|
47583
|
+
pPrev = pCurr;
|
|
47584
|
+
pCurr = pNext;
|
|
47585
|
+
}
|
|
47586
|
+
return [pCurr, pPrev];
|
|
47587
|
+
}
|
|
47588
|
+
function rootsLegendre(n) {
|
|
47589
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
47590
|
+
throw new Error("rootsLegendre: n must be a positive integer");
|
|
47591
|
+
}
|
|
47592
|
+
const nodes = [];
|
|
47593
|
+
const weights = [];
|
|
47594
|
+
for (let i = 0; i < n; i++) {
|
|
47595
|
+
let x = Math.cos(Math.PI * (i + 0.75) / (n + 0.5));
|
|
47596
|
+
let pn = 0;
|
|
47597
|
+
let dpn = 0;
|
|
47598
|
+
for (let iter = 0; iter < NEWTON_MAX_ITERATIONS; iter++) {
|
|
47599
|
+
const [pCurr, pPrev] = legendrePair(n, x);
|
|
47600
|
+
pn = pCurr;
|
|
47601
|
+
dpn = n * (x * pCurr - pPrev) / (x * x - 1);
|
|
47602
|
+
const dx = pn / dpn;
|
|
47603
|
+
x -= dx;
|
|
47604
|
+
if (Math.abs(dx) < NEWTON_TOLERANCE) break;
|
|
47605
|
+
}
|
|
47606
|
+
nodes.push(x);
|
|
47607
|
+
weights.push(2 / ((1 - x * x) * dpn * dpn));
|
|
47608
|
+
}
|
|
47609
|
+
nodes.reverse();
|
|
47610
|
+
weights.reverse();
|
|
47611
|
+
return { nodes, weights };
|
|
47612
|
+
}
|
|
47173
47613
|
export {
|
|
47174
47614
|
ARRAY_WORKER_THRESHOLD,
|
|
47175
47615
|
CAS_BATCH_THRESHOLD,
|
|
@@ -47302,6 +47742,7 @@ export {
|
|
|
47302
47742
|
collect,
|
|
47303
47743
|
column,
|
|
47304
47744
|
combinations,
|
|
47745
|
+
combinationsGen,
|
|
47305
47746
|
combinationsWithRep,
|
|
47306
47747
|
combine,
|
|
47307
47748
|
companion,
|
|
@@ -47319,6 +47760,7 @@ export {
|
|
|
47319
47760
|
config,
|
|
47320
47761
|
conj,
|
|
47321
47762
|
connectedComponents,
|
|
47763
|
+
continuedFraction,
|
|
47322
47764
|
convexHull,
|
|
47323
47765
|
convexHull3D,
|
|
47324
47766
|
convolve,
|
|
@@ -47377,6 +47819,7 @@ export {
|
|
|
47377
47819
|
digamma,
|
|
47378
47820
|
directionalDerivative,
|
|
47379
47821
|
disableGpu,
|
|
47822
|
+
discreteLog,
|
|
47380
47823
|
discreteUniformDist,
|
|
47381
47824
|
discriminant,
|
|
47382
47825
|
distance,
|
|
@@ -47424,6 +47867,7 @@ export {
|
|
|
47424
47867
|
erfc,
|
|
47425
47868
|
erfcScalar,
|
|
47426
47869
|
erfi,
|
|
47870
|
+
eulerNumbers,
|
|
47427
47871
|
eulerPhi,
|
|
47428
47872
|
evaluate,
|
|
47429
47873
|
eventDetection,
|
|
@@ -47553,6 +47997,7 @@ export {
|
|
|
47553
47997
|
gaussQuad,
|
|
47554
47998
|
gaussianKDE,
|
|
47555
47999
|
gcd,
|
|
48000
|
+
gegenbauerC,
|
|
47556
48001
|
generalizedEig,
|
|
47557
48002
|
geometricPMF,
|
|
47558
48003
|
getAssumptions,
|
|
@@ -47592,6 +48037,9 @@ export {
|
|
|
47592
48037
|
histogram,
|
|
47593
48038
|
hmean,
|
|
47594
48039
|
hotellingT2,
|
|
48040
|
+
hyp0f1,
|
|
48041
|
+
hyp1f1,
|
|
48042
|
+
hyp2f1,
|
|
47595
48043
|
hypergeometricDist,
|
|
47596
48044
|
hypot,
|
|
47597
48045
|
idct,
|
|
@@ -47631,6 +48079,10 @@ export {
|
|
|
47631
48079
|
isPositive,
|
|
47632
48080
|
isPrime,
|
|
47633
48081
|
isZero,
|
|
48082
|
+
jacobiCN,
|
|
48083
|
+
jacobiDN,
|
|
48084
|
+
jacobiP,
|
|
48085
|
+
jacobiSN,
|
|
47634
48086
|
jacobiSymbol,
|
|
47635
48087
|
jacobian,
|
|
47636
48088
|
jarqueBera,
|
|
@@ -47650,6 +48102,7 @@ export {
|
|
|
47650
48102
|
kolmogorovSmirnov2Test,
|
|
47651
48103
|
kolmogorovSmirnovTest,
|
|
47652
48104
|
kron,
|
|
48105
|
+
kroneckerSymbol,
|
|
47653
48106
|
kruskalWallis,
|
|
47654
48107
|
kurtosis,
|
|
47655
48108
|
lagrangeInterp,
|
|
@@ -47756,6 +48209,7 @@ export {
|
|
|
47756
48209
|
multinomial,
|
|
47757
48210
|
multipleComparison,
|
|
47758
48211
|
multipleTest,
|
|
48212
|
+
multiplicativeOrder,
|
|
47759
48213
|
multiply,
|
|
47760
48214
|
multiplyScalar,
|
|
47761
48215
|
multivariateNormal,
|
|
@@ -47799,6 +48253,7 @@ export {
|
|
|
47799
48253
|
or,
|
|
47800
48254
|
orth,
|
|
47801
48255
|
outer,
|
|
48256
|
+
pFq,
|
|
47802
48257
|
pacf,
|
|
47803
48258
|
padeApproximant,
|
|
47804
48259
|
pageRank,
|
|
@@ -47840,6 +48295,7 @@ export {
|
|
|
47840
48295
|
periodogram,
|
|
47841
48296
|
permutationTest,
|
|
47842
48297
|
permutations,
|
|
48298
|
+
permutationsGen,
|
|
47843
48299
|
pickRandom,
|
|
47844
48300
|
piecewise,
|
|
47845
48301
|
pinv,
|
|
@@ -47856,6 +48312,7 @@ export {
|
|
|
47856
48312
|
polyFit,
|
|
47857
48313
|
polyadd,
|
|
47858
48314
|
polyder,
|
|
48315
|
+
polygamma,
|
|
47859
48316
|
polygonArea,
|
|
47860
48317
|
polygonPerimeter,
|
|
47861
48318
|
polymul,
|
|
@@ -47871,6 +48328,7 @@ export {
|
|
|
47871
48328
|
prime,
|
|
47872
48329
|
primeFactors,
|
|
47873
48330
|
primePi,
|
|
48331
|
+
primitiveRoot,
|
|
47874
48332
|
principalComponentAnalysis,
|
|
47875
48333
|
print,
|
|
47876
48334
|
prod,
|
|
@@ -47920,6 +48378,7 @@ export {
|
|
|
47920
48378
|
risingFactorial,
|
|
47921
48379
|
romberg,
|
|
47922
48380
|
root,
|
|
48381
|
+
rootsLegendre,
|
|
47923
48382
|
rotate,
|
|
47924
48383
|
rotateVector2D,
|
|
47925
48384
|
rotateVector3D,
|
|
@@ -47991,6 +48450,7 @@ export {
|
|
|
47991
48450
|
std,
|
|
47992
48451
|
stefanBoltzmann,
|
|
47993
48452
|
stiffODESolver,
|
|
48453
|
+
stirlingS1,
|
|
47994
48454
|
stirlingS2,
|
|
47995
48455
|
string,
|
|
47996
48456
|
stronglyConnectedComponents,
|
|
@@ -48040,6 +48500,7 @@ export {
|
|
|
48040
48500
|
trigExpand,
|
|
48041
48501
|
trigReduce,
|
|
48042
48502
|
trigToExp,
|
|
48503
|
+
trigamma,
|
|
48043
48504
|
tril,
|
|
48044
48505
|
trimmedMean,
|
|
48045
48506
|
triu,
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Number-theory fills — closes gaps left by the existing combinatorics/number-theory
|
|
3
|
+
* surface (`typed/combinatorics.ts`): continued fractions, Euler numbers, the signed
|
|
4
|
+
* Stirling numbers of the first kind, discrete logarithm (BSGS), primitive roots,
|
|
5
|
+
* multiplicative order, the Kronecker symbol, and lexicographic
|
|
6
|
+
* permutation/combination *enumerators* (the existing `permutations`/`combinations`
|
|
7
|
+
* only return counts, not the tuples themselves).
|
|
8
|
+
*
|
|
9
|
+
* Plain exported functions (not `mathTyped` dispatch) — all take/return `number`
|
|
10
|
+
* or generic arrays, matching the style of `descriptive-stats.ts`.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Simple continued fraction expansion `[a0, a1, a2, ...]` of `x`, where
|
|
16
|
+
* `a_i = floor(r)` and `r <- 1 / (r - a_i)`.
|
|
17
|
+
*
|
|
18
|
+
* Stops after `maxTerms` (default 20) or once the fractional part is smaller
|
|
19
|
+
* than `1e-12` (the remaining value is effectively an integer).
|
|
20
|
+
*
|
|
21
|
+
* @param x - The number to expand
|
|
22
|
+
* @param maxTerms - Maximum number of terms to compute (default 20)
|
|
23
|
+
* @returns The sequence of partial-quotient terms
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* continuedFraction(3.245, 5) // => [3, 4, 12, 4, ...]
|
|
27
|
+
*/
|
|
28
|
+
export declare function continuedFraction(x: number, maxTerms?: number): number[];
|
|
29
|
+
/**
|
|
30
|
+
* Euler numbers `E_0..E_n` (the coefficients in the secant Maclaurin series).
|
|
31
|
+
*
|
|
32
|
+
* `E_0 = 1`; all odd-index Euler numbers are 0; for even `m > 0`:
|
|
33
|
+
* `E_m = -sum_{k=0}^{m/2-1} C(m, 2k) * E_{2k}`.
|
|
34
|
+
*
|
|
35
|
+
* @param n - Non-negative integer: compute E_0 through E_n
|
|
36
|
+
* @returns Array of length `n + 1`: `[E_0, E_1, ..., E_n]`
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* eulerNumbers(6) // => [1, 0, -1, 0, 5, 0, -61]
|
|
40
|
+
*/
|
|
41
|
+
export declare function eulerNumbers(n: number): number[];
|
|
42
|
+
/**
|
|
43
|
+
* Signed Stirling number of the first kind `s(n, k)`.
|
|
44
|
+
*
|
|
45
|
+
* Recurrence: `s(n, k) = s(n-1, k-1) - (n-1)*s(n-1, k)`, with `s(0, 0) = 1`
|
|
46
|
+
* and `s(n, 0) = 0` for `n > 0`.
|
|
47
|
+
*
|
|
48
|
+
* @param n - Non-negative integer
|
|
49
|
+
* @param k - Non-negative integer, `0 <= k <= n`
|
|
50
|
+
* @returns The signed Stirling number `s(n, k)`
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* stirlingS1(5, 2) // => -50
|
|
54
|
+
*/
|
|
55
|
+
export declare function stirlingS1(n: number, k: number): number;
|
|
56
|
+
/**
|
|
57
|
+
* Discrete logarithm via baby-step giant-step: the smallest `x >= 0` such
|
|
58
|
+
* that `g^x === h (mod p)`, or `-1` if none exists within `[0, p-1]`.
|
|
59
|
+
*
|
|
60
|
+
* Uses `BigInt` internally for modular exponentiation/inversion to avoid
|
|
61
|
+
* overflow. `m = ceil(sqrt(p-1))` baby steps are stored in a map; the giant
|
|
62
|
+
* steps multiply by `g^(-m) mod p` each round.
|
|
63
|
+
*
|
|
64
|
+
* @param g - Base
|
|
65
|
+
* @param h - Target
|
|
66
|
+
* @param p - Prime modulus
|
|
67
|
+
* @returns The smallest non-negative `x` with `g^x === h (mod p)`, or `-1`
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* discreteLog(2, 3, 5) // => 3 (2^3 = 8 === 3 mod 5)
|
|
71
|
+
*/
|
|
72
|
+
export declare function discreteLog(g: number, h: number, p: number): number;
|
|
73
|
+
/**
|
|
74
|
+
* Smallest primitive root modulo a prime `p`.
|
|
75
|
+
*
|
|
76
|
+
* For each candidate `g = 2, 3, ...`, `g` is a primitive root iff
|
|
77
|
+
* `g^((p-1)/q) !== 1 (mod p)` for every prime factor `q` of `p - 1`.
|
|
78
|
+
*
|
|
79
|
+
* @param p - An odd prime (p = 2 returns 1 trivially)
|
|
80
|
+
* @returns The smallest primitive root modulo p
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* primitiveRoot(7) // => 3
|
|
84
|
+
*/
|
|
85
|
+
export declare function primitiveRoot(p: number): number;
|
|
86
|
+
/**
|
|
87
|
+
* Multiplicative order of `a` modulo `n`: the smallest `k > 0` with
|
|
88
|
+
* `a^k === 1 (mod n)`. Returns `-1` if `gcd(a, n) !== 1` (no order exists).
|
|
89
|
+
*
|
|
90
|
+
* @param a - Integer
|
|
91
|
+
* @param n - Positive integer modulus
|
|
92
|
+
* @returns The multiplicative order, or -1 if undefined
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* multiplicativeOrder(2, 7) // => 3
|
|
96
|
+
*/
|
|
97
|
+
export declare function multiplicativeOrder(a: number, n: number): number;
|
|
98
|
+
/**
|
|
99
|
+
* Kronecker symbol `(a|n)`, generalizing the Jacobi symbol `(a|n)` (odd
|
|
100
|
+
* positive `n`) to all integers `n`.
|
|
101
|
+
*
|
|
102
|
+
* - `(a|0) = 1` if `|a| = 1`, else `0`.
|
|
103
|
+
* - Sign of `n` is extracted first: `(a|-1) = -1` if `a < 0`, else `1`.
|
|
104
|
+
* - Factors of 2 are extracted from `n` using `(a|2)`: `0` if `a` even,
|
|
105
|
+
* `1` if `a === ±1 (mod 8)`, `-1` if `a === ±3 (mod 8)`.
|
|
106
|
+
* - The remaining odd part is evaluated via the standard Jacobi reciprocity
|
|
107
|
+
* recursion.
|
|
108
|
+
*
|
|
109
|
+
* @param a - Integer
|
|
110
|
+
* @param n - Integer
|
|
111
|
+
* @returns -1, 0, or 1
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* kroneckerSymbol(2, 3) // => -1
|
|
115
|
+
*/
|
|
116
|
+
export declare function kroneckerSymbol(a: number, n: number): number;
|
|
117
|
+
/**
|
|
118
|
+
* Enumerate all length-`k` combinations of `arr` (index-order subsequences,
|
|
119
|
+
* i.e. lexicographic order for a sorted input) as an array of tuples.
|
|
120
|
+
*
|
|
121
|
+
* @param arr - Source array
|
|
122
|
+
* @param k - Combination length
|
|
123
|
+
* @returns All `C(arr.length, k)` combinations, in lexicographic order
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* combinationsGen([1, 2, 3], 2) // => [[1,2],[1,3],[2,3]]
|
|
127
|
+
*/
|
|
128
|
+
export declare function combinationsGen<T>(arr: readonly T[], k: number): T[][];
|
|
129
|
+
/**
|
|
130
|
+
* Enumerate all length-`k` permutations (ordered arrangements) of `arr`
|
|
131
|
+
* as an array of tuples, in lexicographic order of index selection.
|
|
132
|
+
* `k` defaults to `arr.length` (full permutations).
|
|
133
|
+
*
|
|
134
|
+
* @param arr - Source array
|
|
135
|
+
* @param k - Permutation length (default: `arr.length`)
|
|
136
|
+
* @returns All `n! / (n-k)!` permutations, in lexicographic order
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* permutationsGen([1, 2, 3], 2) // => 6 tuples: [1,2],[1,3],[2,1],[2,3],[3,1],[3,2]
|
|
140
|
+
*/
|
|
141
|
+
export declare function permutationsGen<T>(arr: readonly T[], k?: number): T[][];
|
|
142
|
+
//# sourceMappingURL=extra.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extra.d.ts","sourceRoot":"","sources":["../../src/numbertheory/extra.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,SAAK,GAAG,MAAM,EAAE,CAcpE;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBhD;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAevD;AAqCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA+BnE;AAoBD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAmB/C;AAeD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAehE;AAaD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA0C5D;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAoBtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,GAAE,MAAmB,GAAG,CAAC,EAAE,EAAE,CAwBnF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gauss-Legendre quadrature nodes and weights.
|
|
3
|
+
*
|
|
4
|
+
* `rootsLegendre(n)` finds the n roots of the degree-n Legendre polynomial
|
|
5
|
+
* P_n via Newton's method (initial guess from the standard asymptotic
|
|
6
|
+
* approximation), then derives the corresponding quadrature weights. This is
|
|
7
|
+
* the classical fixed-node table underlying Gauss-Legendre quadrature on
|
|
8
|
+
* [-1, 1]; callers needing a custom node count (rather than the library's
|
|
9
|
+
* built-in fixed-order `integrate`/`gaussLegendre` routines) use this
|
|
10
|
+
* directly.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
/** Result of {@link rootsLegendre}: nodes ascending on [-1, 1] with matching weights. */
|
|
15
|
+
export interface RootsLegendreResult {
|
|
16
|
+
nodes: number[];
|
|
17
|
+
weights: number[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* n-point Gauss-Legendre quadrature nodes and weights on [-1, 1].
|
|
21
|
+
*
|
|
22
|
+
* Nodes are the roots of the degree-n Legendre polynomial P_n, refined by
|
|
23
|
+
* Newton's method from the standard asymptotic initial guess
|
|
24
|
+
* `cos(pi*(i+0.75)/(n+0.5))`. Weights are `2 / ((1-x_i^2) * P'_n(x_i)^2)`.
|
|
25
|
+
*
|
|
26
|
+
* @param n - Number of quadrature points (positive integer)
|
|
27
|
+
* @returns Nodes (ascending) and matching weights
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* rootsLegendre(3)
|
|
31
|
+
* // { nodes: [-0.7745966692, 0, 0.7745966692],
|
|
32
|
+
* // weights: [0.5555555556, 0.8888888889, 0.5555555556] }
|
|
33
|
+
*/
|
|
34
|
+
export declare function rootsLegendre(n: number): RootsLegendreResult;
|
|
35
|
+
//# sourceMappingURL=gauss-nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gauss-nodes.d.ts","sourceRoot":"","sources":["../../src/numeric/gauss-nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,yFAAyF;AACzF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAuBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,mBAAmB,CA+B5D"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hypergeometric functions.
|
|
3
|
+
*
|
|
4
|
+
* Implements the generalized hypergeometric series pFq via the ascending
|
|
5
|
+
* Pochhammer-ratio method: each term is generated from the previous one by
|
|
6
|
+
* multiplying by the ratio of rising factorials,
|
|
7
|
+
*
|
|
8
|
+
* term_{n+1} / term_n = ( prod_i (a_i + n) / prod_j (b_j + n) ) * z / (n + 1)
|
|
9
|
+
*
|
|
10
|
+
* accumulating until the term becomes negligible relative to the running sum
|
|
11
|
+
* (|term| < 1e-16 * |sum|) or a hard iteration cap is hit. This incremental
|
|
12
|
+
* form avoids recomputing factorials/Pochhammer symbols from scratch at each
|
|
13
|
+
* order and is numerically well-behaved for the convergent regimes documented
|
|
14
|
+
* per function below.
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Generalized hypergeometric function pFq(a; b; z), computed via the
|
|
20
|
+
* ascending Pochhammer-ratio series:
|
|
21
|
+
*
|
|
22
|
+
* pFq(a_1..a_p; b_1..b_q; z) = sum_{n=0}^inf
|
|
23
|
+
* ( prod_i (a_i)_n / prod_j (b_j)_n ) * z^n / n!
|
|
24
|
+
*
|
|
25
|
+
* This is the generic engine that hyp0f1/hyp1f1/hyp2f1 delegate to. No
|
|
26
|
+
* convergence-region check is performed here (that is the caller's
|
|
27
|
+
* responsibility, see hyp2f1's |z| < 1 guard) — the series is simply summed
|
|
28
|
+
* until it converges to machine precision or MAX_TERMS is reached.
|
|
29
|
+
*
|
|
30
|
+
* @param a - Upper (numerator) parameters
|
|
31
|
+
* @param b - Lower (denominator) parameters
|
|
32
|
+
* @param z - Argument
|
|
33
|
+
* @returns pFq(a; b; z)
|
|
34
|
+
*/
|
|
35
|
+
export declare function pFq(a: number[], b: number[], z: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Confluent hypergeometric limit function 0F1(; b; z):
|
|
38
|
+
*
|
|
39
|
+
* hyp0f1(b, z) = sum_{n=0}^inf z^n / ((b)_n n!)
|
|
40
|
+
*
|
|
41
|
+
* Entire in z (converges for all finite z, real or otherwise real-valued
|
|
42
|
+
* here); related to the Bessel functions.
|
|
43
|
+
*
|
|
44
|
+
* @param b - Parameter
|
|
45
|
+
* @param z - Argument
|
|
46
|
+
* @returns 0F1(; b; z)
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* hyp0f1(2, 0.5) // ~1.2717234563
|
|
50
|
+
*/
|
|
51
|
+
export declare function hyp0f1(b: number, z: number): number;
|
|
52
|
+
/**
|
|
53
|
+
* Kummer's confluent hypergeometric function 1F1(a; b; z) (Kummer's M):
|
|
54
|
+
*
|
|
55
|
+
* hyp1f1(a, b, z) = sum_{n=0}^inf ( (a)_n / (b)_n ) * z^n / n!
|
|
56
|
+
*
|
|
57
|
+
* Entire in z. The direct ascending series targets moderate |z| — for large
|
|
58
|
+
* |z| the series requires many terms and loses accuracy to cancellation
|
|
59
|
+
* (particularly when a and b have opposite signs); an asymptotic expansion
|
|
60
|
+
* would be needed for large |z| but is not implemented here.
|
|
61
|
+
*
|
|
62
|
+
* @param a - Numerator parameter
|
|
63
|
+
* @param b - Denominator parameter
|
|
64
|
+
* @param z - Argument
|
|
65
|
+
* @returns 1F1(a; b; z)
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* hyp1f1(1, 2, 0.5) // ~1.2974425414
|
|
69
|
+
*/
|
|
70
|
+
export declare function hyp1f1(a: number, b: number, z: number): number;
|
|
71
|
+
/**
|
|
72
|
+
* Gauss's hypergeometric function 2F1(a, b; c; z):
|
|
73
|
+
*
|
|
74
|
+
* hyp2f1(a, b, c, z) = sum_{n=0}^inf ( (a)_n (b)_n / (c)_n ) * z^n / n!
|
|
75
|
+
*
|
|
76
|
+
* The ascending series converges only for |z| < 1. Analytic continuation
|
|
77
|
+
* beyond the unit disk (e.g. via connection formulas or a transformation to
|
|
78
|
+
* 1-z) is not yet implemented.
|
|
79
|
+
*
|
|
80
|
+
* @param a - First numerator parameter
|
|
81
|
+
* @param b - Second numerator parameter
|
|
82
|
+
* @param c - Denominator parameter
|
|
83
|
+
* @param z - Argument, must satisfy |z| < 1
|
|
84
|
+
* @returns 2F1(a, b; c; z)
|
|
85
|
+
* @throws {Error} If |z| >= 1
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* hyp2f1(1, 2, 3, 0.5) // ~1.5451774445
|
|
89
|
+
*/
|
|
90
|
+
export declare function hyp2f1(a: number, b: number, c: number, z: number): number;
|
|
91
|
+
//# sourceMappingURL=hypergeometric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hypergeometric.d.ts","sourceRoot":"","sources":["../../src/special/hypergeometric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAgB/D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAKzE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jacobi elliptic functions sn, cn, dn.
|
|
3
|
+
*
|
|
4
|
+
* Uses the parameter convention `m = k^2` (matching scipy's
|
|
5
|
+
* `scipy.special.ellipj(u, m)` and mpmath's `ellipfun(..., u, m)`), not the
|
|
6
|
+
* modulus-angle convention some texts use.
|
|
7
|
+
*
|
|
8
|
+
* Computed via the descending Landen transformation / arithmetic-geometric
|
|
9
|
+
* mean (AGM) method (Abramowitz & Stegun 16.4, the Bulirsch algorithm):
|
|
10
|
+
* build the AGM sequences
|
|
11
|
+
*
|
|
12
|
+
* a_0 = 1, b_0 = sqrt(1 - m), c_0 = sqrt(m)
|
|
13
|
+
* a_{i+1} = (a_i + b_i) / 2
|
|
14
|
+
* b_{i+1} = sqrt(a_i * b_i)
|
|
15
|
+
* c_{i+1} = (a_i - b_i) / 2
|
|
16
|
+
*
|
|
17
|
+
* until c_N is negligible, then descend the amplitude
|
|
18
|
+
*
|
|
19
|
+
* phi_N = 2^N * a_N * u
|
|
20
|
+
* phi_{i-1} = (phi_i + asin((c_i / a_i) * sin(phi_i))) / 2 for i = N..1
|
|
21
|
+
*
|
|
22
|
+
* so that sn(u,m) = sin(phi_0), cn(u,m) = cos(phi_0),
|
|
23
|
+
* dn(u,m) = sqrt(1 - m * sn^2(u,m)).
|
|
24
|
+
*
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Jacobi elliptic function sn(u, m), parameter convention m = k^2.
|
|
29
|
+
*
|
|
30
|
+
* @param u - Argument
|
|
31
|
+
* @param m - Parameter m = k^2, must be in [0, 1]
|
|
32
|
+
* @returns sn(u, m)
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* jacobiSN(0.5, 0.3) // ~0.4742156227
|
|
36
|
+
*/
|
|
37
|
+
export declare function jacobiSN(u: number, m: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* Jacobi elliptic function cn(u, m), parameter convention m = k^2.
|
|
40
|
+
*
|
|
41
|
+
* @param u - Argument
|
|
42
|
+
* @param m - Parameter m = k^2, must be in [0, 1]
|
|
43
|
+
* @returns cn(u, m)
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* jacobiCN(0.5, 0.3) // ~0.8804087364
|
|
47
|
+
*/
|
|
48
|
+
export declare function jacobiCN(u: number, m: number): number;
|
|
49
|
+
/**
|
|
50
|
+
* Jacobi elliptic function dn(u, m), parameter convention m = k^2.
|
|
51
|
+
*
|
|
52
|
+
* @param u - Argument
|
|
53
|
+
* @param m - Parameter m = k^2, must be in [0, 1]
|
|
54
|
+
* @returns dn(u, m)
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* jacobiDN(0.5, 0.3) // ~0.9656789647
|
|
58
|
+
*/
|
|
59
|
+
export declare function jacobiDN(u: number, m: number): number;
|
|
60
|
+
//# sourceMappingURL=jacobi-elliptic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jacobi-elliptic.d.ts","sourceRoot":"","sources":["../../src/special/jacobi-elliptic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAwDH;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polygamma functions and classical orthogonal polynomials.
|
|
3
|
+
*
|
|
4
|
+
* `polygamma(n, x)` is the n-th derivative of the digamma function,
|
|
5
|
+
* ψ^(n)(x) = d^n/dx^n ψ(x). It is computed by shifting the argument up via
|
|
6
|
+
* the standard recurrence
|
|
7
|
+
*
|
|
8
|
+
* ψ^(n)(x) = ψ^(n)(x + m) + (-1)^(n+1) n! * sum_{k=0}^{m-1} 1/(x+k)^(n+1)
|
|
9
|
+
*
|
|
10
|
+
* until x + m is large enough (>= SHIFT_THRESHOLD) for the asymptotic
|
|
11
|
+
* (Bernoulli) expansion (DLMF 5.15.8) to converge to machine precision:
|
|
12
|
+
*
|
|
13
|
+
* psi^(n)(X) ~ (-1)^(n-1) * [ (n-1)!/X^n + n!/(2 X^(n+1))
|
|
14
|
+
* + sum_j B_{2j} * (2j+n-1)! / ((2j)! * X^(2j+n)) ]
|
|
15
|
+
*
|
|
16
|
+
* Since (-1)^(n+1) = (-1)^(n-1), both pieces share the same overall sign.
|
|
17
|
+
*
|
|
18
|
+
* `jacobiP` and `gegenbauerC` are evaluated with their standard stable
|
|
19
|
+
* three-term recurrences (DLMF 18.9.2 and 18.9.1 respectively), matching the
|
|
20
|
+
* pattern already used for `chebyshevT` / `hermiteH` / `laguerreL` /
|
|
21
|
+
* `legendreP`.
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Polygamma function ψ^(n)(x): the n-th derivative of the digamma function.
|
|
27
|
+
*
|
|
28
|
+
* `polygamma(0, x)` delegates to `digamma(x)`. For `n >= 1`, x is shifted up
|
|
29
|
+
* via the standard recurrence until it is large enough for the Bernoulli
|
|
30
|
+
* asymptotic expansion to converge.
|
|
31
|
+
*
|
|
32
|
+
* @param n - Derivative order (nonnegative integer)
|
|
33
|
+
* @param x - Argument (must not be a nonpositive integer, where ψ^(n) has poles)
|
|
34
|
+
* @returns ψ^(n)(x)
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* polygamma(1, 2) // ~0.6449340668 (trigamma(2))
|
|
38
|
+
* polygamma(2, 1) // ~-2.4041138063
|
|
39
|
+
*/
|
|
40
|
+
export declare function polygamma(n: number, x: number): number;
|
|
41
|
+
/**
|
|
42
|
+
* Trigamma function ψ'(x) = ψ^(1)(x): the first derivative of the digamma
|
|
43
|
+
* function. Equivalent to `polygamma(1, x)`.
|
|
44
|
+
*
|
|
45
|
+
* @param x - Argument
|
|
46
|
+
* @returns ψ'(x)
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* trigamma(2) // ~0.6449340668 (= zeta(2) - 1 = pi^2/6 - 1)
|
|
50
|
+
*/
|
|
51
|
+
export declare function trigamma(x: number): number;
|
|
52
|
+
/**
|
|
53
|
+
* Jacobi polynomial P_n^(alpha,beta)(x), evaluated via the standard
|
|
54
|
+
* three-term recurrence (DLMF 18.9.2).
|
|
55
|
+
*
|
|
56
|
+
* @param n - Degree (nonnegative integer)
|
|
57
|
+
* @param alpha - Parameter alpha (> -1)
|
|
58
|
+
* @param beta - Parameter beta (> -1)
|
|
59
|
+
* @param x - Evaluation point
|
|
60
|
+
* @returns P_n^(alpha,beta)(x)
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* jacobiP(2, 1, 1, 0.5) // 0.1875
|
|
64
|
+
*/
|
|
65
|
+
export declare function jacobiP(n: number, alpha: number, beta: number, x: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Gegenbauer (ultraspherical) polynomial C_n^(alpha)(x), evaluated via the
|
|
68
|
+
* standard three-term recurrence (DLMF 18.9.1).
|
|
69
|
+
*
|
|
70
|
+
* @param n - Degree (nonnegative integer)
|
|
71
|
+
* @param alpha - Parameter alpha (> -1/2, alpha != 0)
|
|
72
|
+
* @param x - Evaluation point
|
|
73
|
+
* @returns C_n^(alpha)(x)
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* gegenbauerC(2, 1, 1) // 3 (C_2^(1)(x) = 4x^2 - 1)
|
|
77
|
+
*/
|
|
78
|
+
export declare function gegenbauerC(n: number, alpha: number, x: number): number;
|
|
79
|
+
//# sourceMappingURL=polygamma-orthopoly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygamma-orthopoly.d.ts","sourceRoot":"","sources":["../../src/special/polygamma-orthopoly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAiBH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAkCtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAqBjF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAgBvE"}
|
package/package.json
CHANGED