| Crates.io | solve_ivp_bdf |
| lib.rs | solve_ivp_bdf |
| version | 0.1.2 |
| created_at | 2025-07-31 07:58:05.042761+00 |
| updated_at | 2025-08-07 01:34:29.479013+00 |
| description | A simple port of the solve_ivp BDF method from Scipy. |
| homepage | |
| repository | https://github.com/hajifkd/solve_ivp_bdf |
| max_upload_size | |
| id | 1774611 |
| size | 38,046 |
A simple port of the solve_ivp BDF method from Scipy to Rust. This library provides a way to solve ordinary differential equations (ODEs) using the Backward Differentiation Formula (BDF) method with simple event handling.
To use this library, add it to your Cargo.toml:
[dependencies]
solve_ivp_bdf = "0.1"
Then, you can use it in your Rust project:
use solve_ivp_bdf::{solve_ivp_bdf, Event};
fn main() {
let rhs = Box::new(|t: f64, y: &[f64]| -> Vec<f64> {
vec![-y[0]] // Example: dy/dt = -y
});
let event_fn = Box::new(|_t: f64, y: &[f64]| -> bool {
y[0] - 2.5 < 0.0 // Example: stop when y crosses 2.5
});
let event = Event {
function: event_fn,
terminal: true,
};
let t0 = 0.0;
let t1 = 10.0;
let y0 = vec![10.0];
let result = solve_ivp_bdf(rhs, t0, t1, y0, Some(vec![event]));
println!("{:?}", result);
}