pub struct RK4Integrator {
pub atol: f64,
pub rtol: f64,
}Expand description
Classic 4th-order Runge-Kutta integrator with optional adaptive step size.
In fixed-step mode each call to RK4Integrator::step advances the state
by exactly dt. The adaptive driver RK4Integrator::integrate_adaptive
doubles or halves the step based on an embedded 2nd-order (midpoint) error
estimate.
Fields§
§atol: f64Absolute tolerance used by the adaptive driver.
rtol: f64Relative tolerance used by the adaptive driver.
Implementations§
Source§impl RK4Integrator
impl RK4Integrator
Sourcepub fn default_tolerances() -> Self
pub fn default_tolerances() -> Self
Construct with default tolerances (1e-6 absolute, 1e-6 relative).
Sourcepub fn step<F>(&self, s: &OdeState, dt: f64, f: &F) -> OdeState
pub fn step<F>(&self, s: &OdeState, dt: f64, f: &F) -> OdeState
Perform one fixed RK4 step from state s using step size dt.
f(t, y) is the right-hand side of dy/dt = f(t, y).
Sourcepub fn integrate<F>(
&self,
s0: &OdeState,
t_end: f64,
dt: f64,
f: &F,
) -> Vec<OdeState>
pub fn integrate<F>( &self, s0: &OdeState, t_end: f64, dt: f64, f: &F, ) -> Vec<OdeState>
Integrate from s0 to time t_end using a fixed step dt.
Returns all intermediate states including the initial state.
Auto Trait Implementations§
impl Freeze for RK4Integrator
impl RefUnwindSafe for RK4Integrator
impl Send for RK4Integrator
impl Sync for RK4Integrator
impl Unpin for RK4Integrator
impl UnsafeUnpin for RK4Integrator
impl UnwindSafe for RK4Integrator
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.