MTH 492 · Numerical Methods
Our notes
1 min readWhy systems
Most physical laws are second order (Newton's law, circuits, beams), and many models couple several unknowns (predator-prey, reacting chemicals). Numerical methods are written for first-order systems, so we rewrite everything in that form.
Reducing order
For y″ = f(x, y, y′), set u₁ = y and u₂ = y′. Then:
- u₁′ = u₂
- u₂′ = f(x, u₁, u₂)
An n-th order equation becomes n first-order equations.
Example
The pendulum θ″ + (g/L) sin θ = 0 becomes θ′ = ω, ω′ = −(g/L) sin θ.
Applying RK4 to a system
Treat u = (u₁, u₂) as a vector. Each kᵢ is a vector; every component is updated with the same stage values. In code, write f to return a vector.
Worked example: one Euler step on a system
y″ = −y, y(0) = 0, y′(0) = 1 (exact y = sin x), h = 0.1.
- u₁′ = u₂, u₂′ = −u₁; start (u₁, u₂) = (0, 1).
- Euler: u₁ = 0 + 0.1 × 1 = 0.1; u₂ = 1 + 0.1 × (−0) = 1.
- So y(0.1) ≈ 0.1 (exact sin 0.1 = 0.0998).
Worked example: RK4 on the same system
k₁ = (1, 0); k₂ = (1, −0.05); k₃ = (0.9975, −0.05); k₄ = (0.995, −0.09975).
u₁ = 0 + (0.1/6)(1 + 2 + 1.995 + 0.995) = 0.0998333, against sin 0.1 = 0.0998334. ✓
(Check k₃: u at the midpoint is (0 + 0.05 × 1, 1 + 0.05 × (−0.05)) = (0.05, 0.9975), so k₃ = (0.9975, −0.05).)
Energy and long runs
For oscillators, Euler's method makes the energy grow every step (the orbit spirals out); RK4 loses energy very slowly. For very long simulations (planets, molecular dynamics) special symplectic methods (leapfrog, Verlet) keep the energy bounded.
Boundary value problems are different
If the conditions are given at two ends (y(a) and y(b)), we cannot simply march from one end. That needs the shooting or finite difference methods of the next topics.
Exams usually ask
- Write a higher-order ODE as a first-order system.
- Carry out one RK4 step on a 2 × 2 system.
Common mistake
Updating u₁ first and then using the new u₁ to compute u₂ in the same stage. All components of a stage use the old values.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Numerical methods for ordinary differential equations
(opens en.wikipedia.org in a new tab)
Wikipedia, Numerical methods for ordinary differential equations, 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 Higher-order ODEs and Systems | Lecture 53 | Numerical Methods for Engineers
7 min · ≈ 32 MB · about ₦18
(opens youtube.com in a new tab)
-
The Theory of Higher Order Differential Equations
9 min · ≈ 41 MB · about ₦23
(opens youtube.com in a new tab)
-
7-2 ODE systems and higher order ODEs
15 min · ≈ 68 MB · about ₦38
(opens youtube.com in a new tab)
-
MathTalent Numerical Analysis Sec 5.6 High-Order Equations and Systems of Differential Equations ODE
15 min · ≈ 68 MB · about ₦38
(opens youtube.com in a new tab)
-
Lecture 59: Solution of Higher Order Non-Homogeneous Linear Equations (cont.)
35 min · ≈ 158 MB · about ₦89
(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.