Skip to main content

DormandPrince

Struct DormandPrince 

Source
pub struct DormandPrince {
    pub abs_tol: Scalar,
    pub rel_tol: Scalar,
    pub dt_beta: Scalar,
    pub dt_expn: Scalar,
    pub dt_cut: Scalar,
    pub dt_min: Scalar,
    pub error_norm: Norm,
}
Expand description

Explicit, six-stage, fifth-order, variable-step, Runge-Kutta method.1

\frac{dy}{dt} = f(t, y)
t_{n+1} = t_n + h
k_1 = f(t_n, y_n)
k_2 = f(t_n + \tfrac{1}{5} h, y_n + \tfrac{1}{5} h k_1)
k_3 = f(t_n + \tfrac{3}{10} h, y_n + \tfrac{3}{40} h k_1 + \tfrac{9}{40} h k_2)
k_4 = f(t_n + \tfrac{4}{5} h, y_n + \tfrac{44}{45} h k_1 - \tfrac{56}{15} h k_2 + \tfrac{32}{9} h k_3)
k_5 = f(t_n + \tfrac{8}{9} h, y_n + \tfrac{19372}{6561} h k_1 - \tfrac{25360}{2187} h k_2 + \tfrac{64448}{6561} h k_3 - \tfrac{212}{729} h k_4)
k_6 = f(t_n + h, y_n + \tfrac{9017}{3168} h k_1 - \tfrac{355}{33} h k_2 - \tfrac{46732}{5247} h k_3 + \tfrac{49}{176} h k_4 - \tfrac{5103}{18656} h k_5)
y_{n+1} = y_n + h\left(\frac{35}{384}\,k_1 + \frac{500}{1113}\,k_3 + \frac{125}{192}\,k_4 - \frac{2187}{6784}\,k_5 + \frac{11}{84}\,k_6\right)
k_7 = f(t_{n+1}, y_{n+1})
e_{n+1} = \frac{h}{5}\left(\frac{71}{11520}\,k_1 - \frac{71}{3339}\,k_3 + \frac{71}{384}\,k_4 - \frac{17253}{67840}\,k_5 + \frac{22}{105}\,k_6 - \frac{1}{8}\,k_7\right)

  1. J.R. Dormand and P.J. Prince, J. Comput. Appl. Math. 6, 19 (1980)

Fields§

§abs_tol: Scalar

Absolute error tolerance.

§rel_tol: Scalar

Relative error tolerance.

§dt_beta: Scalar

Multiplier for adaptive time steps.

§dt_expn: Scalar

Exponent for adaptive time steps.

§dt_cut: Scalar

Cut back factor for the time step.

§dt_min: Scalar

Minimum value for the time step.

§error_norm: Norm

Norm type for error evaluation.

Trait Implementations§

Source§

impl Debug for DormandPrince

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DormandPrince

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Y, U, V, T> Explicit<Y, U, V, T> for DormandPrince
where Y: Differentiate<T> + Tensor, Derivative<Y, T>: Mul<Quantity<T>, Output = Y>, for<'a> &'a Y: Mul<Scalar, Output = Y> + Sub<&'a Y, Output = Y>, for<'a> &'a Derivative<Y, T>: Mul<Scalar, Output = Derivative<Y, T>> + Mul<Quantity<T>, Output = Y>, U: TensorVec<Item = Y>, V: TensorVec<Item = Derivative<Y, T>>,

Source§

const SLOPES: usize = 7

Source§

fn integrate( &self, function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, time: &[Quantity<T>], initial_condition: Y, ) -> Result<(Times<T>, U, V), IntegrationError>

Solves an initial value problem by explicitly integrating a system of ordinary differential equations. Read more
Source§

