· Hankyu Kim · Control · 3 min read
Forward Euler vs RK4 – Time Integration through Dead Reckoning
Forward Euler and Runge–Kutta are fundamental time-integration methods for continuous dynamics. This post explains their differences intuitively and illustrates why integrator choice matters using dead reckoning when GPS is unavailable.
Introduction
In robotics and autonomous driving, many systems are naturally described in continuous time:
However, computers operate in discrete time.
To predict where the system will be after a small time step , we must convert continuous dynamics into a discrete update rule:
This post compares two classic numerical integrators:
- Forward Euler (simple and fast)
- Runge–Kutta 4th order (RK4) (more accurate and stable)
and explains why the choice matters using a concrete example: dead reckoning when GPS is unavailable (e.g., inside a tunnel).
Time Integration as State Propagation
A continuous-time model tells us the rate of change, not the next state.
For example:
means “position changes according to velocity,”
but it does not directly give .
Numerical integration answers the question:
Given the current state and its rate of change, where will the system be after a short time?
In estimation and control, this step is often called state propagation.
Forward Euler
Forward Euler is the simplest possible integrator.
It assumes the derivative at the beginning of the interval stays constant over the entire step.
Intuition
- Evaluate the slope once at the start
- Assume it remains constant over the step
- Move forward in a straight line
Characteristics
- Very simple and fast
- Low accuracy
- Errors accumulate quickly
- Highly sensitive to step size
A useful mental model:
Forward Euler follows the tangent line and hopes the curve does not bend too much.
Runge–Kutta (RK4)
RK4 improves accuracy by sampling the slope multiple times within a single time step.
Intuition
- Sample the slope at the start, middle, and end
- Capture how the trajectory curves within the step
- Advance using an averaged direction
A good mental model:
RK4 tries to follow the curve itself, not just the initial tangent.
Characteristics
- Much higher accuracy
- More stable for nonlinear dynamics
- Higher computational cost (four evaluations per step)
Dead Reckoning: A Concrete Example
Dead reckoning estimates position without external correction, using only onboard sensors.
Typical setup:
- IMU measures acceleration (noisy, biased)
- Acceleration is integrated to velocity
- Velocity is integrated to position
This is fundamentally a time-integration problem.
Continuous-Time Model (Simplified 1D)
where:
- : acceleration from IMU
- : velocity
- : position
Dead Reckoning with Forward Euler
Euler discretization gives:
What happens in practice?
- Acceleration noise or bias is integrated once → velocity drift
- Velocity drift is integrated again → position drift
- Errors grow rapidly over time
This explains why Euler-based dead reckoning diverges quickly in long tunnels.
Dead Reckoning with RK4
With RK4:
- Acceleration is sampled multiple times per step
- Motion curvature (braking, turning) is better captured
- Drift accumulates more slowly
However, RK4 does not eliminate drift:
- Bias remains bias
- Noise remains noise
- Integration still amplifies both
External correction (GPS, vision, map matching) is eventually required.
Key Insight
Forward Euler and RK4 do not change the system model.
They change how faithfully we follow the system’s evolution in time.
Dead reckoning failure is not only a sensor problem — it is also an integration problem.
When the Choice Matters
| Scenario | Forward Euler | RK4 |
|---|---|---|
| Short horizon, small | Often OK | Excellent |
| Long dead reckoning | Poor | Better (still drifts) |
| High-curvature motion | Poor | Strong |
| Real-time constraints | Very fast | Slower |
| Simulation accuracy | Low | High |
In practice:
- Euler is common for quick prototyping
- RK4 is preferred for accurate simulation and estimation
Summary
- Time integration converts continuous dynamics into discrete states
- Forward Euler is simple but error-prone
- RK4 is more accurate and stable
- Dead reckoning highlights how integration choice affects drift
- Numerical integration quality directly impacts reliability in physical AI systems
Understanding time integration bridges:
- differential equations
- state propagation
- estimation drift
- real-world autonomy