[−][src]Struct bacon_sci::ivp::Euler
Euler solver for an IVP.
Solves an initial value problem using Euler's method.
Examples
use nalgebra::DVector; use bacon_sci::ivp::{Euler, IVPSolver}; fn derivative(_t: f64, state: &[f64], _p: &mut ()) -> Result<DVector<f64>, String> { Ok(DVector::from_column_slice(state)) } fn example() -> Result<(), String> { let solver = Euler::new() .with_dt_max(0.001)? .with_initial_conditions(&[1.0])? .with_start(0.0)? .with_end(1.0)? .build(); let path = solver.solve_ivp(derivative, &mut ())?; for (time, state) in &path { assert!((time.exp() - state.column(0)[0]).abs() <= 0.001); } Ok(()) }
Implementations
impl<N: ComplexField> Euler<N>
[src]
Trait Implementations
impl<N: Clone + ComplexField> Clone for Euler<N> where
N::RealField: Clone,
N::RealField: Clone,
N::RealField: Clone,
[src]
N::RealField: Clone,
N::RealField: Clone,
N::RealField: Clone,
impl<N: Debug + ComplexField> Debug for Euler<N> where
N::RealField: Debug,
N::RealField: Debug,
N::RealField: Debug,
[src]
N::RealField: Debug,
N::RealField: Debug,
N::RealField: Debug,
impl<N: Default + ComplexField> Default for Euler<N> where
N::RealField: Default,
N::RealField: Default,
N::RealField: Default,
[src]
N::RealField: Default,
N::RealField: Default,
N::RealField: Default,
impl<N: ComplexField> IVPSolver<N> for Euler<N>
[src]
pub fn step<T: Clone>(
&mut self,
f: fn(_: N::RealField, _: &[N], _: &mut T) -> Result<DVector<N>, String>,
params: &mut T
) -> Result<IVPStatus<N>, String>
[src]
&mut self,
f: fn(_: N::RealField, _: &[N], _: &mut T) -> Result<DVector<N>, String>,
params: &mut T
) -> Result<IVPStatus<N>, String>
pub fn with_tolerance(self, _tol: N::RealField) -> Result<Self, String>
[src]
pub fn with_dt_max(self, max: N::RealField) -> Result<Self, String>
[src]
pub fn with_dt_min(self, _min: N::RealField) -> Result<Self, String>
[src]
pub fn with_start(self, t_initial: N::RealField) -> Result<Self, String>
[src]
pub fn with_end(self, t_final: N::RealField) -> Result<Self, String>
[src]
pub fn with_initial_conditions(self, start: &[N]) -> Result<Self, String>
[src]
pub fn build(self) -> Self
[src]
pub fn get_initial_conditions(&self) -> Option<DVector<N>>
[src]
pub fn get_time(&self) -> Option<N::RealField>
[src]
pub fn check_start(&self) -> Result<(), String>
[src]
pub fn solve_ivp<T: Clone>(
self,
f: fn(_: N::RealField, _: &[N], _: &mut T) -> Result<DVector<N>, String>,
params: &mut T
) -> Result<Vec<(N::RealField, DVector<N>)>, String>
[src]
self,
f: fn(_: N::RealField, _: &[N], _: &mut T) -> Result<DVector<N>, String>,
params: &mut T
) -> Result<Vec<(N::RealField, DVector<N>)>, String>
Auto Trait Implementations
impl<N> RefUnwindSafe for Euler<N> where
N: RefUnwindSafe,
<N as ComplexField>::RealField: RefUnwindSafe,
[src]
N: RefUnwindSafe,
<N as ComplexField>::RealField: RefUnwindSafe,
impl<N> Send for Euler<N> where
<N as ComplexField>::RealField: Send,
[src]
<N as ComplexField>::RealField: Send,
impl<N> Sync for Euler<N> where
<N as ComplexField>::RealField: Sync,
[src]
<N as ComplexField>::RealField: Sync,
impl<N> Unpin for Euler<N> where
N: Unpin,
<N as ComplexField>::RealField: Unpin,
[src]
N: Unpin,
<N as ComplexField>::RealField: Unpin,
impl<N> UnwindSafe for Euler<N> where
N: UnwindSafe,
<N as ComplexField>::RealField: UnwindSafe,
[src]
N: UnwindSafe,
<N as ComplexField>::RealField: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub unsafe fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,