Provide generic solvers for ODEs using different methods. Also, allow the user
to choose which datatype they desire to use for that problem, be it f32
, u8
or some non-standard bignum type.
By no means this is yet ready for any serious use right now. The code needs to be cleaned and there is a lot yet to be implemented.
use ode::{Method, Solver};
// The interval in time you wish to calculate.
let time_interval: [f32; 2] = [0., 100.];
// The value of y(t = 0).
let initial_condition: Vec<f32> = vec![0.];
// You can configure the solver in a single line:
let _ = Solver::new(&time_interval, &initial_condition)
.method(Method::RK4);
// Or with multiple statements:
let mut solver = Solver::new(&time_interval, &initial_condition);
solver.method(Method::RK4);
// To run the solver, simply pass the closure of your choice. In this case, I'm
// integrating
//
// y(t) = 2 * t
let (times, pos) = solver.solve(|t: &f32, _: &Vec<f32>| {
vec![2.*t]
});
- more and better documentation;
- re-implement the 4th order Runge-Kutta method;
- have at least a few tests and examples;
- stabilize the API.
- figure out a generic way to write all Runge-Kutta variants that is both easy to maintain and clean to read;
- implement all planned Runge-Kutta variants:
- 2;
- 3;
- 4;
- 5.
If you whant to help this project, check the Contributing file for detailed information. (Spoiler: you're welcome to contribute in any way you feel you can help!)