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/nonstiff_events

lib/ode on non-stiff problems, events, dense output and batches

The checks with an exact answer:

  • the Kepler orbit (eccentricity 0.5, ten periods): the energy is conserved and the orbit closes, so after ten periods the state is the initial one (SciPy's RK45 at the same tolerances takes the same 2247 steps and drifts the same 1.4 × 10−9 in energy);
  • Lotka-Volterra: V = d x - c ln x + b y - a ln y is conserved;
  • dense output: y' = -y + sin t has a closed form, checked between the steps (t_eval) for each method;
  • events: a ball dropped from 10 m lands at sqrt(2 h / g), a terminal event located on the dense output; the prey of Lotka-Volterra crosses x = 5 upward once per cycle, a non-terminal event with a direction;
  • a batch: 40 one-compartment pharmacokinetic models against Bateman's closed form;
  • AUTO: Dormand-Prince on Van der Pol with eps = 10−6 detects stiffness and hands over to Radau IIA, and the answer is Radau's own.

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 23–162