/** * Adaptive Gauss-Kronrod (G7-K15) quadrature. * * QUADPACK-style adaptive numerical integration: on each subinterval, a * 15-point Kronrod estimate `K` is compared against the embedded 7-point * Gauss estimate `G` (both reuse the same 15 evaluation points, so `G` is * "free" once `K` is computed). `|K - G|` is the panel's error estimate; if * it exceeds tolerance the interval is bisected and each half is refined * recursively. This adapts naturally to endpoint singularities and peaked * integrands, unlike a fixed-order Gauss-Legendre rule (see `gaussLegendre5` * in `../typed/numeric.ts`, whose Richardson-extrapolation adaptivity still * converges slowly on e.g. `x^-1/2` near 0). * * @packageDocumentation */ type f64 = number; type i32 = number; /** Options for {@link quad}. */ export interface QuadOptions { /** Relative tolerance on each panel's `|K - G|` vs `|K|` (default 1e-10). */ tol?: f64; /** Maximum bisection recursion depth per panel (default 50). */ maxDepth?: i32; } /** Result of {@link quad}. */ export interface QuadResult { /** The estimated integral. */ value: f64; /** Sum of the absolute per-panel `|K - G|` error estimates. */ error: f64; } /** * Adaptive Gauss-Kronrod (G7-K15) numerical integration of `f` over `[a, b]`. * * Each subinterval is evaluated with the 15-point Kronrod rule and its * embedded 7-point Gauss rule; `|K - G|` is the panel's error estimate. A * panel whose error exceeds `tol * |K|` (or the absolute floor, for panels * near zero) is bisected and each half refined recursively, up to * `maxDepth`. This adapts naturally to endpoint singularities and sharply * peaked integrands. * * @param f - Function to integrate * @param a - Lower bound * @param b - Upper bound * @param opts - Options (tol, maxDepth) * @returns `{ value, error }` — the estimated integral and summed panel error * * @example * ```typescript * quad((x) => 4 / (1 + x * x), 0, 1).value; // ~pi * quad((x) => 1 / Math.sqrt(x), 0, 1).value; // ~2, despite the endpoint singularity * ``` */ export declare function quad(f: (x: f64) => f64, a: f64, b: f64, opts?: QuadOptions): QuadResult; export {}; //# sourceMappingURL=adaptive-quad.d.ts.map