Skip to main content

Module ode

Module ode 

Source
Expand description

ODE initial value problem solvers (Euler, RK45, BDF-2). ODE initial value problem solvers.

Provides multiple methods for solving systems of ordinary differential equations of the form dy/dt = f(t, y):

  • euler — Forward Euler (1st order, simple)
  • rk45 — Dormand-Prince RK4(5) (adaptive, general-purpose)
  • bdf2 — BDF-2 (implicit, for stiff systems)
  • solve_ivp — Unified entry point with method selection

§Example

use scivex_optim::ode::{solve_ivp, OdeMethod, OdeOptions};

// dy/dt = -y, y(0) = 1  =>  y(t) = e^(-t)
let result = solve_ivp(
    |_t, y: &[f64]| vec![-y[0]],
    [0.0, 1.0],
    &[1.0],
    OdeMethod::RK45,
    &OdeOptions::default(),
).unwrap();

println!("y(1) = {}", result.y.last().unwrap()[0]);

Structs§

OdeOptions
Options for ODE solvers.
OdeResult
Result of an ODE integration.

Enums§

OdeMethod
Available ODE solver methods.

Functions§

bdf2
Solve a stiff ODE system using the BDF-2 method.
euler
Solve an ODE system using the forward Euler method.
rk45
Solve an ODE system using the Dormand-Prince RK4(5) adaptive method.
solve_ivp
Solve an initial value problem (IVP) for a system of ODEs.

Type Aliases§

EventFn
Event function type: fn(t, y) -> T. Integration stops when the return value crosses zero.