damndiff/lib.rs
1//! Rust library to efficiently handle inital valued problems with numerical methods. Thanks to [April Rains](https://www.youtube.com/watch?v=YjVT80bShYM) for inspiring the name.
2//! # Download
3//! To build with `damn-differential` you need to add the library to your project as a dependency.
4//! In your terminal run:
5//! ```
6//! cargo add damn-diff
7//! ```
8//!
9//! # Example
10//! To numerically solve an IVP:
11//! - implement the appropriate trait to your ODE;
12//! - define the solver;
13//! - select the adeguate method based on your IVP.
14//!
15//! For example:
16//! ```
17//! struct MyODE;
18//! impl ODE for MyODE {
19//! fn eval(&self, x: f64, y: f64) -> f64 {
20//! // Define the ODE equation, for instance: dy/dx = x + y
21//! x + y
22//! }
23//! }
24//!
25//! let solver = ODESolver;
26//! let my_ode = MyODE;
27//! let x0 = 0.0;
28//! let y0 = 1.0;
29//! let h = 0.1;
30//! let x_target = 1.0;
31//!
32//! let result = solver.rk4_ivp(&my_ode, x0, y0, h, x_target);
33//! println!("Solution at x = {}: {}", x_target, result);
34//! ```
35/// Ordinary differential equation
36pub mod ode;
37/// Systems of ordinary differential equations
38pub mod ode_sys;