Skip to main content

shooting_bvp

Function shooting_bvp 

Source
pub fn shooting_bvp<F, R>(
    f: &F,
    t0: f64,
    t1: f64,
    steps: usize,
    y0_init: &[f64],
    free: &[usize],
    residual: &R,
    tol: f64,
    max_iter: usize,
) -> Option<Vec<f64>>
where F: Fn(f64, &[f64]) -> Vec<f64>, R: Fn(&[f64]) -> Vec<f64>,
Expand description

Shooting-method boundary-value solver for a first-order system y' = f(t, y) of dimension n. The components of the initial state listed in free are the unknowns; they are chosen by Newton’s method so the user residual(y(t1)) (length = free.len()) is driven to zero. The Jacobian is built by forward finite differences and solved with the canonical lu_solve. Returns the converged initial state, or None if it fails to converge within max_iter (or the Jacobian is singular).

This generalises the fixed [f64; 4] damped-update shooting solver to arbitrary state dimension and an arbitrary number of free initial conditions, with a real Newton step.