pub struct TrapezoidalIntegrationEngine { /* private fields */ }Expand description
The composite trapezoid rule: ∫ₐᵇ f ≈ h [½ f(x₀) + f(x₁) + ⋯ + f(xₙ₋₂) + ½ f(xₙ₋₁)] on
n equally spaced points xᵢ = a + i h, h = (b − a)/(n − 1).
Second order (the rule minus the integral is (b − a) h² f''(ξ) / 12) and exact for straight lines. For smooth
periodic integrands over a whole period it converges exponentially fast.
Implementations§
Source§impl TrapezoidalIntegrationEngine
impl TrapezoidalIntegrationEngine
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]. 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 TrapezoidalIntegrationEngine
impl RefUnwindSafe for TrapezoidalIntegrationEngine
impl Send for TrapezoidalIntegrationEngine
impl Sync for TrapezoidalIntegrationEngine
impl Unpin for TrapezoidalIntegrationEngine
impl UnsafeUnpin for TrapezoidalIntegrationEngine
impl UnwindSafe for TrapezoidalIntegrationEngine
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