Skip to main content

integrate_2d

Function integrate_2d 

Source
pub fn integrate_2d<F: FnMut(f64, f64) -> f64>(
    f: F,
    u: (f64, f64),
    v: (f64, f64),
    tolerance: f64,
) -> OgeomResult<f64>
Expand description

Integrate f(u, v) over the rectangle [a, b] x [c, d] to an absolute tolerance: a patch’s area, its moments, anything spread over a chart.

The Gauss–Kronrod pair in tensor form: one pass over a cell is fifteen by fifteen evaluations and yields the Kronrod estimate and, from the same values, the estimate with the Gauss rule in u and the one with it in v, each gap the error owed to that direction. A cell whose worse gap is inside its budget is done; one whose is not is halved along the rougher direction, each half given half the budget, so the cells’ errors sum to the whole’s and a ridge running across the chart (a crease in an integrand, a seam) costs a line of cells rather than a field of them.

§Errors

OgeomError::Domain if a bound is not finite or the tolerance is not positive; OgeomError::NotDone if some cell did not converge within the depth limit.