Skip to main content

Module quadrature

Module quadrature 

Source
Expand description

integrate: adaptive Gauss–Kronrod quadrature of a vector-valued function over an interval, in Scalars.

What it returns is an enclosure in two parts, and the two have different standing:

  • The rule’s own value is enclosed. Every node and weight of the 7-point Gauss / 15-point Kronrod pair is taken as the interval between the two f64s around its tabulated value, so it contains the exact node and weight, and the integrand is evaluated in interval arithmetic at those intervals. The sum therefore encloses what the exact rule gives for the integrand — rounding, and any width the integrand’s own data carries, included.
  • The rule’s truncation error is estimated, not proven. It is the difference between the Kronrod and the Gauss value of each panel: the standard estimate, which for a smooth integrand vastly overestimates the Kronrod value’s error (that is what makes it a usable bound in practice), but which a rigorous enclosure would replace by a bound on a high derivative of the integrand — something a NURBS integrand over a trimmed domain does not offer cheaply. The result is widened by it, so that width states how well the integral is known; it is honest about being an estimate in Integral::converged and in the docs of every caller, rather than claiming to be proven.

Quadrature’s tolerance and panel budget only decide how hard the search tries: a tighter tolerance gives a narrower result, and a budget run out gives a wider one, never a different answer.

integrate_polynomial is for an integrand known to be a polynomial of bounded degree on every panel. There the Gauss–Legendre rule of enough points is exact, so there is no truncation error to estimate, no halving, and the enclosure is the rule’s value alone — proven, and from a fifth of the evaluations a 15-point panel takes.

Structs§

Integral
An integral, as integrate finds it.
Quadrature
How hard integrate tries: until every component’s estimated error is below relative_tolerance times the integral of its absolute value, or until it has split the interval into max_panels panels.

Constants§

MAX_POLYNOMIAL_DEGREE
The highest degree of a polynomial integrate_polynomial integrates.

Functions§

integrate
The integral of the components-valued f from breaks[0] to the last of breaks, each consecutive pair a panel to start with — where the integrand is not smooth, say, at the knots of a spline.
integrate_polynomial
The integral of the components-valued f from breaks[0] to the last of breaks, where f is a polynomial of degree at most degree between every two consecutive breaks — a spline, say, split at its knots.