Errors and Error Propagation
Numerical Errors and Error Propagation
Numerical errors and error propagation explain why a computed answer can differ from its target even when a program follows its instructions correctly. You need to identify where an error enters, measure its size, and assess how later calculations amplify it. These habits connect accuracy, limits, and approximations without requiring every calculation to be exact.
Measuring a discrepancy
Let x be a reference value and x^ its approximation. The signed error records direction; its magnitude records absolute error:
Absolute error has the same units as the quantity. To judge the discrepancy relative to the reference scale, use
Relative error is dimensionless and is undefined when the reference is zero. Near zero, it can be large even when the absolute discrepancy is small. Use the reference value in the denominator when calculating true relative error. If the reference is unknown, a comparison between successive approximations is an error indicator, not automatically the true error.
Where numerical errors enter
A round-off error arises when a number or arithmetic result is replaced by a representable value in finite precision. In floating-point arithmetic, some inputs cannot be stored exactly, and operations can introduce further rounding. Decimal and binary systems represent different sets of fractions exactly.
A truncation error arises when an infinite or limiting mathematical procedure is replaced by a finite approximation. Keeping finitely many terms of a Taylor expansion is one example. This error remains even if the retained terms are evaluated with exact arithmetic.
Source | What introduces it? | What can reduce it? |
|---|---|---|
Input error | An inaccurate measurement or supplied value | Better input information |
Round-off error | Finite representation and rounded operations | More precision or a more stable calculation |
Truncation error | Replacing a limiting process with a finite approximation | A more accurate approximation |
Reducing one source can increase another. The figure uses hypothetical dimensionless error scales 0.01h2 and 10−6/h, where h is a computational step. Their sum illustrates a tradeoff; it is not a universal formula for actual numerical error.
Propagating bounded input errors
Suppose y=f(x1,…,xn) and each input changes by a small amount δxi. A first-order expansion gives
If ∣δxi∣≤Bi, an approximate worst-case absolute error bound is
Evaluate the derivatives at the nominal inputs. Absolute values prevent opposite signs from cancelling when you seek a worst case. For a nonzero product or quotient written as y=C∏ixiai,
These are first-order estimates, not guaranteed exact bounds. They require sufficiently small input changes and a smooth function throughout the relevant region. Strong curvature or a denominator approaching zero can make neglected terms important.
Sensitivity and arithmetic choices
A problem's conditioning concerns the mathematical function. A method's stability concerns additional errors introduced while computing it. A sensitive problem can amplify small input errors even when the algorithm performs well.
Subtraction of nearly equal approximations can cause cancellation. The difference is small, so existing absolute errors can become large relative to that difference. The subtraction itself need not introduce a new rounding error for accuracy to be lost.
An algebraically equivalent expression can sometimes avoid the troublesome subtraction. Keep extra digits during intermediate work and round the reported answer at the end, while recognizing that additional digits cannot repair inaccurate inputs.
What to remember
- Measure error against a clearly identified reference and consistent units.
- Separate input, round-off, and truncation errors.
- Use derivatives to estimate propagation of small bounded errors.
- Check sensitivity, cancellation, and the limits of first-order estimates.
Example: Error bounds for a measured speed
A tracking system calculates average speed from v=d/t. Its reported distance is d=12.40 m with an absolute error bound of 0.03 m, and its reported time is t=2.50 s with an absolute error bound of 0.02 s. Treat these as deterministic bounds, with every combination of allowed distance and time possible. Assume arithmetic round-off is negligible.
Here a nominal value is the output calculated from the reported central inputs. Compare a first-order error estimate with a bound obtained from the full input intervals.
a) Calculate the nominal speed.
Substitute the reported distance and time into the speed formula. Both quantities are already in consistent SI units:
The nominal speed is 4.96 m/s. This calculation establishes the central value against which output errors will be measured.
b) Estimate the worst-case absolute speed error using first-order propagation. Retain extra digits to allow comparison in part c.
First calculate the sensitivity to distance:
The distance sensitivity is ________. Next calculate the magnitude of the sensitivity to time:
The time sensitivity magnitude is ________. Its signed derivative is negative because increasing the time while holding distance fixed decreases speed.
Multiply each sensitivity magnitude by its corresponding input error bound:
The distance contribution is ________, and the time contribution is ________. Add these magnitudes for the approximate worst case:
The first-order absolute error estimate is 0.05168 m/s. The derivative signs do not justify subtracting the contributions: a larger distance and a shorter time both raise the calculated speed.
c) Find the exact range of possible speeds and determine whether the first-order estimate guarantees a bound.
The input intervals are
Throughout these positive intervals, speed increases with distance and decreases with time. Therefore, the smallest speed uses the smallest distance and largest time:
The largest speed uses the largest distance and smallest time:
Measure the two endpoint deviations from the nominal speed:
The larger deviation gives the exact maximum absolute error, approximately 0.0520968 m/s. Rounding the interval endpoints outward to four decimal places gives 4.9087 m/s≤v≤5.0121 m/s.
The first-order estimate, 0.05168 m/s, is slightly smaller than the exact maximum deviation. A first-order estimate need not be a guaranteed bound; here the full interval calculation captures the nonlinear effect of the denominator.
A timing routine returns 0.03720 s for a benchmark whose exact reference duration is 37.50 ms. Calculate the absolute relative error as a percentage. Enter your answer in percent, to two decimal places.
A numerical model calculates the dimensionless quantity z=x2/y. Its nominal inputs are x=3.20 and y=1.60, with bounded errors ∣δx∣≤0.02 and ∣δy∣≤0.01. The input errors may vary freely within these bounds.
Find the nominal value of z and its first-order worst-case absolute error bound. Enter both dimensionless quantities to two decimal places; enter the bound as a positive number.