impl<Y, Z, U, V, W, T> ExplicitDaeVariableStepExplicit<Y, Z, U, V, W, T> for DormandPrince
where Self: ExplicitDaeVariableStepFirstSameAsLast<Y, Z, U, V, W, T>, Y: Differentiate<T> + Tensor, Z: PartialEq + Tensor, Derivative<Y, T>: Mul<Quantity<T>, Output = Y>, U: TensorVec<Item = Y>, V: TensorVec<Item = Z>, W: TensorVec<Item = Derivative<Y, T>>, for<'a> &'a Y: Mul<Scalar, Output = Y> + Sub<&'a Y, Output = Y>, for<'a> &'a Derivative<Y, T>: Mul<Scalar, Output = Derivative<Y, T>> + Mul<Quantity<T>, Output = Y>,

Source§

fn slopes_solve( evolution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Derivative<Y, T>, String>, solution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Z, String>, y: &Y, z: &Z, t: Quantity<T>, dt: Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &mut Y, z_trial: &mut Z, ) -> Result<(), String>

Source§

fn slopes_solve_and_error( &self, evolution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Derivative<Y, T>, String>, solution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Z, String>, y: &Y, z: &Z, t: Quantity<T>, dt: Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &mut Y, z_trial: &mut Z, ) -> Result<Scalar, String>

Source§

fn step_solve( &self, _: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Derivative<Y, T>, String>, y: &mut Y, z: &mut Z, t: &mut Quantity<T>, y_sol: &mut U, z_sol: &mut V, t_sol: &mut Times<T>, dydt_sol: &mut W, k_sol: &mut Vec<W>, dt: &mut Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &Y, z_trial: &Z, e: Scalar, ) -> Result<(), String>

Source§

fn interpolate_explicit_dae_variable_step( &self, _evolution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Derivative<Y, T>, String>, solution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Z, String>, time: &Times<T>, tp: &Times<T>, yp: &U, dydtp: &W, k_sol: &[W], zp: &V, ) -> Result<(U, W, V), IntegrationError>

Source§

fn integrate_explicit_dae_variable_step( &self, evolution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Derivative<Y, T>, String>, solution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Z, String>, time: &[Quantity<T>], initial_condition: (Y, Z), ) -> Result<(Times<T>, U, W, V), IntegrationError>

Source§

impl<Y, Z, U, V, W, T> ExplicitDaeVariableStepFirstSameAsLast<Y, Z, U, V, W, T> for DormandPrince
where Y: Differentiate<T> + Tensor, Z: PartialEq + Tensor, Derivative<Y, T>: Mul<Quantity<T>, Output = Y>, U: TensorVec<Item = Y>, V: TensorVec<Item = Z>, W: TensorVec<Item = Derivative<Y, T>>, for<'a> &'a Y: Mul<Scalar, Output = Y> + Sub<&'a Y, Output = Y>, for<'a> &'a Derivative<Y, T>: Mul<Scalar, Output = Derivative<Y, T>> + Mul<Quantity<T>, Output = Y>,

Source§

fn slopes_solve_and_error_fsal( &self, evolution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Derivative<Y, T>, String>, solution: impl FnMut(Quantity<T>, &Y, &Z) -> Result<Z, String>, y: &Y, z: &Z, t: Quantity<T>, dt: Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &mut Y, z_trial: &mut Z, ) -> Result<Scalar, String>

Source§

fn step_solve_fsal( &self, y: &mut Y, z: &mut Z, t: &mut Quantity<T>, y_sol: &mut U, z_sol: &mut V, t_sol: &mut Times<T>, dydt_sol: &mut W, k_sol: &mut Vec<W>, dt: &mut Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &Y, z_trial: &Z, e: Scalar, ) -> Result<(), String>

Source§

impl<Y, U, V, T> InterpolateSolution<Y, U, V, T> for DormandPrince
where Y: Differentiate<T> + Tensor, Derivative<Y, T>: Mul<Quantity<T>, Output = Y>, for<'a> &'a Y: Mul<Scalar, Output = Y> + Sub<&'a Y, Output = Y>, for<'a> &'a Derivative<Y, T>: Mul<Scalar, Output = Derivative<Y, T>> + Mul<Quantity<T>, Output = Y>, U: TensorVec<Item = Y>, V: TensorVec<Item = Derivative<Y, T>>,

Source§

fn interpolate( &self, time: &Times<T>, tp: &Times<T>, yp: &U, dydtp: &V, k_sol: &[V], _function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, ) -> Result<(U, V), IntegrationError>

