#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
let init_state = State::<f64>::new(0f64, c!(1), c!(0));
let mut ode_solver = ExplicitODE::new(test_fn);
ode_solver
.set_method(ExMethod::RK4)
.set_initial_condition(init_state)
.set_step_size(0.01)
.set_times(1000);
let _result = ode_solver.integrate();
// let mut st = SimpleWriter::new();
// st.set_path("example_data/rk4_test.pickle")
// .insert_matrix(result)
// .write_pickle();
}
fn test_fn(st: &mut State<f64>, _: &NoEnv) {
let x = st.param;
let y = &st.value;
let dy = &mut st.deriv;
dy[0] = (5f64 * x.powi(2) - y[0]) / (x + y[0]).exp();
}