Numerical Foundations & Errors

Every numerical answer is approximate. Learn exact vs approximate solutions, floating-point representation and machine epsilon, round-off and truncation error, absolute and relative error, error propagation, subtractive cancellation, conditioning vs stability, and convergence order.

Simulation software, controllers and spreadsheets all compute with finite precision. Understanding where errors come from — and how they grow — separates trustworthy engineering computation from nonsense with many decimal places.

An analogy

Numerical error is like measuring with a ruler that has a limited number of marks (round-off) and approximating a curved road with straight segments (truncation).

Types of error

Modelling error (wrong physics), data error (measurement), round-off (finite digits), truncation (approximating an infinite process — series, derivatives, integrals — by a finite one).

Floating point

IEEE 754 doubles have 53-bit mantissas (≈ 16 digits). 0.1 + 0.2 = 0.30000000000000004; 10¹⁶ + 1 − 10¹⁶ = 0. Never test floats with ==; use tolerances.

Cancellation

Subtracting nearly equal numbers loses significant digits: (1 − cos x)/x² at x = 10⁻⁸ evaluates to 0 instead of 0.5. Rewrite algebraically: 2 sin²(x/2)/x².

Conditioning, stability, convergence

Conditioning is a property of the problem (sensitivity); stability is a property of the algorithm (does it amplify errors?). Convergence order p tells how fast errors shrink as h → 0 or iterations increase.

Formulas

Worked example: Relative error

Given: π ≈ 22/7

Find: Absolute and relative errors.

Answer: 0.04 % relative error

Worked example: Cancellation

Given: (1 − cos x)/x² at x = 10⁻⁸

Find: Computed vs true.

Answer: 0 (wrong) vs 0.5 (correct)

Common mistakes

Applications

Key takeaways

Going further