Skip to main content

IVP

Struct IVP 

Source
pub struct IVP<EqType, T: Real, Y: State<T>, Method, SoloutType> { /* private fields */ }
Expand description

Unified builder for initial value problems (IVPs).

Consolidates solver configurations, output configurations, and events.

Implementations§

Source§

impl<'a, F, T: Real, Y: State<T>> IVP<OdeEq<'a, F>, T, Y, (), DefaultSolout>

Source

pub fn ode(system: &'a F, t0: T, tf: T, y0: Y) -> Self

Create a new initial value problem for an ordinary differential equation.

Source§

impl<F, T: Real, Y: State<T>> IVP<OdeEqOwned<OdeFnWrapper<F>>, T, Y, (), DefaultSolout>
where F: Fn(T, &Y, &mut Y),

Source

pub fn ode_from_fn(f: F, t0: T, tf: T, y0: Y) -> Self

Create a new initial value problem for an ordinary differential equation from a closure.

§Example
use differential_equations::prelude::*;
let t0 = 0.0;
let tf = 1.0;
let y0 = 1.0;
let ivp = IVP::ode_from_fn(|t, y, dydt| { *dydt = t * y; }, t0, tf, y0);
Source§

impl<'a, F, T: Real, Y: State<T>> IVP<DaeEq<'a, F>, T, Y, (), DefaultSolout>

Source

pub fn dae(system: &'a F, t0: T, tf: T, y0: Y) -> Self

Create a new initial value problem for a differential algebraic equation.

Source§

impl<F, M, T: Real, Y: State<T>> IVP<DaeEqOwned<DaeFnWrapper<F, M>>, T, Y, (), DefaultSolout>
where F: Fn(T, &Y, &mut Y), M: Fn(&mut Matrix<T>),

Source

pub fn dae_from_fn(f: F, m: M, t0: T, tf: T, y0: Y) -> Self

Create a new initial value problem for a differential algebraic equation from closures.

Source§

impl<'a, F, T: Real, Y: State<T>> IVP<SdeEq<'a, F>, T, Y, (), DefaultSolout>

Source

pub fn sde(system: &'a mut F, t0: T, tf: T, y0: Y) -> Self

Create a new initial value problem for a stochastic differential equation.

Source§

impl<Drift, Diff, Noise, T: Real, Y: State<T>> IVP<SdeEqOwned<SdeFnWrapper<Drift, Diff, Noise>>, T, Y, (), DefaultSolout>
where Drift: Fn(T, &Y, &mut Y), Diff: Fn(T, &Y, &mut Y), Noise: FnMut(T, &mut Y),

Source

pub fn sde_from_fn( drift: Drift, diffusion: Diff, noise: Noise, t0: T, tf: T, y0: Y, ) -> Self

Create a new initial value problem for a stochastic differential equation from closures.

Source§

impl<'a, F, H, T: Real, Y: State<T>, const L: usize> IVP<DdeEq<'a, L, F, H>, T, Y, (), DefaultSolout>

Source

pub fn dde(system: &'a F, t0: T, tf: T, y0: Y, history_function: H) -> Self

Create a new initial value problem for a delay differential equation.

Source§

impl<const L: usize, Diff, Lags, H, T: Real, Y: State<T>> IVP<DdeEqOwned<L, DdeFnWrapper<L, Diff, Lags>, H>, T, Y, (), DefaultSolout>
where Diff: Fn(T, &Y, &[Y; L], &mut Y), Lags: Fn(T, &Y, &mut [T; L]), H: Fn(T) -> Y + Clone,

Source

pub fn dde_from_fn( diff: Diff, lags: Lags, t0: T, tf: T, y0: Y, history_function: H, ) -> Self

Create a new initial value problem for a delay differential equation from closures.

Source§

impl<EqType, T: Real, Y: State<T>, Method, SoloutType> IVP<EqType, T, Y, Method, SoloutType>

Source

pub fn method<SNew>(self, method: SNew) -> IVP<EqType, T, Y, SNew, SoloutType>

Set the numerical method to be used.

The builder owns the method because solving mutates method state. Construct a fresh method for each solve, or use the low-level solve_* functions when you need to manage a mutable solver reference directly.

Source

pub fn solout<ONew>(self, solout: ONew) -> IVP<EqType, T, Y, Method, ONew>

Set a custom solout function.

Source

pub fn even(self, dt: T) -> IVP<EqType, T, Y, Method, EvenSolout<T>>

Output evenly spaced points between the initial and final time. Note that this does not include the solution of the calculated steps.

Source

pub fn dense(self, n: usize) -> IVP<EqType, T, Y, Method, DenseSolout>

Use the Dense Output method to output n number of interpolation points between each step. Note this includes the solution of the calculated steps.

Source

pub fn t_eval( self, points: impl AsRef<[T]>, ) -> IVP<EqType, T, Y, Method, TEvalSolout<T>>

Use the provided time points for evaluation instead of the default method. Note this does not include the solution of the calculated steps.

Source

pub fn event<'a, E>( self, event: &'a E, ) -> IVP<EqType, T, Y, Method, EventWrappedSolout<'a, T, Y, SoloutType, E>>
where E: Event<T, Y> + ?Sized, SoloutType: Solout<T, Y>,

Wrap current solout with event detection while preserving original output strategy.

Source

pub fn crossing( self, component_idx: usize, threshold: T, direction: CrossingDirection, ) -> IVP<EqType, T, Y, Method, CrossingSolout<T>>

Uses the CrossingSolout method to output points when a specific component crosses a threshold. Note this does not include the solution of the calculated steps.

Source

pub fn hyperplane_crossing<Y1: State<T>>( self, point: Y1, normal: Y1, extractor: fn(&Y) -> Y1, direction: CrossingDirection, ) -> IVP<EqType, T, Y, Method, HyperplaneCrossingSolout<T, Y1, Y>>

Uses the HyperplaneCrossingSolout method to output points when a specific hyperplane is crossed. Note this does not include the solution of the calculated steps.

Source§

impl<EqType, T: Real, Y: State<T>, Method, SoloutType> IVP<EqType, T, Y, Method, SoloutType>
where Method: ToleranceConfig<T>,

Source

pub fn rtol<V: Into<Tolerance<T>>>(self, rtol: V) -> Self

Set relative tolerance on the underlying solver.

Source

pub fn atol<V: Into<Tolerance<T>>>(self, atol: V) -> Self

Set absolute tolerance on the underlying solver.

Source§

impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<OdeEq<'a, F>, T, Y, Method, SoloutType>
where F: ODE<T, Y>, Method: OrdinaryNumericalMethod<T, Y> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the ODE initial value problem.

Source§

impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<OdeEqOwned<F>, T, Y, Method, SoloutType>
where F: ODE<T, Y>, Method: OrdinaryNumericalMethod<T, Y> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the ODE initial value problem.

Source§

impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<DaeEq<'a, F>, T, Y, Method, SoloutType>
where F: DAE<T, Y>, Method: AlgebraicNumericalMethod<T, Y> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the DAE initial value problem.

Source§

impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<DaeEqOwned<F>, T, Y, Method, SoloutType>
where F: DAE<T, Y>, Method: AlgebraicNumericalMethod<T, Y> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the DAE initial value problem.

Source§

impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<SdeEq<'a, F>, T, Y, Method, SoloutType>
where F: SDE<T, Y>, Method: StochasticNumericalMethod<T, Y> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the SDE initial value problem.

Source§

impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<SdeEqOwned<F>, T, Y, Method, SoloutType>
where F: SDE<T, Y>, Method: StochasticNumericalMethod<T, Y> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the SDE initial value problem.

Source§

impl<'a, const L: usize, F, H, T: Real, Y: State<T>, Method, SoloutType> IVP<DdeEq<'a, L, F, H>, T, Y, Method, SoloutType>
where F: DDE<L, T, Y>, H: Fn(T) -> Y + Clone, Method: DelayNumericalMethod<L, T, Y, H> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the DDE initial value problem.

Source§

impl<const L: usize, F, H, T: Real, Y: State<T>, Method, SoloutType> IVP<DdeEqOwned<L, F, H>, T, Y, Method, SoloutType>
where F: DDE<L, T, Y>, H: Fn(T) -> Y + Clone, Method: DelayNumericalMethod<L, T, Y, H> + Interpolation<T, Y>, SoloutType: Solout<T, Y>,

Source

pub fn solve(self) -> Result<Solution<T, Y>, Error<T, Y>>

Solve the DDE initial value problem.

Trait Implementations§

Source§

impl<EqType: Clone, T: Clone + Real, Y: Clone + State<T>, Method: Clone, SoloutType: Clone> Clone for IVP<EqType, T, Y, Method, SoloutType>

Source§

fn clone(&self) -> IVP<EqType, T, Y, Method, SoloutType>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<EqType: Debug, T: Debug + Real, Y: Debug + State<T>, Method: Debug, SoloutType: Debug> Debug for IVP<EqType, T, Y, Method, SoloutType>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<EqType, T, Y, Method, SoloutType> Freeze for IVP<EqType, T, Y, Method, SoloutType>
where EqType: Freeze, T: Freeze, Y: Freeze, Method: Freeze, SoloutType: Freeze,

§

impl<EqType, T, Y, Method, SoloutType> RefUnwindSafe for IVP<EqType, T, Y, Method, SoloutType>
where EqType: RefUnwindSafe, T: RefUnwindSafe, Y: RefUnwindSafe, Method: RefUnwindSafe, SoloutType: RefUnwindSafe,

§

impl<EqType, T, Y, Method, SoloutType> Send for IVP<EqType, T, Y, Method, SoloutType>
where EqType: Send, Y: Send, Method: Send, SoloutType: Send,

§

impl<EqType, T, Y, Method, SoloutType> Sync for IVP<EqType, T, Y, Method, SoloutType>
where EqType: Sync, Y: Sync, Method: Sync, SoloutType: Sync,

§

impl<EqType, T, Y, Method, SoloutType> Unpin for IVP<EqType, T, Y, Method, SoloutType>
where EqType: Unpin, T: Unpin, Y: Unpin, Method: Unpin, SoloutType: Unpin,

§

impl<EqType, T, Y, Method, SoloutType> UnsafeUnpin for IVP<EqType, T, Y, Method, SoloutType>
where EqType: UnsafeUnpin, T: UnsafeUnpin, Y: UnsafeUnpin, Method: UnsafeUnpin, SoloutType: UnsafeUnpin,

§

impl<EqType, T, Y, Method, SoloutType> UnwindSafe for IVP<EqType, T, Y, Method, SoloutType>
where EqType: UnwindSafe, T: UnwindSafe, Y: UnwindSafe, Method: UnwindSafe, SoloutType: UnwindSafe,

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<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.