Solvers Available in SciPy solve_ivp

The scipy.integrate.solve_ivp function is Python's primary tool for solving initial value problems for systems of ordinary differential equations (ODEs). This article provides a clear overview of the six built-in numerical integration methods available in solve_ivp, breaking down their underlying algorithms, performance characteristics, and ideal use cases for both stiff and non-stiff systems.


Explicit Solvers (For Non-Stiff Problems)

Explicit methods compute the state of a system at a later time from the state of the system at the current time. They are computationally efficient per step but become unstable when applied to stiff ODEs.

1. RK45 (Default)

2. RK23

3. DOP853


Implicit Solvers (For Stiff Problems)

Stiff equations occur when certain components of the solution change much more rapidly than others, requiring explicit methods to take impractically small steps for stability. Implicit solvers evaluate equations at the future time step, requiring system matrix solutions (often using Jacobians) to ensure stability.

4. Radau

5. BDF

6. LSODA


How to Choose a Solver

  1. Start with RK45: If the problem is non-stiff and requires standard precision, RK45 is usually the fastest and easiest option.
  2. Use DOP853 for High Accuracy: If error tolerances are stringent (rtol and atol \(\le 10^{-7}\)), use DOP853.
  3. Switch to Radau or BDF if RK45 Fails or Runs Extremely Slowly: If integration takes an excessive number of steps, the system is likely stiff. Use Radau for strong stability or BDF for large systems.
  4. Use LSODA for Mixed or Unknown Behavior: If you are unsure whether your system exhibits stiff behavior at certain intervals, LSODA provides robust automated switching.