This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/ode/bdf

Variable-order BDF in quasi-constant-step form (orders 1 to 5)

The backward differentiation formula of order k takes y_{n+1} to be the point where the polynomial through the last k+1 solution values has slope f(t_{n+1}, y_{n+1}). The solution history is kept as backward differences D^j y_n, j = 0..k+2, of the interpolating polynomial on an equally spaced grid; a change of step rescales the differences to the new grid (the R and U matrices of Shampine and Reichelt, section 3.1) instead of keeping unequally spaced points, which is what "quasi-constant step" means.

In this form the implicit equation is

(I - h / alpha_k J) d = h / alpha_k f(t_{n+1}, y_p + d) - psi - d

for the correction d to the predictor y_p = sum_j D^j y_n, solved by at most four simplified Newton iterations with one LU of I - (h/alpha_k) J. The LU is kept from step to step and refactored when an accepted step changes h or k, when Newton fails, and when the step is cut to reach t1; a step retried after a failed error test keeps it (SciPy's policy: the iteration converged, so the old matrix still serves). The formulas are the NDFs (numerical differentiation formulas) of Klopfenstein and Shampine-Reichelt, with kappa = (-0.185, -1/9, -0.0823, -0.0415, 0): BDFs with a modified leading coefficient that are more accurate at the same stability (order 5 is the plain BDF). The local error is C_k d; after k+1 steps of one size the errors the neighboring orders would have made are compared and the order moves to the one that allows the largest step. The constants and logic are those of SciPy's BDF (scipy/integrate/_ivp/bdf.py) and MATLAB's ode15s.

L. F. Shampine and M. W. Reichelt, The MATLAB ODE Suite, SIAM J. Sci. Comput. 18, 1-22 (1997), doi:10.1137/S1064827594276424.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 35–363