/** * Canonical special-function scalar implementations. * * Single source of truth for the special-function scalars that are needed by * BOTH the typed dispatch surface (`functions/src/typed/special.ts`) and the * WASM dispatch bridge JS fallbacks (`functions/src/wasm/special/wasm-bridge.ts`). * Previously each of these scalars existed in two near-identical copies, so a * numeric fix to one could silently diverge `f(x)` (scalar / sub-threshold path) * from `f([x])` (≥-threshold WASM-fallback path). They now live here once. * * Serialization invariant (do NOT regress): * Every function in this module is a standalone declaration that references * ONLY `Math.*`, its own arguments, and the other functions in this module. * It must NOT reference module-level constants or imports. This is required * because `typed/special.ts` serializes these into self-contained worker * kernels via `Function.prototype.toString()` (the worker `eval`s the text in * an isolated context — see `kernelSource` / `packages/workerpool/src/worker.ts`). * Numeric constants are therefore inlined as literals: * Euler-gamma 0.5772156649015328606, 2/pi 0.63661977236758134308, * 1/pi 0.31830988618379067154, Bessel series/asymptotic split |x| = 13. * * @packageDocumentation */ /** 64-bit float (default for decimals) */ type f64 = number; /** * Log-gamma function using Lanczos approximation (g=7, n=9). * Poles at non-positive integers return +Infinity; negative non-integers use * the reflection formula. */ export declare function _lgamma(x: f64): f64; /** * Return the Hankel asymptotic value of the Bessel function J or Y of order `nu`. * * The series stops after 40 terms, or earlier when the terms start to grow. The scalar * Bessel functions use this value for arguments above 13, and the ascending series otherwise. * * @param nu - The order, 0 or 1. * @param x - The argument. * @param wantY - If true, return Y; if false, return J. */ export declare function besselHankel(nu: f64, x: f64, wantY: boolean): f64; /** * Return the Bessel function J0(x) from its ascending power series. * * The series stops after 80 terms, or earlier when a term is small relative to the sum. */ export declare function besselJ0Series(x: f64): f64; /** * Return the Bessel function J1(x) from its ascending power series. * * The series stops after 80 terms, or earlier when a term is small relative to the sum. */ export declare function besselJ1Series(x: f64): f64; /** Return the Bessel function Y0(x) from its ascending series. Use it for positive `x`. */ export declare function besselY0Series(x: f64): f64; /** Return the Bessel function Y1(x) from its ascending series. Use it for positive `x`. */ export declare function besselY1Series(x: f64): f64; /** Bessel function of the first kind, order 0: J0(x). */ export declare function besselJ0Scalar(x: f64): f64; /** Bessel function of the first kind, order 1: J1(x). */ export declare function besselJ1Scalar(x: f64): f64; /** Bessel function of the second kind, order 0: Y0(x). */ export declare function besselY0Scalar(x: f64): f64; /** Bessel function of the second kind, order 1: Y1(x). */ export declare function besselY1Scalar(x: f64): f64; /** Bessel function of the first kind, general integer order n: J_n(x). */ export declare function besselJScalar(n: f64, x: f64): f64; /** * Bessel function of the second kind, general integer order n: Y_n(x). * * Negative orders use the parity identity Y_{-n}(x) = (-1)^n Y_n(x). (The * earlier `typed/special.ts` copy omitted this and returned Y_1 for any * negative order; the WASM-bridge fallback copy applied it. Reconciled here to * the mathematically correct form so the scalar and array paths agree.) */ export declare function besselYScalar(n: f64, x: f64): f64; /** Complete elliptic integral of the first kind K(m) via AGM. */ export declare function ellipticKScalar(m: f64): f64; /** Complete elliptic integral of the second kind E(m) via Carlson-Bulirsch AGM. */ export declare function ellipticECompleteScalar(m: f64): f64; /** * Airy asymptotic coefficients u_k (DLMF 9.7.2): * u_0 = 1, u_k = u_{k-1} (6k-5)(6k-3)(6k-1) / ((2k-1) · 216 · k). * A function (not a module const) so it stays self-contained when serialized * into a worker kernel. */ export declare function airyUCoeffs(): number[]; /** * Evaluate the two alternating asymptotic sums used by Ai(-z)/Bi(-z): * P(ζ) = Σ_k (-1)^k u_{2k} / ζ^{2k} (even-index coefficients) * Q(ζ) = Σ_k (-1)^k u_{2k+1} / ζ^{2k+1} (odd-index coefficients) * Both series are divergent — each is summed only to its smallest term. */ export declare function airyAsymPQ(zeta: f64): { p: f64; q: f64; }; /** Airy function of the first kind Ai(x). */ export declare function airyAiScalar(x: f64): f64; /** Airy function of the second kind Bi(x). */ export declare function airyBiScalar(x: f64): f64; /** Factorial of a non-negative integer. */ export declare function factorial(n: number): number; /** Beta function B(a, b) = Gamma(a) Gamma(b) / Gamma(a + b). */ export declare function betaScalar(a: f64, b: f64): f64; /** Regularized lower incomplete gamma function P(a, x). */ export declare function gammaincScalar(a: f64, x: f64): f64; /** Upper regularized incomplete gamma Q(a, x) = 1 - P(a, x). */ export declare function gammaincpScalar(a: f64, x: f64): f64; /** Regularized incomplete beta function I_x(a, b). */ export declare function betaincScalar(a: f64, b: f64, x: f64): f64; /** Modified Bessel function of the first kind, I_n(x). */ export declare function besselIScalar(n: f64, x: f64): f64; export {}; //# sourceMappingURL=scalars.d.ts.map