Skip to main content

sample_enclosure

Function sample_enclosure 

Source
pub fn sample_enclosure(
    f: impl Fn(f64) -> f64,
    a: Interval,
    n: usize,
) -> Interval
Expand description

Returns a tighter interval bound for f on [a.lo, a.hi] by evaluating at n equally-spaced sample points and taking their hull.

This is a purely rigorous-sampling approach — it gives an inner bound (the true enclosure is at least as wide), but is useful for comparison or for functions where monotonicity is hard to determine analytically.