Numerical Errors: Absolute, Relative, Truncation and Round-off
Numerical methods give approximate answers, so we measure how wrong they are. Learn absolute and relative error, truncation error, round-off error and significant digits.
A numerical method rarely returns the exact answer, so the first skill in numerical analysis is measuring the error. If the true value is x and the approximation is x*, the true error is x - x*, the absolute error is |x - x*|, and the relative error is |x - x*| / |x|. The percentage relative error is the relative error times 100. Relative error is usually more useful because it says how big the mistake is compared with the size of the quantity: an absolute error of 1 metre is huge on a 2 metre table and tiny on a 1000 km road.
There are two main sources of error. Round-off error comes from the computer storing numbers with a limited number of digits, for example keeping 3.14159 instead of pi, or keeping 0.1 in binary floating point. Truncation error comes from the method itself, when an infinite process is cut short, for example using only the first few terms of a Taylor series, or replacing a derivative by a finite difference. Making the step smaller usually reduces truncation error but can increase round-off error because more operations are performed.
Significant digits are the digits that carry meaning, counted from the first non-zero digit. When an approximation is correct to n significant digits, the relative error is less than 5 x 10^-n. Chopping drops the extra digits, while rounding picks the nearest value, so rounding gives smaller errors on average. Subtracting two nearly equal numbers is dangerous because the leading digits cancel and the relative error grows sharply (loss of significance).
Key points
- Absolute error = |true - approximate|.
- Relative error = absolute error / |true value|.
- Truncation error comes from the method, round-off error comes from limited digits.
- Rounding is more accurate than chopping.
- Subtracting nearly equal numbers loses significant digits.
Worked example
Take x = 22/7 = 3.142857 as an approximation of pi = 3.141593. Absolute error = |3.141593 - 3.142857| = 0.001264. Relative error = 0.001264 / 3.141593 = 0.000402, which is 0.0402 percent. Since 0.000402 is below 5 x 10^-3 (0.005), the approximation is correct to 3 significant digits.
Common questions
What is the difference between truncation and round-off error?
Truncation error comes from cutting a mathematical process short, such as dropping Taylor series terms. Round-off error comes from storing numbers with limited digits.
How do you compute relative error?
Divide the absolute error by the absolute value of the true value, and multiply by 100 for a percentage.
Related topics
- Bisection Method: Finding Roots by Halving the Interval
- Newton-Raphson Method: Formula, Steps and When It Fails
- Trapezoidal Rule and Simpson Rule: Numerical Integration
- All topics: Numerical Computation
BASMAGLY is an independent student project, not an official Delta University site. Check lectures and your instructor for the final word.