pub struct Integrator { /* private fields */ }Expand description
Numerical integration configuration.
Implementations§
Source§impl Integrator
impl Integrator
Sourcepub const fn new(subintervals: usize) -> Integrator
pub const fn new(subintervals: usize) -> Integrator
Creates an integrator from a subinterval count.
Sourcepub fn try_new(subintervals: usize) -> Result<Integrator, CalculusError>
pub fn try_new(subintervals: usize) -> Result<Integrator, CalculusError>
Creates an integrator from a positive subinterval count.
§Errors
Returns CalculusError::ZeroSubintervals when subintervals == 0.
Sourcepub fn validate(self) -> Result<Integrator, CalculusError>
pub fn validate(self) -> Result<Integrator, CalculusError>
Validates that the stored subinterval count is positive.
§Errors
Returns the same error variants as Self::try_new.
Sourcepub const fn subintervals(&self) -> usize
pub const fn subintervals(&self) -> usize
Returns the stored subinterval count.
Sourcepub fn trapezoidal<F>(
self,
function: F,
interval: IntegrationInterval,
) -> Result<f64, CalculusError>
pub fn trapezoidal<F>( self, function: F, interval: IntegrationInterval, ) -> Result<f64, CalculusError>
Approximates a definite integral with the trapezoidal rule.
§Errors
Returns CalculusError when the interval or subinterval count is
invalid, or when sampled evaluations are not finite.
Sourcepub fn simpson<F>(
self,
function: F,
interval: IntegrationInterval,
) -> Result<f64, CalculusError>
pub fn simpson<F>( self, function: F, interval: IntegrationInterval, ) -> Result<f64, CalculusError>
Approximates a definite integral with Simpson’s rule.
§Errors
Returns CalculusError when the interval or subinterval count is
invalid, when an odd number of subintervals is used, or when sampled
evaluations are not finite.
Trait Implementations§
Source§impl Clone for Integrator
impl Clone for Integrator
Source§fn clone(&self) -> Integrator
fn clone(&self) -> Integrator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Integrator
impl Debug for Integrator
Source§impl PartialEq for Integrator
impl PartialEq for Integrator
Source§fn eq(&self, other: &Integrator) -> bool
fn eq(&self, other: &Integrator) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for Integrator
impl Eq for Integrator
impl StructuralPartialEq for Integrator
Auto Trait Implementations§
impl Freeze for Integrator
impl RefUnwindSafe for Integrator
impl Send for Integrator
impl Sync for Integrator
impl Unpin for Integrator
impl UnsafeUnpin for Integrator
impl UnwindSafe for Integrator
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