[−][src]Struct mathru::analysis::ode::RK4
Solves an ordinary differential equation using the 4th order Runge-Kutta algorithm.
Methods
impl<T> RK4<T> where
T: Real,
[src]
T: Real,
Trait Implementations
impl<T> Solver<T> for RK4<T> where
T: Real,
[src]
T: Real,
fn solve<F>(
&self,
func: F,
init: Vector<T>,
t_start: T,
t_end: T
) -> (Vector<T>, Matrix<T>) where
F: Fn(&T, &Vector<T>) -> Vector<T>,
[src]
&self,
func: F,
init: Vector<T>,
t_start: T,
t_end: T
) -> (Vector<T>, Matrix<T>) where
F: Fn(&T, &Vector<T>) -> Vector<T>,
Solves func
using the 4th order Runge-Kutta algorithm.
Arguments
- 'func' is an explict oridnary diffential equation
- 'init' is the initial value at the time 't_start'
- 't_start' initial time
- 't_end'
Return
The solver returns a vector and a matrix, containing the times used in each step of the algorithm and the respectful values for that time.
Example
use mathru::*; use mathru::algebra::linear::{Vector, Matrix}; use mathru::analysis::ode::{Solver, RK4}; let f = |t: &f64, _x: &Vector<f64> | -> Vector<f64> { return Vector::new_row(1, vec![1.0]) * (t * &2.0f64); }; let init: Vector<f64> = vector![1.0]; let solver: RK4<f64> = RK4::new(0.01); let (t, y): (Vector<f64>, Matrix<f64>) = solver.solve(f, init, 0.0, 2.0);
Auto Trait Implementations
impl<T> Send for RK4<T> where
T: Send,
T: Send,
impl<T> Sync for RK4<T> where
T: Sync,
T: Sync,
impl<T> Unpin for RK4<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for RK4<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for RK4<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,