· 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.

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:

x˙(t)=f(x(t),u(t))\dot{x}(t) = f(x(t), u(t))

However, computers operate in discrete time.
To predict where the system will be after a small time step Δt\Delta t, we must convert continuous dynamics into a discrete update rule:

xk+1xk+tktk+Δtf(x(t),u(t))dtx_{k+1} \approx x_k + \int_{t_k}^{t_k + \Delta t} f(x(t), u(t)) \, dt

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:

p˙(t)=v(t)\dot{p}(t) = v(t)

means “position changes according to velocity,”
but it does not directly give p(t+Δt)p(t + \Delta t).

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.

xk+1=xk+f(xk,uk)Δtx_{k+1} = x_k + f(x_k, u_k)\, \Delta t

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 Δt\Delta t

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.

k1=f(xk,uk)k_1 = f(x_k, u_k) k2=f ⁣(xk+Δt2k1,uk)k_2 = f\!\left(x_k + \frac{\Delta t}{2} k_1,\, u_k\right) k3=f ⁣(xk+Δt2k2,uk)k_3 = f\!\left(x_k + \frac{\Delta t}{2} k_2,\, u_k\right) k4=f ⁣(xk+Δtk3,uk)k_4 = f\!\left(x_k + \Delta t\, k_3,\, u_k\right) xk+1=xk+Δt6(k1+2k2+2k3+k4)x_{k+1} = x_k + \frac{\Delta t}{6}\left(k_1 + 2k_2 + 2k_3 + k_4\right)

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)

p˙(t)=v(t)\dot{p}(t) = v(t) v˙(t)=a(t)\dot{v}(t) = a(t)

where:

  • a(t)a(t): acceleration from IMU
  • v(t)v(t): velocity
  • p(t)p(t): position

Dead Reckoning with Forward Euler

Euler discretization gives:

vk+1=vk+akΔtv_{k+1} = v_k + a_k\, \Delta t pk+1=pk+vkΔtp_{k+1} = p_k + v_k\, \Delta t

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

ScenarioForward EulerRK4
Short horizon, small Δt\Delta tOften OKExcellent
Long dead reckoningPoorBetter (still drifts)
High-curvature motionPoorStrong
Real-time constraintsVery fastSlower
Simulation accuracyLowHigh

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
Back to Blog

Related Posts

View All Posts »
One-shot vs Iteration-based Computation in Control

One-shot vs Iteration-based Computation in Control

This post contrasts one-shot (memoryless) control computation with iteration-based, optimization-driven control such as MPC, clarifying their roles, trade-offs, and practical implications in robotics.

Observability and Controllability in Linear Systems

Observability and Controllability in Linear Systems

Observability and controllability describe whether a system’s internal states can be inferred from outputs or driven by inputs. These concepts form the foundation of estimation and control in robotics and autonomous driving.

Understanding Dynamic Compensation: A Simple Guide

Understanding Dynamic Compensation: A Simple Guide

Compensation techniques such as PD, Lead, PI, and Lag are essential in control engineering. They shape transient response, steady-state error, and stability margins by modifying the frequency characteristics of systems.