Solution interpolation.
Source§

impl<Y, U> OdeIntegrator<Y, U> for DormandPrince
where Y: Tensor, U: TensorVec<Item = Y>,

Source§

impl<T> VariableStep<T> for DormandPrince

Source§

fn abs_tol(&self) -> Scalar

Returns the absolute error tolerance.
Source§

fn rel_tol(&self) -> Scalar

Returns the relative error tolerance.
Source§

fn dt_beta(&self) -> Scalar

Returns the multiplier for adaptive time steps.
Source§

fn dt_expn(&self) -> Scalar

Returns the exponent for adaptive time steps.
Source§

fn dt_cut(&self) -> Scalar

Returns the cut back factor for function errors.
Source§

fn dt_min(&self) -> Quantity<T>

Returns the minimum value for the time step.
Source§

fn error_norm(&self) -> &Norm

Returns the norm type for error evaluation.
Source§

impl<Y, U, V, T> VariableStepExplicit<Y, U, V, T> for DormandPrince
where Self: Explicit<Y, U, V, T>, Y: Differentiate<T> + Tensor, Derivative<Y, T>: Mul<Quantity<T>, Output = Y>, for<'a> &'a Y: Mul<Scalar, Output = Y> + Sub<&'a Y, Output = Y>, for<'a> &'a Derivative<Y, T>: Mul<Scalar, Output = Derivative<Y, T>> + Mul<Quantity<T>, Output = Y>, U: TensorVec<Item = Y>, V: TensorVec<Item = Derivative<Y, T>>,

Source§

fn error( &self, dt: Quantity<T>, k: &[Derivative<Y, T>], ) -> Result<Scalar, String>

Source§

fn slopes( function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, y: &Y, t: Quantity<T>, dt: Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &mut Y, ) -> Result<(), String>

Source§

fn slopes_and_error( &self, function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, y: &Y, t: Quantity<T>, dt: Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &mut Y, ) -> Result<Scalar, String>

Source§

fn step( &self, _function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, y: &mut Y, t: &mut Quantity<T>, y_sol: &mut U, t_sol: &mut Times<T>, dydt_sol: &mut V, k_sol: &mut Vec<V>, dt: &mut Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &Y, e: Scalar, ) -> Result<(), String>

Source§

fn integrate_variable_step( &self, function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, time: &[Quantity<T>], initial_condition: Y, ) -> Result<(Times<T>, U, V), IntegrationError>

Source§

fn interpolate_variable_step( time: &Times<T>, tp: &Times<T>, yp: &U, function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, ) -> Result<(U, V), IntegrationError>

Source§

fn time_step(&self, error: Scalar, dt: &mut Quantity<T>)

Provides the adaptive time step as a function of the error. Read more
Source§

impl<Y, U, V, T> VariableStepExplicitFirstSameAsLast<Y, U, V, T> for DormandPrince
where Y: Differentiate<T> + Tensor, Derivative<Y, T>: Mul<Quantity<T>, Output = Y>, for<'a> &'a Y: Mul<Scalar, Output = Y> + Sub<&'a Y, Output = Y>, for<'a> &'a Derivative<Y, T>: Mul<Scalar, Output = Derivative<Y, T>> + Mul<Quantity<T>, Output = Y>, U: TensorVec<Item = Y>, V: TensorVec<Item = Derivative<Y, T>>,

Source§

fn slopes_and_error_fsal( &self, function: impl FnMut(Quantity<T>, &Y) -> Result<Derivative<Y, T>, String>, y: &Y, t: Quantity<T>, dt: Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &mut Y, ) -> Result<Scalar, String>

Source§

fn step_fsal( &self, y: &mut Y, t: &mut Quantity<T>, y_sol: &mut U, t_sol: &mut Times<T>, dydt_sol: &mut V, k_sol: &mut Vec<V>, dt: &mut Quantity<T>, k: &mut [Derivative<Y, T>], y_trial: &Y, e: Scalar, ) -> Result<(), String>

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> Is<T> for T

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.