/// Implementation of fourth order Runge-Kutta Method.
Implementation of fourth order Runge-Kutta Method.
Implementation of fourth order Runge - Kutta Method .
fn runge_kutta<F>(f: F, delta_t: f64, initial: Array<f64, Ix1>) -> Array<f64, Ix1>
where
    F: Fn(&Array<f64, Ix1>) -> Array<f64, Ix1>,
{
    let k1 = f(&initial) * delta_t;
    let k2 = f(&(&initial + &(0.5 * &k1))) * delta_t;
    let k3 = f(&(&initial + &(0.5 * &k2))) * delta_t;
    let k4 = f(&(&initial + &k3)) * delta_t;
    initial + 1. / 6. * (k1 + 2. * k2 + 2. * k3 + k4)
}
fn runge_kutta < F > ( f : F , delta_t : f64 , initial : Array < f64 , Ix1 > ) -> Array < f64 , Ix1 > where F : Fn ( & Array < f64 , Ix1 > ) -> Array < f64 , Ix1 > , { let k1 = f ( & initial ) * delta_t ; let k2 = f ( & ( & initial + & ( 0.5 * & k1 ) ) ) * delta_t ; let k3 = f ( & ( & initial + & ( 0.5 * & k2 ) ) ) * delta_t ; let k4 = f ( & ( & initial + & k3 ) ) * delta_t ; initial + 1. / 6. * ( k1 + 2. * k2 + 2. * k3 + k4 ) }
Implementation of fourth order Runge-Kutta Method.
Implementation of fourth order Runge - Kutta Method .
f
F
delta_t
f64
initial
Array<f64, Ix1>