pub struct DoPri5;Expand description
Dormand-Prince 5(4) solver.
§Example
use numra_ode::{OdeProblem, DoPri5, Solver, SolverOptions};
// Exponential decay: dy/dt = -y
let problem = OdeProblem::new(
|_t, y: &[f64], dydt: &mut [f64]| { dydt[0] = -y[0]; },
0.0,
5.0,
vec![1.0]
);
let options = SolverOptions::default();
let result = DoPri5::solve(&problem, 0.0, 5.0, &[1.0], &options).unwrap();
// y(5) ≈ e^(-5) ≈ 0.00674
let y_final = result.y_final().unwrap();
assert!((y_final[0] - (-5.0_f64).exp()).abs() < 1e-5);Implementations§
Trait Implementations§
Source§impl<S: Scalar> Solver<S> for DoPri5
impl<S: Scalar> Solver<S> for DoPri5
Source§fn solve<Sys: OdeSystem<S>>(
problem: &Sys,
t0: S,
tf: S,
y0: &[S],
options: &SolverOptions<S>,
) -> Result<SolverResult<S>, SolverError>
fn solve<Sys: OdeSystem<S>>( problem: &Sys, t0: S, tf: S, y0: &[S], options: &SolverOptions<S>, ) -> Result<SolverResult<S>, SolverError>
Solve the ODE problem.
Auto Trait Implementations§
impl Freeze for DoPri5
impl RefUnwindSafe for DoPri5
impl Send for DoPri5
impl Sync for DoPri5
impl Unpin for DoPri5
impl UnsafeUnpin for DoPri5
impl UnwindSafe for DoPri5
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more