Struct bacon_sci::ivp::Adams2 [−][src]
3rd order Adams predictor-corrector method for solving an IVP.
Defines the predictor and corrector coefficients, as well as the error coefficient. Uses AdamsInfo for the actual solving.
Examples
use nalgebra::{VectorN, U1}; use bacon_sci::ivp::{Adams2, AdamsSolver}; fn derivatives(_t: f64, state: &[f64], _p: &mut ()) -> Result<VectorN<f64, U1>, String> { Ok(VectorN::<f64, U1>::from_column_slice(state)) } fn example() -> Result<(), String> { let adams = Adams2::new() .with_dt_max(0.1)? .with_dt_min(0.00001)? .with_tolerance(0.00001)? .with_start(0.0)? .with_end(1.0)? .with_initial_conditions(&[1.0])? .build(); let path = adams.solve_ivp(derivatives, &mut ())?; for (time, state) in &path { assert!((time.exp() - state.column(0)[0]).abs() < 0.001); } Ok(()) }
Implementations
impl<N: ComplexField, S: DimName> Adams2<N, S> where
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N, U3>,
DefaultAllocator: Allocator<N::RealField, U3>, [src]
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N, U3>,
DefaultAllocator: Allocator<N::RealField, U3>,
Trait Implementations
impl<N: ComplexField, S: DimName> AdamsSolver<N, S, U3> for Adams2<N, S> where
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>, [src]
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>,
fn predictor_coefficients() -> VectorN<N::RealField, U3>[src]
fn corrector_coefficients() -> VectorN<N::RealField, U3>[src]
fn error_coefficient() -> N::RealField[src]
fn solve_ivp<T: Clone, F: FnMut(N::RealField, &[N], &mut T) -> Result<VectorN<N, S>, String>>(
self,
f: F,
params: &mut T
) -> Result<Vec<(N::RealField, VectorN<N, S>)>, String>[src]
self,
f: F,
params: &mut T
) -> Result<Vec<(N::RealField, VectorN<N, S>)>, String>
fn with_tolerance(mut self: Self, tol: N::RealField) -> Result<Self, String>[src]
fn with_dt_max(mut self: Self, max: N::RealField) -> Result<Self, String>[src]
fn with_dt_min(mut self: Self, min: N::RealField) -> Result<Self, String>[src]
fn with_start(mut self: Self, t_initial: N::RealField) -> Result<Self, String>[src]
fn with_end(mut self: Self, t_final: N::RealField) -> Result<Self, String>[src]
fn with_initial_conditions(mut self: Self, start: &[N]) -> Result<Self, String>[src]
fn build(mut self: Self) -> Self[src]
impl<N: Clone + ComplexField, S: Clone + DimName> Clone for Adams2<N, S> where
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>, [src]
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>,
impl<N: Debug + ComplexField, S: Debug + DimName> Debug for Adams2<N, S> where
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>, [src]
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>,
impl<N: ComplexField, S: DimName> Default for Adams2<N, S> where
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>, [src]
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N::RealField, U3>,
DefaultAllocator: Allocator<N, U3>,
impl<N: ComplexField, S: DimName> From<Adams2<N, S>> for AdamsInfo<N, S, U3> where
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N, U3>,
DefaultAllocator: Allocator<N::RealField, U3>, [src]
DefaultAllocator: Allocator<N, S>,
DefaultAllocator: Allocator<N, U3>,
DefaultAllocator: Allocator<N::RealField, U3>,
Auto Trait Implementations
impl<N, S> !RefUnwindSafe for Adams2<N, S>[src]
impl<N, S> !Send for Adams2<N, S>[src]
impl<N, S> !Sync for Adams2<N, S>[src]
impl<N, S> !Unpin for Adams2<N, S>[src]
impl<N, S> !UnwindSafe for Adams2<N, S>[src]
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>,
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>,