Struct Integrator
pub struct Integrator { /* private fields */ }Expand description
Numerical integration configuration.
Implementations§
§impl Integrator
impl Integrator
pub const fn new(subintervals: usize) -> Integrator
pub const fn new(subintervals: usize) -> Integrator
Creates an integrator from a subinterval count.
pub 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.
pub 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.
pub const fn subintervals(&self) -> usize
pub const fn subintervals(&self) -> usize
Returns the stored subinterval count.
pub 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.
pub 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§
§impl Clone for Integrator
impl Clone for Integrator
§fn clone(&self) -> Integrator
fn clone(&self) -> Integrator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for Integrator
impl Debug for Integrator
§impl PartialEq for Integrator
impl PartialEq for Integrator
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