All courses › Numerical Methods
Numerical Methods: free practice, theory and problems
Many practical engineering equations, such as arising from pipe friction, beam stresses or equilibrium points in a process, have no simple formula for the solution. Numerical methods find an approximate root by guessing, checking and gradually improving the guess. The goal is always the same: a number where , within a given tolerance.
Contents
1. Solving equations
What is it about?
Many practical engineering equations, such as arising from pipe friction, beam stresses or equilibrium points in a process, have no simple formula for the solution. Numerical methods find an approximate root by guessing, checking and gradually improving the guess. The goal is always the same: a number where , within a given tolerance.
Concepts and formulas
- Root: a value where .
- Bisection method: requires an interval where and have opposite signs. The midpoint is tested, and the half with the sign change is kept. Number of steps for tolerance : .
- Newton's method: . Requires the derivative and a starting point near the root. Convergence is quadratic (the number of correct digits roughly doubles each step) when it works, but the method can diverge with a poor start or if .
- Secant method: like Newton, but the derivative is replaced by a difference quotient: . Needs two starting points, not the derivative.
- Fixed-point iteration: rewrite as and iterate . Converges if near the root.
- Order of convergence: how quickly the error shrinks. Linear (bisection, fixed point): the error scales by a roughly constant factor each step. Quadratic (Newton): .
How to solve the problems
- Check what is given: an interval (bisection), a function and one starting point with the derivative (Newton), two starting points (secant), or a (fixed point).
- Evaluate (and if needed) at the required points.
- Use the correct update formula and find the next value.
- Repeat until the change is smaller than the tolerance, or the desired number of steps is reached.
Example
Find a root of with Newton's method, starting from .
- and .
- Step 1: .
- Step 2: and , so .
The answer quickly approaches , typical for quadratic convergence.
Common mistakes
- Starting bisection on an interval where and have the same sign.
- Forgetting to check whether is close to zero in Newton's method (the method can then jump far off track).
- Confusing the speed of convergence (how fast) with whether the method converges at all.
- Believing that more decimal places in the intermediate work automatically give a more accurate answer than the method can actually deliver.
Concepts in this part
2. Interpolation and integration
What is it about?
Often you only have a few known points – from a table, a sensor or a calculation – and need a value between them, or the area under a curve you cannot integrate by hand. Interpolation builds a function that passes exactly through the known points, while numerical integration approximates a definite integral by summing the area of simple shapes (rectangles, trapezoids, parabolas).
Concepts and formulas
- Linear interpolation between and : .
- Lagrange interpolation: for points there is a unique polynomial of degree at most passing through all of them. It is built as a sum of basis polynomials , one per point, where and for .
- Runge's phenomenon: high-degree interpolation at evenly spaced points can produce large, unrealistic oscillations near the ends. This is avoided with a lower degree, Chebyshev points, or splines (piecewise polynomials, smooth at the joints).
- Midpoint rule: the simplest quadrature rule, .
- Trapezoidal rule: . Composite, with equal intervals (): . The error is .
- Simpson's rule: uses parabolas over pairs of intervals, exact for polynomials up to degree 3. Composite (requires an even number of intervals): . The error is .
How to solve the problems
- Check what is asked for: an in-between value (interpolation) or an area/integral (quadrature).
- For interpolation: set up the right formula (linear for 2 points, Lagrange/quadratic for 3).
- For integration: find , evaluate the function at every point, and use the correct weighted sum.
- Check whether the method is exact for that type of function (e.g. Simpson is exact for a cubic polynomial).
Example
Interpolate quadratically through , and (i.e. ). Find at with Lagrange's formula.
At : , and . Then , exactly like .
Common mistakes
- Using Simpson's rule with an odd number of intervals (the method requires an even number).
- Believing the trapezoidal rule is exact for a curved function, not just for a straight line.
- Confusing the number of points with the number of intervals ( points give intervals).
- Extrapolating (going outside the data points) and assuming the result is as reliable as interpolation.
Concepts in this part
3. Differential equations and stability
What is it about?
Many physical processes (cooling, electrical circuits, chemical reactions, mechanical vibrations) are described by differential equations with no simple formula for the solution. Numerical solvers build the solution step by step: given at time , they compute an approximation of at . As an engineer you use this to simulate systems over time, for example the temperature in an engine or the current in a circuit.
Concepts and formulas
- Euler's explicit method: . Order 1 (global error ). Simple, but can require a very small .
- Heun's method (improved Euler): a predictor–corrector method of order 2. Predictor: . Corrector: – i.e. the average of the slope at the start and end of the step.
- Backward (implicit) Euler: . appears on both sides, so an equation must be solved. More expensive per step, but stable even for large – important for stiff problems.
- Classic Runge–Kutta (RK4): order 4, uses four evaluations of per step: , , , , and .
- Stiff problem: very different time scales in the same system. Explicit methods then need an unrealistically small to stay stable, even though the accuracy requirement itself does not demand it.
- Stability: for , explicit Euler is stable only when . Implicit methods are stable for much larger .
How to solve the problems
- Identify , the initial value and the step size .
- Choose the right method based on what the problem asks for (Euler, Heun, RK4 or implicit).
- Compute one step at a time, using the result of the previous step as the starting point for the next.
- For stability: form (explicit Euler) and compare it with 1.
Example
Solve , , with one step of Heun's method and .
- , so .
- Predictor: .
- Corrector: , so .
For comparison, explicit Euler gives – Heun's method is more accurate because it uses the average of two slopes.
Common mistakes
- Using instead of the predictor when computing the corrector step in Heun's method.
- Believing implicit Euler is "wrong" because appears on both sides – that is exactly the point, and for a linear problem it can be solved algebraically.
- Using too large an for a stiff problem with an explicit method, and getting a result that "explodes".
- Confusing the number of function evaluations (RK4 uses four per step) with the number of time steps.
Concepts in this part
Example problems with solutions
Here are some of the problems in numerical Methods. In the app, calculation problems get new numbers every time, so you can practise until it sticks – and take a graded practice exam before the real one.
Solving equations: By how much is the uncertainty reduced in each step of the bisection method?
Answer: It is halved
The method is robust but slow (linear convergence).
Interpolation and integration: Which polynomials does Simpson's rule integrate exactly?
Answer: Up to degree 3
It is based on parabolas but gets one degree "for free".
Differential equations and stability: What is the order of the explicit Euler method?
Answer: 1
Global error .
Solving equations: What is the order of convergence of Newton's method near a simple root?
Answer: Quadratic
The number of correct digits roughly doubles with each step.
Matches these university courses
The content covers the syllabus found in engineering degrees, for example:
- TMA4320 (NTNU)