Skip to main content

midpoint_rule

Function midpoint_rule 

Source
pub fn midpoint_rule<F>(
    integrand: F,
    lower_bound: f64,
    upper_bound: f64,
    subinterval_count: usize,
) -> Option<f64>
where F: Fn(f64) -> f64,
Expand description

Approximates an integral with the midpoint rule.

Returns None when n == 0, when the bounds are not finite, or when a sampled function value is not finite. Reversed bounds return the negative integral.