Module quad

Source
Expand description

Numerical integration of a scalar function over a finite interval.

  • integrate: globally adaptive Gauss-Kronrod (7-point Gauss inside a 15-point Kronrod rule), as QUADPACK qag (Piessens et al., 1983) and OCCT math_KronrodSingleIntegration. The panel with the largest error estimate is bisected until the total estimate meets the tolerance. No node lies on a panel end, so integrable endpoint singularities (x^-1/2, ln x) are handled by refinement toward them.
  • GaussLegendre: a fixed n-point rule, exact for polynomials of degree 2n - 1, for callers that assemble their own integrals (energy terms over spline spans) and know the integrand’s degree.

The error estimate is QUADPACK’s: per panel |K15 - G7|, rescaled by the integrand’s variation and floored at the rounding level. It is an estimate, not a proof, and is conservative on smooth integrands; the tests check it against the true error on closed forms, including endpoint singularities.

Structs§

GaussLegendre
An n-point Gauss-Legendre rule on [-1, 1].
Integral
The value of an integral and how far it can be trusted.
IntegrationOptions
Accuracy request and budget for integrate.

Functions§

integrate
Integrate f over [lower, upper] by adaptive Gauss-Kronrod (G7/K15).