pub struct MidpointIntegrationEngine { /* private fields */ }Expand description
The composite midpoint rule: ∫ₐᵇ f ≈ h Σ f(a + (i + ½) h) over n panels of width
h = (b − a)/n, sampling f at the centre of each panel.
Second order (the rule minus the integral is −(b − a) h² f''(ξ) / 24: half the trapezoid
rule’s error, with the opposite sign), exact for straight lines, and open: it never evaluates f at the endpoints, so it
tolerates integrable endpoint singularities (slowly).
Implementations§
Source§impl MidpointIntegrationEngine
impl MidpointIntegrationEngine
Sourcepub fn new(
number_of_points: usize,
lower_bound: f64,
upper_bound: f64,
cache_x_points: bool,
) -> Self
pub fn new( number_of_points: usize, lower_bound: f64, upper_bound: f64, cache_x_points: bool, ) -> Self
An engine using number_of_points samples on [lower_bound, upper_bound] (the number of panels). With
cache_x_points, the sample points are computed once and reused by every call to
integrate.
Sourcepub fn set_number_of_points(&mut self, x: usize)
pub fn set_number_of_points(&mut self, x: usize)
Changes the number of samples (refreshing the cache, if enabled).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MidpointIntegrationEngine
impl RefUnwindSafe for MidpointIntegrationEngine
impl Send for MidpointIntegrationEngine
impl Sync for MidpointIntegrationEngine
impl Unpin for MidpointIntegrationEngine
impl UnsafeUnpin for MidpointIntegrationEngine
impl UnwindSafe for MidpointIntegrationEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more