Approximate solutions of first-order differential equations using Euler's method. Visualize step-by-step approximations, compare with exact solutions, and understand local/global truncation errors.
Euler's method is the most fundamental numerical technique for solving ordinary differential equations (ODEs) with a given initial value. It was introduced by Leonhard Euler in 1768 in his work Institutiones calculi integralis. Although simple, it forms the basis for more advanced solvers like Runge‑Kutta methods and predictor‑corrector algorithms.
Given dy/dx = f(x, y) with y(x₀) = y₀, the Euler recurrence is:
x_{n+1} = x_n + h, y_{n+1} = y_n + h · f(x_n, y_n)
where h is the step size. The local truncation error per step is O(h²), and the global error is O(h).
Each step uses the tangent line at (xₙ, yₙ) to approximate the solution over the interval [xₙ, xₙ₊₁]. Because the true solution is often curved, the Euler approximation systematically drifts — but reducing step size h improves accuracy proportionally.
The global truncation error at a fixed endpoint is proportional to the step size h (first-order convergence). For stiff equations or large step sizes, Euler's method can become unstable. Nevertheless, it remains an essential pedagogical tool for understanding numerical ODE solving.
| Method Type | Order of Accuracy | Stability Condition | Computational Cost |
|---|---|---|---|
| Explicit Euler | 1st order (O(h)) | Conditionally stable (|1 + hλ| ≤ 1 for test eqn y'=λy) | Very low |
| Improved Euler (Heun) | 2nd order (O(h²)) | Improved stability | Moderate |
| Classical Runge‑Kutta (RK4) | 4th order (O(h⁴)) | Wider stability region | Higher |
Newton's law of cooling: dT/dt = -k(T - Tₐ). Using Euler's method with k = 0.1, Tₐ=25°C, initial T(0)=95°C, step h=1 minute, the method predicts temperature after 20 minutes within ~1.5°C error compared to analytic solution T(t) = Tₐ + (T₀ - Tₐ)e^{-kt}. The calculator above can simulate such ODEs by entering f(t,T) = -0.1*(T-25). This demonstrates practical utility in thermal engineering.