Skip to main content

LimitApproximator

Struct LimitApproximator 

pub struct LimitApproximator { /* private fields */ }
Expand description

Symmetric two-sided limit approximation settings.

Implementations§

§

impl LimitApproximator

pub const fn new(step: f64, tolerance: f64) -> LimitApproximator

Creates a limit approximator from a sample step and comparison tolerance.

pub fn try_new( step: f64, tolerance: f64, ) -> Result<LimitApproximator, CalculusError>

Creates a limit approximator from a finite positive step and a finite non-negative tolerance.

§Errors

Returns CalculusError::NonFiniteStep or CalculusError::NonPositiveStep when step is invalid, and returns CalculusError::NonFiniteTolerance or CalculusError::NegativeTolerance when tolerance is invalid.

pub fn validate(self) -> Result<LimitApproximator, CalculusError>

Validates that the stored step and tolerance are acceptable.

§Errors

Returns the same error variants as Self::try_new.

pub const fn step(&self) -> f64

Returns the symmetric sample step.

pub const fn tolerance(&self) -> f64

Returns the acceptance tolerance between the left and right samples.

pub fn at<F>(self, function: F, at: f64) -> Result<f64, CalculusError>
where F: FnMut(f64) -> f64,

Approximates a two-sided limit at at using one symmetric sample scale.

§Errors

Returns CalculusError when the stored step or tolerance is invalid, at is not finite, sampled evaluations are not finite, or the left and right samples disagree by more than tolerance.

Trait Implementations§

§

impl Clone for LimitApproximator

§

fn clone(&self) -> LimitApproximator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for LimitApproximator

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl PartialEq for LimitApproximator

§

fn eq(&self, other: &LimitApproximator) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Copy for LimitApproximator

§

impl StructuralPartialEq for LimitApproximator

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.