MTH 492 · Numerical Methods
Our notes
1 min readThe problem
An initial value problem (IVP): y′ = f(x, y), y(x₀) = y₀. We find approximations yₙ ≈ y(xₙ) at points xₙ = x₀ + nh, with step size h.
Euler's method
yₙ₊₁ = yₙ + h f(xₙ, yₙ): follow the tangent for one step.
- Local truncation error (one step): O(h²).
- Global error (after reaching a fixed x): O(h): halving h only halves the error.
The improved Euler (Heun) method
Predict with Euler, then average the slopes at both ends:
- k₁ = f(xₙ, yₙ)
- k₂ = f(xₙ + h, yₙ + h k₁)
- yₙ₊₁ = yₙ + (h/2)(k₁ + k₂)
Global error O(h²).
Worked example
y′ = x + y, y(0) = 1, h = 0.1. Exact solution y = 2eˣ − x − 1, so y(0.1) = 1.110342.
- Euler: y₁ = 1 + 0.1(0 + 1) = 1.1 (error 0.0103)
- Heun: k₁ = 1; k₂ = f(0.1, 1.1) = 1.2; y₁ = 1 + 0.05(2.2) = 1.11 (error 0.00034)
One step of Heun is thirty times more accurate here, for twice the work.
Order and cost
A method of order p has global error about C hᵖ. Halving h:
| Method | Order | Error falls by |
|---|---|---|
| Euler | 1 | 2 |
| Heun | 2 | 4 |
| RK4 | 4 | 16 |
Stability of a method
Apply a method to the test equation y′ = λy (λ < 0, a decaying solution). Euler gives yₙ₊₁ = (1 + hλ)yₙ, so it only decays if |1 + hλ| < 1, that is h < 2/|λ|. If λ is large and negative (a stiff equation, common in chemical kinetics and circuits), explicit methods need tiny steps; implicit methods such as backward Euler, yₙ₊₁ = yₙ + h f(xₙ₊₁, yₙ₊₁), are stable for any h.
Exams usually ask
- Apply Euler and Heun for two or three steps and compare with the exact solution.
- State the orders of the methods and explain stiffness.
Common mistake
Using yₙ (not the predicted value) inside k₂ of Heun's method. The second slope is taken at the predicted point.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Euler method
(opens en.wikipedia.org in a new tab)
Wikipedia, Euler method, CC BY-SA 4.0 · licence
-
Initial value problem
(opens en.wikipedia.org in a new tab)
Wikipedia, Initial value problem, CC BY-SA 4.0 · licence
-
NOUN MTH 307: Numerical Analysis II
NOUN course book (PDF, about 0.6 MB). Initial and boundary value problems, finite differences, Laplace's equation on a rectangle.
(opens nou.edu.ng in a new tab)
Watch
-
Best pick Initial Value Problem
6 min · ≈ 27 MB · about ₦15
(opens youtube.com in a new tab)
-
(1.7) Introduction to Euler's Method to Approximate a Solution to an Initial Value Problem
7 min · ≈ 32 MB · about ₦18
(opens youtube.com in a new tab)
-
Boundary and Initial Value Problems | Lecture 60 | Numerical Methods for Engineers
5 min · ≈ 23 MB · about ₦13
(opens youtube.com in a new tab)
-
Euler's Method
17 min · ≈ 77 MB · about ₦43
(opens youtube.com in a new tab)
-
EULER'S METHOD FOR SOLVING FIRST-ORDER INITIAL VALUE PROBLEMS IN ORDINARY DIFFERENTIAL EQUATIONS.
44 min · ≈ 198 MB · about ₦111
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.