← Computational Mathematical Biology

Solving ODEs

Many biological models have the form

\[\frac{dy}{dt}=f(t,y),\qquad y(t_0)=y_0.\]

When no convenient analytical solution exists, numerical methods approximate the trajectory.

Euler method

\[y_{n+1}=y_n+f(t_n,y_n)\Delta t.\]
y[n+1] = y[n] + f(t[n], y[n]) * dt

Adaptive solvers

from scipy.integrate import solve_ivp
sol = solve_ivp(model, [0, 100], y0, rtol=1e-7, atol=1e-9)

Numerical accuracy should be checked by changing tolerances or step sizes and verifying that scientifically relevant outputs remain stable.

Key idea. A numerical ODE solution approximates the continuous model; numerical error should be distinguished from biological model uncertainty.