Skip to main content

integrate_polynomial

Function integrate_polynomial 

Source
pub fn integrate_polynomial(
    f: impl FnMut(Scalar) -> GeopResult<Vec<Scalar>>,
    breaks: &[Scalar],
    components: usize,
    degree: usize,
) -> GeopResult<Integral>
Expand description

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.

The Gauss–Legendre rule of degree / 2 + 1 points is exact for such an f, so the result is the rule’s value, enclosed in interval arithmetic, and nothing else: no truncation error, always converged. Whether f is such a polynomial is the caller’s claim to make, from what f is; a degree above MAX_POLYNOMIAL_DEGREE is an error.