Numerical methods approximate mathematical problems too hard to solve exactly, giving you a usable answer instead of a perfect one. The common mistake is treating the approximation as exact; every method has an error term you must estimate or bound.
This page covers the core methods you will meet in an introductory course: root finding, interpolation, numerical integration, and solving ODEs. You will get the formulas, when to use each, and the pitfalls that cost marks in exams.
Pick the Right Root-Finding Method
Root finding solves f(x) = 0. The method you choose depends on whether you have a derivative and how fast you need convergence.
- Bisection: requires an interval [a, b] where f(a) and f(b) have opposite signs. Halve the interval each step. Slow but guaranteed to converge.
- Newton–Raphson: needs f‘(x). Iterate xn+1 = xn − f(xn)/f‘(xn). Fast (quadratic) but can diverge if the guess is poor.
- Secant: like Newton but approximates the derivative with a finite difference. No derivative needed, but convergence is slower (order ≈ 1.618).
Rule of thumb: if you can compute the derivative easily, use Newton; otherwise use bisection for safety or secant for speed.
Interpolation: Fit a Polynomial Through Points
Interpolation finds a polynomial that passes exactly through given data points. Use it to estimate values between known points.
- Lagrange form: P(x) = Σ yi Li(x), where Li(x) = Πj≠i (x − xj)/(xi − xj). Easy to write, but adding a point means recomputing everything.
- Newton divided differences: builds the polynomial incrementally. Better for adding points later.
Where people go wrong: using a high-degree polynomial through many points causes Runge’s phenomenon—wild oscillations at the ends. For many points, use piecewise linear or cubic splines instead.
Numerical Integration: Approximate the Area
Integration approximates ∫ab f(x) dx. The formulas are simple, but the error depends on the function and step size.
| Method | Formula (n subintervals, h = (b−a)/n) | Error |
|---|---|---|
| Rectangle (left/right) | h Σ f(xi) | O(h) |
| Midpoint | h Σ f(xi+1/2) | O(h²) |
| Trapezoidal | h/2 [f(a) + 2Σf(xi) + f(b)] | O(h²) |
| Simpson’s 1/3 | h/3 [f(a) + 4Σf(odd) + 2Σf(even) + f(b)] | O(h⁴) |
Rule of thumb: Simpson’s rule is exact for polynomials up to degree 3. Use it when the function is smooth; use trapezoidal for noisy data.
Solving Ordinary Differential Equations (ODEs)
For an initial value problem y‘ = f(x, y), y(x0) = y0, you step forward in x with a chosen step size h.
- Euler’s method: yn+1 = yn + h f(xn, yn). Simple, but error O(h).
- Heun’s method (improved Euler): predictor–corrector, error O(h²).
- Runge–Kutta 4th order (RK4): classic, error O(h⁴). The most common choice.
Where people go wrong: choosing too large a step size h makes the solution unstable or inaccurate. Halving h should roughly halve the error for Euler, quarter it for Heun, and divide by 16 for RK4—if not, check the implementation.
Check Your Work: Error and Stability
Always estimate the error. For integration, compare results with two different step sizes (e.g., h and h/2) and use Richardson extrapolation to improve the answer.
For ODEs, check stability: for a linear test equation y‘ = λy, the step size must satisfy a stability condition. For Euler, |1 + hλ| ≤ 1; for RK4, the stability region is larger but still limited.
Rule of thumb: if the solution oscillates wildly or blows up, reduce h and see if the result changes smoothly. If it does not, your method may be unstable.
What about systems of ODEs?
Apply the same methods component-wise. For example, for y‘ = f(x, y, z), z‘ = g(x, y, z), you update both y and z at each step using the same h.
What if the ODE is stiff?
Stiff problems need implicit methods like backward Euler or implicit RK. If explicit methods require absurdly small steps, switch to an implicit solver.
Remember: no numerical method gives the exact answer. Always report the method, the step size, and an error estimate. That is what separates a useful approximation from a guess.
Related
- Chess for Beginners Cheat Sheet: Rules and Moves
- How to Make Crochet Wider: Easy Methods
- How to Monogram on Crochet: Easy Methods
General information for everyday wellbeing, not medical advice. If something affects your health, sleep or mood for more than a short while, talk to a qualified professional. Read more
Spotted an error? Tell us and we will correct it (corrections policy).