AI Glossary / Mathematics and optimization / Advanced
Dormand - Prince method
Definition
The Dormand - Prince method is an explicit Runge - Kutta method for numerically solving ordinary differential equations with initial values. Its widely used embedded 5(4) pair computes fifth-order and fourth-order approximations from shared derivative evaluations. Their difference estimates local error and helps an adaptive solver choose its step size.
What it means
A differential equation describes how a state changes; a numerical integrator advances that state through time. Dormand - Prince supplies a particular recipe for those advances. It can support simulations used around AI and engineering, but it does not learn the governing equation or establish whether the equation accurately represents reality.
How it works
At each trial step, evaluate the derivative at several intermediate states, then combine those slopes using the method's coefficients. Use the fifth-order result to advance when the estimated error is acceptable; otherwise retry with a smaller step. The two embedded formulas share work rather than running two wholly separate solvers. Absolute and relative tolerances set the scale for judging estimated error. SciPy's RK45 implementation uses this pair and provides quartic interpolation for values within a successful step. Local error control is not a universal bound on accumulated global error.
Three practical examples
- A fictional equipment simulator models the decay of a normalized temperature difference. A trial calculation with a known exponential solution lets the team check its numerical integrator before using a more complicated heat-transfer model.
- A fictional robot simulator advances position and velocity from specified motion equations. If those components have different physical units and scales, the team must choose tolerances accordingly rather than comparing their raw numerical errors as though they were interchangeable.
- A fictional demand-adjustment model uses a continuous-time equation for relaxation toward a baseline. A numerical solver can integrate that equation, but making its time steps smaller does not prove that customers actually follow the assumed dynamics.
Think of it this way
Imagine tracing a curved path with steps of adjustable length. A local check suggests whether a proposed step follows the curve closely enough. Shortening a step can improve the trace, but it cannot correct a map of the wrong route. Similarly, numerical integration error and an inaccurate underlying model require different checks.
Worked example
Consider y'=-y with y(0)=1, whose exact solution is y(t)=exp(-t). Use the standard Dormand - Prince 5(4) coefficients to calculate one trial step of length h=0.5 from the initial state.
The fifth-order approximation is 0.606536458333, and the embedded fourth-order approximation is 0.606505794271. Their absolute difference is 0.0000306640625. For a simplified scalar acceptance rule requiring that difference to be below 0.00001, this trial fails: its normalized error estimate is approximately 3.0664, above 1.
Retry from the original state at t=0 with h=0.25. The fifth-order result is 0.778800862630, and the fourth-order result is 0.778799991353. Their difference is approximately 0.000000871277, giving normalized error about 0.08713. This trial passes the stated rule and advances the state to t=0.25.
The exact value there is approximately 0.778800783071, so the actual error of the fifth-order result is approximately 0.000000079559. This is different from the embedded error estimate. At h=0.5, the fifth-order result's actual error was about 0.00000579862, also different from its estimate.
The retry does not reach t=0.5: it advances only to 0.25. Additional accepted steps are required. The halving decision and absolute-only acceptance rule are chosen for this demonstration, not claimed to reproduce a particular library's full adaptive controller.
Illustrative case study
In a fictional simulation review, an analyst calls the rejected half-unit trial a failed forecast. The reviewer separates three issues. The solver declined that step because the embedded estimate exceeded the chosen local threshold. The equation itself remained valid as a mathematical problem. The comparison with exp(-t) then supplied independent evidence about the numerical result.
The team logs both trial and accepted steps. It retains the original state after rejection and retries from there, preventing the error of continuing from a rejected approximation. Its output also records that the accepted retry ends at 0.25, so downstream code cannot accidentally label the value as belonging to 0.5.
Before using a more realistic model, the team compares results under tighter tolerances and checks meaningful physical quantities. These checks help detect numerical problems, while validation against actual measurements addresses the model's realism. The scenario is illustrative and makes no claim about a deployed forecasting system.
Common misconceptions and mistakes
The difference between the embedded formulas is an error estimate, not the exact error of the accepted fifth-order value. The worked example provides both numbers separately.
A rejected trial must not update the accepted trajectory. Retry from the last accepted state.
The name 5(4) describes method orders, not a promise of exactly five correct decimal places. Requested tolerances also do not guarantee that every final output has a fixed number of accurate digits.
A dense output curve is an interpolation constructed by the solver, not an independently observed trajectory.
Tighter tolerances address numerical accuracy within the specified model; they do not repair incorrect equations, initial conditions, or units.
Business use
For a simulation-dependent decision, record the equation, initial conditions, units, tolerances, and solver completion status. First test a problem with a known solution, as in the exponential example. Then examine whether the decision-relevant output changes materially under stricter numerical settings. Consider computational cost and the equation's properties when choosing a solver; a familiar method name alone does not establish suitability for every dynamic system.
People also ask
Does every trial step become part of the solution?
No. An adaptive controller can reject it and retry.
Are the fourth-order and fifth-order results averaged?
Not in the demonstrated method: the fifth-order result supplies the accepted advance, while their difference informs error control.
Does a small estimated local error prove the physical prediction is right?
No. It addresses numerical integration, not whether the model describes the real system.
Check your understanding
Why was h=0.5 rejected in the example?
Answer: The estimated difference, about 0.0000306641, exceeded 0.00001.
Where does the accepted retry end?
Answer: At t=0.25.
Is its embedded error estimate identical to the exact fifth-order error?
Answer: No; the example gives approximately 8.71e-7 and 7.96e-8 respectively.
Related terms
- Runge–Kutta method
- ordinary differential equation
- initial-value problem
- adaptive step size
- local truncation error
- global error
- error tolerance
- dense output
- numerical integration
Learn next
Repeat the one-step calculation for another step size and compare the embedded estimate with the error against exp(-t). Then study how an adaptive controller combines relative and absolute tolerances and why systems with differently scaled components may need component-specific settings.
More in Mathematics and optimization
- Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
- Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
- Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
- Σ-algebra
- Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
- Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.
Sources
SciPy RK45 documentation, method and tolerance description: https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.RK45.html SciPy 1.18.0 implementation, Dormand–Prince coefficients and step acceptance: https://github.com/scipy/scipy/blob/v1.18.0/scipy/integrate/_ivp/rk.py The exponential example was independently evaluated from the coefficients. Its acceptance rule and business scenarios are original illustrations.