ENG 303 · Engineering Mathematics V (Numerical Methods and Computer Application)
Our notes
2 min readDifference equations
A difference equation links terms of a sequence, for example yₙ₊₂ − 5yₙ₊₁ + 6yₙ = 0. Try yₙ = rⁿ: r² − 5r + 6 = 0, so r = 2 or 3, and yₙ = A·2ⁿ + B·3ⁿ.
Worked example. With y₀ = 2, y₁ = 5: A + B = 2 and 2A + 3B = 5 give A = B = 1, so yₙ = 2ⁿ + 3ⁿ. Check y₂: formula 4 + 9 = 13; recurrence 5 × 5 − 6 × 2 = 13. ✓
Numerical methods for ODEs are themselves difference equations, which is why their stability can be studied this way.
Euler's method
For y′ = f(x, y), y(x₀) = y₀: yₙ₊₁ = yₙ + h f(xₙ, yₙ). First order (global error ∝ h).
Worked example. y′ = y, y(0) = 1, h = 0.1: y₁ = 1 + 0.1 × 1 = 1.1; y₂ = 1.1 + 0.11 = 1.21. True y(0.2) = e^0.2 = 1.221403.
Heun's (improved Euler) method
Predict with Euler, then average the slopes: yₙ₊₁ = yₙ + (h/2)[f(xₙ, yₙ) + f(xₙ₊₁, yₙ + hf(xₙ, yₙ))]. Second order. For the example: y₁ = 1 + 0.05(1 + 1.1) = 1.105.
Classical fourth-order Runge-Kutta (RK4)
k₁ = f(xₙ, yₙ)
k₂ = f(xₙ + h/2, yₙ + hk₁/2)
k₃ = f(xₙ + h/2, yₙ + hk₂/2)
k₄ = f(xₙ + h, yₙ + hk₃)
yₙ₊₁ = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)
Worked example. y′ = y, y(0) = 1, h = 0.1: k₁ = 1; k₂ = 1.05; k₃ = 1 + 0.05 × 1.05 = 1.0525; k₄ = 1 + 0.1 × 1.0525 = 1.10525.
y₁ = 1 + (0.1/6)(1 + 2.1 + 2.105 + 1.10525) = 1 + (0.1/6)(6.31025) = 1.105171, matching e^0.1 = 1.105171 to six figures. Error ∝ h⁴.
Step size and stability
For y′ = −λy (λ > 0), Euler's method gives yₙ₊₁ = (1 − λh)yₙ, which blows up unless h < 2/λ. "Stiff" problems (very fast and slow parts together, as in chemical kinetics) need implicit methods (backward Euler) or tiny steps. Adaptive methods (such as RK45) change h to keep the estimated error within a tolerance.
Systems and higher-order ODEs
A second-order ODE such as y″ + 3y′ + 2y = 0 becomes two first-order ones: y′ = v, v′ = −3v − 2y; apply RK4 to the pair, updating both together at each stage.
Exams usually ask: solve a linear difference equation; carry out Euler, Heun or RK4 steps; compare with the exact solution; convert a second-order ODE to a system; explain stability limits.
Common mistake: in RK4, evaluating k₂ at yₙ + hk₁ instead of yₙ + hk₁/2. The middle slopes use half steps.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick Kaw, Numerical Methods with Applications: Runge-Kutta 4th order method
Textbook chapter (PDF, about 1 MB) with worked examples and a short quiz at the end.
(opens nm.mathforcollege.com in a new tab)
Kaw, Numerical Methods with Applications, Kaw, Numerical Methods with Applications: Runge-Kutta 4th order method, CC BY-NC-ND 4.0 · licence
-
Kaw, Numerical Methods with Applications: Euler's method
Textbook chapter (PDF, about 0.8 MB) with worked examples and a short quiz at the end.
(opens nm.mathforcollege.com in a new tab)
Kaw, Numerical Methods with Applications, Kaw, Numerical Methods with Applications: Euler's method, CC BY-NC-ND 4.0 · licence
-
Runge–Kutta methods
(opens en.wikipedia.org in a new tab)
Wikipedia, Runge–Kutta methods, CC BY-SA 4.0 · licence
-
Recurrence relation
(opens en.wikipedia.org in a new tab)
Wikipedia, Recurrence relation, 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)
-
Kaw, Numerical Methods with Applications (the whole free textbook)
Every chapter as a separate PDF (0.2 to 1.5 MB each), with videos and quizzes for each method.
(opens nm.mathforcollege.com in a new tab)
Kaw, Numerical Methods with Applications, Kaw, Numerical Methods with Applications (the whole free textbook), CC BY-NC-ND 4.0 · licence
Watch
-
Chapter 08.02: Lesson: Euler's Method: Derivation
10 min · ≈ 45 MB · about ₦25
(opens youtube.com in a new tab)
-
Chapter 08.04: Lesson: Runge Kutta 4th Order Method: Formulas
10 min · ≈ 45 MB · about ₦25
(opens youtube.com in a new tab)
-
Chapter 08.04: Lesson: Runge Kutta 4th Order Method: Example Part 1 of 2
10 min · ≈ 45 MB · about ₦25
(opens youtube.com in a new tab)
-
Runge-Kutta Integrator Overview: All Purpose Numerical Integration of Differential Equations
30 min · ≈ 135 MB · about ₦76
(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.