Mathematics / Adaptive RKF45 Integration
FREE TO EXPLORE
LABORATORY 34 · MATHEMATICS

Adaptive Step-Size Control & Embedded Runge-Kutta-Fehlberg (RKF45)

Implement the embedded Runge-Kutta-Fehlberg (RKF45) algorithm, evaluate the six-stage shared Butcher tableau, compute the embedded local truncation error estimate, and verify the fifth-order O(h⁵) local error scaling governing optimal step-size adaptation. Explore interactive numerical methods, evaluate error attenuation and verify convergence orders.

COMPUTE · CONVERGE · ANALYSE

Your virtual mathematics laboratory.

EMBEDDED LOCAL ERROR ESTIMATE |Y₅ - Y₄|—
COMPUTATION STATUS

Ready to execute Step = 1.

1 step
Embedded Butcher tableau: 6 stages k₁ ... k₆ producing simultaneous 4th-order (y₄) and 5th-order (y₅) solutions

Adjust Step, then execute computation.

Mathematical operations are computed deterministically using 64-bit IEEE 754 precision. Residuals reflect ordinary least-squares regression across successive observations.

Numerical assumptions and limits

RKF45 is an explicit embedded pair; on stiff differential equations, the step controller will drastically shrink h to satisfy stability rather than accuracy. The simulation evaluates the embedded local truncation error of the six-stage RKF45 algorithm across step sizes h = 0.20 / 2^{k-1}. The local error estimate scales with the fifth power of h. The logarithmic regression ln(E_local) = α·ln(h) + ln(C) extracts the asymptotic order α = 5.000 with R² = 1.000000.

Computational tools & numerical modules.

Six-Stage Fehlberg Evaluator

Computes stage slopes k₁ through k₆ according to Erwin Fehlberg's optimal coefficient tableau.

Dual-Order State Combiner

Forms simultaneous 4th-order baseline y₄ and 5th-order reference y₅ without extra function evaluations.

Local Truncation Estimator

Evaluates the embedded difference vector E = y₅ - y₄, measuring leading O(h⁵) local error.

Step Size Adaptation Controller

Implements PI/PID step adjustment h_{opt} = S · h · (TOL / ||E||)^{1/5} to maintain error within specified tolerance.

Step Acceptance Logic Port

Accepts steps where E ≤ TOL and repeats rejected steps with reduced step size h_{new}.

Local Error Scaling Verifier

Performs linear regression on (ln(h), ln(E_local)) to confirm the theoretical fifth-order slope α = 5.000.

FOLLOW THE METHOD

A reason behind every step.

Implement the embedded Runge-Kutta-Fehlberg (RKF45) algorithm, evaluate the six-stage shared Butcher tableau, compute the embedded local truncation error estimate, and verify the fifth-order O(h⁵) local error scaling governing optimal step-size adaptation. Standardized input settings: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 step.

01

Initialize Nonlinear Dynamical Test System

Set up dy/dt = -y² + t on t ∈ [0, 2] with initial state y(0) = 0.5 and user-specified error tolerance TOL = 10⁻⁶.

02

Assign Test Step Sizes

Set step sizes h = 0.20 / 2^{k-1} across refinement settings k = 1 to 6 to analyze local error scaling.

03

Evaluate Six Fehlberg Stages

Compute k₁, k₂, k₃, k₄, k₅, k₆ using Fehlberg's rational weight matrix in 64-bit precision.

04

Extract Embedded Local Error

Compute difference E_local = h |(1/360) k₁ - (128/4275) k₃ - (2197/75240) k₄ + (1/50) k₅ + (2/55) k₆|.

05

Execute Step Adaptation Formula

Calculate recommended next step h_{opt} = 0.9 · h · (TOL / E_local)^{0.2} with safety clamping [0.2, 5.0].

06

Verify Fifth-Order Scaling Exponent

Plot ln(E_local) versus ln(h) and compute the linear regression slope to verify α = 5.000 with R² = 1.000000.

YOUR NOTEBOOK · 0 OBSERVATIONS

Turn measurements into mathematical insight.

See a complete example report ↗

Points are your recorded observations. The solid regression line validates Adaptive RKF45 Integration mathematical scaling.

LINEAR ASYMPTOTIC FIT · y = mx + b
ln(E_local) = α · ln(h) + ln(C)
#Local Step Size Level (k) (step)Embedded Local Error Estimate |y₅ - y₄| (local error)Logarithmic Time Step ln(h)Logarithmic Local Error ln(E_local)Remove

No readings yet. Execute a computation and record it.

Calculate it yourself.

CHECK YOUR UNDERSTANDING

Explain what the mathematical metrics mean.

What is the asymptotic scaling order α of the embedded local truncation error estimate in RKF45 as time step h → 0?

Why is a safety factor S (typically 0.85 to 0.90) included in the step-size adaptation formula?

What does the FSAL (First Same As Last) property in modern embedded pairs (like DOPRI5) accomplish?

What power exponent is used to adjust step size in a fifth-order adaptive method with local error E and tolerance TOL?