Struct rkf45::ErrorControlOptions

source ·
pub struct ErrorControlOptions {
    pub absolute_magnitude: f64,
    pub relative_magnitude: f64,
    pub function_scale: f64,
    pub derivative_scale: f64,
}
Expand description

Options for computing desired error when performing adaptive time-stepping.

rkf45_adaptive compares its estimate to a desired error, which is computed as

D = max(absolute_magnitude + relative_magnitude * (function_scale * y[i] + derivative_scale * dt * dydt[i]))

where [i] denotes the ith component, and the max is taken over all components.

This form supports a variety of ways of controlling the size of the desired error relative to y itself or to its increments.

Fields§

§absolute_magnitude: f64

Magnitude of the absolute component of desired error. Even if relative error is the primary feature of interest, this must be set to a nonzero value as a safety measure in case both y and dydt are near zero.

§relative_magnitude: f64

Magnitude of the relative component of desired error.

§function_scale: f64

Contribution of y to the relative component of desired error.

§derivative_scale: f64

Contribution of y’s increment (dt * dydt) to the relative component of desired error.

Implementations§

source§

impl ErrorControlOptions

source

pub fn simple(scale: f64) -> ErrorControlOptions

A simple error control option that sets the desired error to

D = max(scale * (1 + y[i] + dt * dydt[i]))

This has a lower bound of scale, but it grows proportional to y or dydt as either one becomes large.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.