Numerical Methods & Scientific Computing

Adaptive RK45 ODE Solver

Solve a first-order ODE with an embedded Runge–Kutta 5(4) pair. The solver estimates local truncation error on each attempted step, accepts or rejects the step and changes h to meet the selected tolerance.

Numerical ODE workbench

Adaptive RK45 (Dormand–Prince)

embedded 5(4). Solve first-order initial-value problems of the form y′ = f(x,y).

Expression syntax: use explicit multiplication such as 2*y. Supported functions include sin, cos, tan, exp, ln, sqrt and abs.

How this tool works

Dormand–Prince evaluates a common set of stages to produce fifth- and fourth-order estimates. Their difference supplies an error estimate used to scale the next time step.

Example

Try a forced ODE over a long interval. RK45 can take smaller steps where the solution changes rapidly and larger steps where it is smooth.

Common questions

What does the tolerance control?

It sets the scale used by the local error estimator. Smaller tolerances generally increase accepted steps and computation time while improving accuracy.

Why are some steps rejected?

A proposed step is rejected when the embedded error estimate exceeds the requested tolerance. The solver reduces h and tries again.