ode solvers
Euler's Method
You should know: first order differential equation, numerical methods
Overview
Euler's method is the simplest numerical technique for solving an initial value problem y′ = f(t, y), y(t₀) = y₀. It approximates the solution curve by taking small steps of size h, at each step moving in the direction given by the current slope f(t, y) as if that slope stayed constant over the whole step. Starting from the known initial point, this produces a sequence of points that traces out an approximate solution. Euler's method is simple to derive and implement but only first-order accurate (global error O(h)), so in practice it is mainly a pedagogical stepping stone to higher-order methods like Runge–Kutta, which achieve far better accuracy for the same step size.
Intuition
Imagine you know your current position and your current velocity (the slope f(t,y)), but not how the velocity will change. The simplest guess for where you'll be a short time later is to assume the velocity stays constant over that short interval and just walk in a straight line at that speed. Euler's method does exactly this: it uses the slope at the start of each small step to project forward, then recomputes the slope at the new point and repeats. Because the true slope actually curves within each step, the straight-line steps drift from the true solution — an error that accumulates but shrinks as the steps get smaller.
Formal Definition
Given y′ = f(t, y) with y(t₀) = y₀ and step size h, Euler's method advances the approximation tₙ, yₙ by:
Worked Examples
Here f(t,y) = y. Step 1: from (t₀,y₀) = (0,1).
Step 2: from (t₁,y₁) = (0.1, 1.1).
Compare with the exact value e^{0.2} ≈ 1.221403.
Answer: Euler estimate y(0.2) ≈ 1.21 vs. exact ≈ 1.221403 (error ≈ 0.0114, about 0.93%).
Practice Problems
Use Euler's method with h = 0.1 to take one step approximating y(0.1) for y′ = 2t, y(0) = 0.
A tank drains according to y′ = −0.2y (y = volume in liters). Starting at y(0) = 100 L, use Euler's method with h = 1 to estimate the volume after 2 hours.
Euler's method has global truncation error of order:
Quiz
Summary
- Euler's method steps forward using the current slope: y_{n+1} = y_n + h·f(t_n, y_n).
- It is only first-order accurate (global error O(h)), so small step sizes are needed for good accuracy.
- It is the simplest ODE solver and the conceptual starting point for higher-order methods like Runge–Kutta.
References
- WebsiteWikipedia — Euler method
Mathematics