The Central Idea
Suppose the exact quantity is \(x\), but we use an approximation \(\tilde{x}\).
The error is
\[ e=\tilde{x}-x. \]Numerical analysis asks several questions:
- How large is \(e\)?
- What caused it?
- How does it affect later calculations?
- Can the final result still be trusted?
- Can the error be bounded or reduced?
Error Does Not Mean Mistake
In numerical analysis, error usually means the difference between an exact mathematical quantity and an approximation.
It does not necessarily mean that someone made a mistake.
For example,
\[ \pi\approx3.14 \]contains approximation error even though the approximation may be intentional and useful.
Exact Value, Approximate Value, and Error
Let
\[ x=2.718281828\ldots \]and suppose we use
\[ \tilde{x}=2.718. \]Then the signed error is
\[ e=\tilde{x}-x. \]
Because \(\tilde{x}
Absolute Error
The absolute error ignores the sign and measures the size of the discrepancy:
\[ \boxed{E_{\text{abs}}=|x-\tilde{x}|}. \]Absolute error uses the same units as the quantity itself.
If a measured length is off by \(0.02\) meter, then the absolute error is
\[ 0.02\text{ m}. \]Relative Error
Absolute error does not tell us whether the error is large compared with the quantity being measured.
The relative error is
\[ \boxed{E_{\text{rel}}=\frac{|x-\tilde{x}|}{|x|}}, \]provided \(x\neq0\).
Relative error is dimensionless and gives the error in proportion to the size of the exact quantity.
Percentage Error
Relative error is often expressed as a percentage:
\[ \boxed{E_{\%}=100E_{\text{rel}}\%}. \]For example, a relative error of
\[ 0.0025 \]corresponds to
\[ \boxed{0.25\%}. \]Example: Absolute and Relative Error
Suppose the exact value is
\[ x=50 \]and the approximation is
\[ \tilde{x}=49.8. \]The absolute error is
\[ |50-49.8|=0.2. \]The relative error is
\[ \frac{0.2}{50}=0.004. \]Therefore, the percentage error is
\[ \boxed{0.4\%}. \]Why Relative Error Often Matters More
An absolute error of \(1\) can have very different meanings.
If the exact quantity is
\[ 1000000, \]then an error of \(1\) is relatively tiny.
If the exact quantity is
\[ 2, \]then an error of \(1\) is enormous.
Relative error places the discrepancy in scale.
The Major Sources of Numerical Error
Several recurring sources of error appear throughout numerical work.
- measurement and data error;
- modeling error;
- representation and rounding error;
- truncation error;
- iteration error;
- algorithmic amplification of existing error.
A reliable analysis separates these sources whenever possible.
Measurement Error
Physical data are often measured rather than known exactly.
A measured length reported as
\[ 2.37\text{ m} \]may actually represent an interval of plausible values rather than one exact length.
Numerical methods cannot recover information that was never present in the original data.
Modeling Error
A mathematical model deliberately simplifies reality.
For example, a projectile model may neglect:
- air resistance;
- wind;
- rotation;
- variation in gravitational acceleration.
Even if the equations are solved exactly, the model can still differ from the physical system.
Representation Error
A finite-precision computer cannot represent every real number exactly.
If \(x\) is replaced by its floating-point representation \(\operatorname{fl}(x)\), then
\[ x\longrightarrow \operatorname{fl}(x) \]may introduce representation error before any arithmetic begins.
The previous lesson developed this source in detail.
Rounding Error
Rounding error occurs when a value is replaced by a nearby representable value.
If a system keeps only four significant decimal digits, then
\[ 7.28364 \]may be stored as
\[ \boxed{7.284}. \]Every later calculation begins with that rounded approximation.
Truncation Error
Truncation error appears when an infinite mathematical process is replaced by a finite one.
For example,
\[ e^x = 1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots \]is an infinite series.
If we stop after the quadratic term,
\[ e^x\approx1+x+\frac{x^2}{2}, \]the omitted remainder creates truncation error.
Iteration Error
Iterative methods approach a solution through a sequence
\[ x_0,x_1,x_2,\ldots \]rather than reaching the answer in one exact step.
If the process is stopped at \(x_n\), the remaining difference from the desired limiting solution is an iteration error.
Error Can Be Present Before the Algorithm Starts
A common mistake is to blame every discrepancy on the numerical algorithm.
But the input may already contain:
- measurement uncertainty;
- rounded constants;
- estimated parameters;
- simplified model assumptions.
The algorithm inherits these uncertainties.
Propagation of Error
Error propagation describes how uncertainty or approximation in inputs affects the result of later calculations.
Suppose
\[ y=f(x) \]and \(x\) is replaced by \(x+\Delta x\).
Then the output changes by
\[ \Delta y=f(x+\Delta x)-f(x). \]Numerical analysis studies the relationship between \(\Delta x\) and \(\Delta y\).
Linear Approximation of Propagated Error
For sufficiently small \(\Delta x\), differentiability gives
\[ f(x+\Delta x) \approx f(x)+f'(x)\Delta x. \]Therefore,
\[ \boxed{\Delta y\approx f'(x)\Delta x}. \]The derivative measures how strongly a small input error is transmitted into the output.
Absolute Error Propagation Through a Function
If the input uncertainty satisfies
\[ |\Delta x|\le \varepsilon_x, \]then, for small perturbations,
\[ |\Delta y| \approx |f'(x)|\,|\Delta x|. \]Thus a useful local estimate is
\[ \boxed{|\Delta y|\lesssim |f'(x)|\varepsilon_x}. \]Example: Squaring an Approximate Number
Let
\[ y=x^2. \]Then
\[ y'=2x. \]A small input error \(\Delta x\) therefore produces approximately
\[ \boxed{\Delta y\approx2x\Delta x}. \]At \(x=100\), even a small absolute error in \(x\) is magnified by a factor of about \(200\) in the absolute output error.
Relative Error Propagation Through Powers
Suppose
\[ y=x^n. \]Differentiating gives
\[ dy=nx^{n-1}dx. \]Divide by \(y=x^n\):
\[ \frac{dy}{y} = n\frac{dx}{x}. \]Thus, for small errors,
\[ \boxed{\frac{\Delta y}{y}\approx n\frac{\Delta x}{x}}. \]The relative error is approximately multiplied by \(|n|\).
Error in Sums and Differences
Suppose
\[ z=x+y. \]If the approximations carry errors \(e_x\) and \(e_y\), then
\[ \tilde{z} = (x+e_x)+(y+e_y). \]Therefore,
\[ \boxed{e_z=e_x+e_y}. \]In absolute value,
\[ |e_z| \le |e_x|+|e_y|. \]Error Bounds for Addition
If
\[ |e_x|\le \varepsilon_x \]and
\[ |e_y|\le \varepsilon_y, \]then
\[ \boxed{|e_{x+y}|\le \varepsilon_x+\varepsilon_y}. \]This is a worst-case bound. The actual errors may partially cancel.
Error in Subtraction
For
\[ z=x-y, \]the propagated signed error is
\[ e_z=e_x-e_y. \]Therefore,
\[ \boxed{|e_z|\le |e_x|+|e_y|}. \]Absolute error is still controlled by the sum of the input error magnitudes.
Why Subtraction Can Be More Dangerous Than Addition
Subtraction becomes numerically delicate when two nearly equal numbers are subtracted.
If
\[ x\approx y, \]then
\[ x-y \]may be very small.
Even modest absolute input errors can then become very large relative to the small result.
Catastrophic Cancellation
Catastrophic cancellation occurs when subtraction of nearly equal quantities destroys many significant digits.
Suppose the exact values are
\[ x=1.234567 \]and
\[ y=1.234566. \]Their exact difference is
\[ 0.000001. \]If both values are rounded too coarsely before subtraction, that tiny difference can be severely distorted or lost entirely.
Error in Products
Suppose
\[ z=xy \]and the inputs become \(x+\Delta x\) and \(y+\Delta y\).
Then
\[ (x+\Delta x)(y+\Delta y) = xy+y\Delta x+x\Delta y+\Delta x\Delta y. \]Thus,
\[ \Delta z = y\Delta x+x\Delta y+\Delta x\Delta y. \]First-Order Product Error
When \(\Delta x\) and \(\Delta y\) are small, the product
\[ \Delta x\Delta y \]is second-order and often much smaller than the first-order terms.
Therefore,
\[ \boxed{\Delta z\approx y\Delta x+x\Delta y}. \]Dividing by \(z=xy\) gives
\[ \boxed{ \frac{\Delta z}{z} \approx \frac{\Delta x}{x} + \frac{\Delta y}{y} }. \]Relative Errors in Products Approximately Add
The first-order product formula explains a widely useful rule:
\[ \boxed{ \text{relative error in a product} \approx \text{sum of the relative input errors} }. \]This approximation is especially useful when the input errors are small.
Error in Quotients
Suppose
\[ z=\frac{x}{y}, \qquad y\neq0. \]A first-order differential calculation gives
\[ \frac{dz}{z} \approx \frac{dx}{x} - \frac{dy}{y}. \]For error magnitudes, a useful bound is
\[ \boxed{ \left|\frac{\Delta z}{z}\right| \lesssim \left|\frac{\Delta x}{x}\right| + \left|\frac{\Delta y}{y}\right| }. \]Division by a Small Quantity
Division becomes sensitive when the denominator is close to zero.
For
\[ z=\frac{x}{y}, \]small perturbations in \(y\) can have a large effect when \(|y|\) is small.
This is one reason near-zero denominators require special attention in numerical algorithms.
Functions of Several Variables
Suppose
\[ z=f(x_1,x_2,\ldots,x_n). \]For small perturbations,
\[ \Delta z \approx \frac{\partial f}{\partial x_1}\Delta x_1 + \frac{\partial f}{\partial x_2}\Delta x_2 +\cdots+ \frac{\partial f}{\partial x_n}\Delta x_n. \]Each partial derivative measures sensitivity to one input while the others are held fixed.
A Multivariable Error Bound
Taking absolute values gives the first-order estimate
\[ \boxed{ |\Delta z| \lesssim \sum_{i=1}^{n} \left| \frac{\partial f}{\partial x_i} \right| |\Delta x_i| }. \]This gives a practical way to combine bounded input uncertainties.
Example: Area from Measured Dimensions
Let
\[ A=LW. \]Then
\[ dA=W\,dL+L\,dW. \]Dividing by \(A=LW\),
\[ \frac{dA}{A} = \frac{dL}{L} + \frac{dW}{W}. \]Thus the relative error in area is approximately the sum of the relative errors in length and width.
Example: Volume of a Sphere
The volume is
\[ V=\frac43\pi r^3. \]Differentiating,
\[ dV=4\pi r^2\,dr. \]Divide by \(V\):
\[ \frac{dV}{V} = 3\frac{dr}{r}. \]Therefore,
\[ \boxed{ \text{relative error in }V \approx 3\times \text{relative error in }r }. \]Forward Error
Suppose the exact problem has exact solution \(y\), while an algorithm returns \(\tilde{y}\).
The forward error measures the difference between the computed and exact outputs:
\[ \boxed{|\tilde{y}-y|}. \]Forward error asks:
How close is the computed answer to the true answer?
Backward Error
Backward error asks a different question.
Instead of comparing outputs directly, we ask:
For what nearby input would the computed result be exact?
If \(\tilde{y}\) is exactly the solution to a slightly perturbed problem, the algorithm may be considered backward accurate even when the exact output is difficult to obtain directly.
Why Backward Error Is Useful
Suppose we want to solve
\[ f(x)=b. \]An algorithm returns \(\tilde{x}\).
Instead of asking only how far \(\tilde{x}\) is from the exact solution, we may ask how much \(b\) would need to change so that
\[ f(\tilde{x})=b+\Delta b \]holds exactly.
A small \(\Delta b\) indicates a small backward error.
Residual
For an approximate solution \(\tilde{x}\) to
\[ f(x)=0, \]the residual is
\[ \boxed{r=f(\tilde{x})}. \]A small residual means the approximate solution nearly satisfies the equation.
However, a small residual does not automatically guarantee a small forward error.
Small Residual Does Not Always Mean Small Solution Error
Suppose \(f\) is nearly flat near the solution.
Then a large change in \(x\) may produce only a small change in \(f(x)\).
In such a case,
\[ |f(\tilde{x})| \]can be small even though \(\tilde{x}\) is not especially close to the exact root.
This leads directly toward the study of conditioning.
Conditioning and Error Propagation
Some problems naturally amplify input error more than others.
This sensitivity belongs to the problem, not necessarily to the algorithm.
A well-conditioned problem changes only modestly when the input changes slightly.
An ill-conditioned problem can change dramatically under tiny perturbations.
A Local Sensitivity Measure
For
\[ y=f(x), \]the derivative
\[ f'(x) \]measures local absolute sensitivity.
A large value of
\[ |f'(x)| \]means small absolute input errors can create larger absolute output changes.
Relative Condition Measure
For a scalar differentiable function with \(x\neq0\) and \(f(x)\neq0\), a local relative sensitivity measure is
\[ \boxed{ \kappa(x) = \left| \frac{x f'(x)}{f(x)} \right| }. \]It connects relative input error to relative output error approximately:
\[ \frac{|\Delta y|}{|y|} \approx \kappa(x) \frac{|\Delta x|}{|x|}. \]Example: Conditioning of \(f(x)=x^2\)
Let
\[ f(x)=x^2. \]Then
\[ f'(x)=2x. \]Therefore,
\[ \kappa(x) = \left| \frac{x(2x)}{x^2} \right| = \boxed{2}. \]Small relative input errors are approximately doubled in the output.
Algorithmic Stability
Even when a problem is well-conditioned, a poor algorithm may magnify rounding or intermediate errors.
Stability describes how an algorithm manages unavoidable perturbations during computation.
A stable algorithm generally does not introduce disproportionate additional error beyond the sensitivity already present in the problem.
Problem Sensitivity and Algorithm Stability Are Different
Two distinct questions must be kept separate.
- Conditioning: Is the mathematical problem sensitive to small input changes?
- Stability: Does the numerical method control the errors created during computation?
The next lesson will develop this distinction systematically.
Error Accumulation Across Many Steps
A long computation may perform thousands or millions of operations.
Each operation may introduce a small rounding error.
The final error depends on how these local errors interact:
- some may cancel;
- some may reinforce one another;
- some may be damped;
- some may be amplified by the algorithm.
Worst-Case Error Bounds
If several independent contributions satisfy
\[ |e_i|\le \varepsilon_i, \]then the triangle inequality gives
\[ \left| \sum_{i=1}^{n}e_i \right| \le \sum_{i=1}^{n}|e_i| \le \sum_{i=1}^{n}\varepsilon_i. \]This produces a safe worst-case bound, although the actual error may be much smaller.
Why Worst-Case Bounds Can Be Conservative
Worst-case analysis assumes the errors align in the most damaging possible direction.
In real computations, signs may vary and partial cancellation may occur.
Therefore,
\[ \sum |e_i| \]is often larger than the observed total error.
A conservative bound is still valuable when reliability must be guaranteed.
Significant Digits and Error
If an approximation is accurate to several significant digits, its relative error must be correspondingly small.
Numerical analysis often uses relative error to assess how many leading digits can be trusted.
The exact relationship depends on the rounding convention and the position of the leading digits, but the principle is simple:
smaller relative error means more reliable significant digits.
Errors in Constants
Constants may also be rounded.
For example, using
\[ \pi\approx3.14 \]rather than a higher-precision approximation introduces a known input error.
In repeated or sensitive calculations, even a small constant error can propagate substantially.
Errors in Coefficients
Consider a polynomial
\[ p(x)=a_0+a_1x+\cdots+a_nx^n. \]If the coefficients \(a_i\) are measured, estimated, or rounded, the polynomial itself is perturbed.
Numerical analysis must sometimes distinguish between:
- error in the input variable \(x\);
- error in the coefficients \(a_i\);
- error introduced while evaluating the polynomial.
Errors in Repeated Addition
Repeatedly summing many floating-point values can accumulate rounding error.
The order of summation may matter because floating-point addition is not exactly associative.
Thus,
\[ (a+b)+c \]and
\[ a+(b+c) \]may produce slightly different stored results.
Summing Numbers of Very Different Magnitudes
If a very small number is added to a very large number, the smaller contribution may be below the available floating-point spacing.
The small addend can then disappear after rounding.
This is why numerical summation strategies often pay attention to magnitude and ordering.
Error Growth in Recurrence Relations
A recurrence computes each new value from earlier approximations:
\[ x_{n+1}=F(x_n). \]If \(x_n\) contains error, then \(x_{n+1}\) begins with that inherited error before new rounding occurs.
Depending on \(F\), errors may shrink, remain comparable, or grow rapidly.
A Simple Recurrence Error Model
Suppose
\[ x_{n+1}=ax_n. \]If the current error is \(e_n\), then the inherited part of the next error is approximately
\[ ae_n. \]Therefore:
- if \(|a|<1\), inherited error tends to shrink;
- if \(|a|=1\), it tends to persist;
- if \(|a|>1\), it tends to grow.
Local Error and Global Error
In step-by-step numerical methods, two ideas often appear.
Local error measures the error introduced in one step, often assuming the step begins from exact data.
Global error measures the accumulated discrepancy after many steps.
A method can have tiny local errors that still accumulate into a meaningful global error.
Truncation Error in Taylor Approximation
Suppose
\[ f(x) = f(a)+f'(a)(x-a)+\frac{f''(a)}{2!}(x-a)^2+\cdots. \]If we retain only the first \(n\) terms, the omitted remainder is the truncation error.
Taylor's theorem provides a structured way to bound that remainder under suitable smoothness assumptions.
Example: Approximating \(e^{0.1}\)
Using
\[ e^x = 1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots, \]a second-order approximation at \(x=0.1\) is
\[ 1+0.1+\frac{0.1^2}{2}. \]Therefore,
\[ \boxed{e^{0.1}\approx1.105}. \]The difference between this and the exact exponential value includes truncation error.
Rounding Error and Truncation Error Can Compete
Numerical methods often involve a tradeoff.
Taking more steps or retaining more terms can reduce truncation error.
But additional arithmetic may introduce more rounding error.
A method must therefore balance approximation quality against finite-precision effects.
Stopping Too Early
If an iterative method is terminated prematurely, the iteration error may still be large.
For example, stopping after only a few root-finding iterations may produce a residual that is not yet within the required tolerance.
A good stopping rule links computational effort to a measurable error target.
Stopping Too Late
More iterations are not always automatically better.
Once the method reaches the practical precision limit of the computation, additional steps may:
- fail to improve the result;
- waste computation;
- amplify accumulated rounding;
- trigger numerical instability.
Error Bounds
An error bound does not necessarily give the exact error.
Instead, it guarantees that the error is no larger than some quantity:
\[ \boxed{|x-\tilde{x}|\le B}. \]Error bounds are central to trustworthy numerical computation because the exact answer is often unknown.
A Priori Error Estimates
An a priori estimate is obtained before the full numerical computation is completed.
It may depend on:
- the method;
- step size;
- derivative bounds;
- problem parameters;
- known convergence rates.
A priori analysis helps choose a method and computational resolution.
A Posteriori Error Estimates
An a posteriori estimate uses information obtained during or after the computation.
Examples include:
- residuals;
- differences between successive iterates;
- comparison of coarse and refined approximations;
- embedded error estimates.
These estimates support adaptive numerical methods.
Absolute Tolerance
An absolute stopping condition may require
\[ |e|\le \tau_{\text{abs}}. \]This is appropriate when a fixed error scale has a direct practical meaning.
For example, a geometric computation might require accuracy within
\[ 10^{-4}\text{ m}. \]Relative Tolerance
A relative criterion may require
\[ \frac{|e|}{|x|} \le \tau_{\text{rel}}. \]This is useful when the acceptable error should scale with the magnitude of the quantity.
Combined Tolerances
Near zero, relative error can become awkward because division by a very small reference value magnifies the ratio.
Practical numerical tests often combine absolute and relative ideas, for example
\[ |x-\tilde{x}| \le \tau_{\text{abs}} + \tau_{\text{rel}}|x|. \]This gives meaningful control over both small and large magnitudes.
A Reliable Error-Analysis Workflow
- Identify the exact mathematical quantity of interest.
- Identify all approximated or uncertain inputs.
- Classify the likely error sources.
- Measure absolute and relative input error when possible.
- Determine how the computation transforms those errors.
- Check for subtraction, small denominators, or sensitive functions.
- Estimate or bound the resulting output error.
- Compare the result with the required tolerance.
- Refine the data, precision, or algorithm if necessary.
A Reliable Procedure for First-Order Propagation
- Write the output as a function of the uncertain input or inputs.
- Differentiate with respect to each uncertain variable.
- Multiply each derivative by the corresponding small input change.
- Add the first-order contributions.
- Take absolute values for a conservative bound.
- Divide by the output when a relative error estimate is desired.
Common Error: Treating Approximate Input as Exact
If a measured quantity is uncertain, every output depending on it inherits that uncertainty.
Carrying many decimal digits through the calculation does not magically create additional trustworthy information.
Common Error: Reporting Too Many Digits
A calculator may display many digits even when the input data justify only a few.
Numerical reporting should reflect the actual accuracy of the data and method.
Extra displayed digits can create a false impression of certainty.
Common Error: Ignoring Relative Scale
An absolute error may look small without being small relative to the quantity.
Always ask whether the scale of the error is appropriate for the scale of the result.
Common Error: Assuming Small Residual Means Small Error
A residual measures how well the approximate solution satisfies the equation.
It does not by itself measure how close the approximate solution is to the exact solution.
Conditioning determines how reliably one can convert residual information into solution-error information.
Common Error: Ignoring Cancellation
Subtracting nearly equal quantities can destroy significant digits.
If a formula contains such subtraction, consider whether an algebraically equivalent form could reduce cancellation.
Equivalent formulas can behave very differently numerically.
Common Error: Mixing Error Sources
Measurement error, truncation error, rounding error, and algorithmic instability are not the same phenomenon.
Separating them helps identify the correct remedy.
- better measurement reduces data error;
- more terms can reduce truncation error;
- higher precision can reduce rounding error;
- a better algorithm can reduce numerical amplification.
Example: Error in a Product
Suppose
\[ x=20\pm0.1 \]and
\[ y=5\pm0.02. \]The nominal product is
\[ z=xy=100. \]The approximate first-order absolute error bound is
\[ |\Delta z| \lesssim |y||\Delta x|+|x||\Delta y|. \]Therefore,
\[ |\Delta z| \lesssim 5(0.1)+20(0.02) = 0.5+0.4 = \boxed{0.9}. \]Example: Error in a Quotient
Suppose the relative errors in \(x\) and \(y\) are approximately
\[ 0.2\% \]and
\[ 0.3\%. \]For
\[ z=\frac{x}{y}, \]a conservative first-order relative error estimate is approximately
\[ 0.2\%+0.3\% = \boxed{0.5\%}. \]Example: Error Through a Nonlinear Function
Let
\[ y=\sqrt{x}. \]Then
\[ f'(x)=\frac{1}{2\sqrt{x}}. \]A small input error therefore propagates approximately as
\[ \boxed{ \Delta y \approx \frac{\Delta x}{2\sqrt{x}} }. \]The sensitivity changes with \(x\).
Example: Relative Error in a Square Root
Since
\[ y=x^{1/2}, \]the power rule for relative errors gives
\[ \frac{\Delta y}{y} \approx \frac12\frac{\Delta x}{x}. \]Therefore,
\[ \boxed{ \text{relative error in }\sqrt{x} \approx \frac12 \text{ relative error in }x }. \]Practice 1: Absolute Error
The exact value is
\[ x=12.5, \]and the approximation is
\[ \tilde{x}=12.47. \]Find the absolute error.
Practice 2: Relative and Percentage Error
Using
\[ x=80, \qquad \tilde{x}=79.6, \]find the relative error and percentage error.
Practice 3: Identify the Error Source
A computer stores \(0.1\) as a nearby binary floating-point number.
What type of error is involved?
Practice 4: Truncation Error
The exponential function is approximated by
\[ e^x\approx1+x+\frac{x^2}{2}. \]What source of error is created by omitting the remaining series terms?
Practice 5: Propagating Error Through a Square
Let
\[ y=x^2. \]At \(x=10\), estimate the output error when
\[ \Delta x=0.01. \]Practice 6: Product Relative Error
Two quantities are multiplied. Their relative errors are approximately
\[ 0.4\% \]and
\[ 0.7\%. \]Estimate a conservative first-order relative error in the product.
Practice 7: Power Error
If
\[ y=x^4, \]estimate the relative error in \(y\) when the relative error in \(x\) is
\[ 0.2\%. \]Practice 8: Residual
For
\[ f(x)=x^2-2, \]calculate the residual at
\[ \tilde{x}=1.4. \]Practice 9: Cancellation
Explain why computing
\[ 1.234567-1.234566 \]can be numerically sensitive if the two numbers have already been rounded.
Practice 10: Forward or Backward Error?
Identify the concept described by each question.
- How close is the computed solution to the exact solution?
- For what nearby input would the computed solution be exact?
Practice Answers
Practice 1
\[ |12.5-12.47| = \boxed{0.03}. \]Practice 2
Absolute error:
\[ |80-79.6|=0.4. \]Relative error:
\[ \frac{0.4}{80}=0.005. \]Percentage error:
\[ \boxed{0.5\%}. \]Practice 3
This is representation error, and the selection of the nearby representable value is associated with rounding.
Practice 4
Omitting the remaining terms creates truncation error.
Practice 5
Since
\[ y=x^2, \qquad dy=2x\,dx, \]at \(x=10\),
\[ \Delta y \approx 2(10)(0.01) = \boxed{0.2}. \]Practice 6
Relative errors approximately add:
\[ 0.4\%+0.7\% = \boxed{1.1\%}. \]Practice 7
For \(y=x^4\),
\[ \frac{\Delta y}{y} \approx 4\frac{\Delta x}{x}. \]Therefore,
\[ 4(0.2\%) = \boxed{0.8\%}. \]Practice 8
The residual is
\[ f(1.4) = 1.4^2-2 = 1.96-2 = \boxed{-0.04}. \]Practice 9
The exact difference is very small compared with the two inputs. If the inputs have already lost lower-order digits through rounding, subtraction can expose those errors and destroy most of the reliable significant digits. This is cancellation.
Practice 10
- Forward error.
- Backward error.
What to Remember
Numerical error begins with the distinction between an exact quantity \(x\) and an approximation \(\tilde{x}\).
\[ \boxed{E_{\text{abs}}=|x-\tilde{x}|} \]and, when \(x\neq0\),
\[ \boxed{ E_{\text{rel}} = \frac{|x-\tilde{x}|}{|x|} }. \]- measurement error comes from uncertain data;
- modeling error comes from simplifying reality;
- representation and rounding error come from finite precision;
- truncation error comes from replacing infinite processes with finite ones;
- iteration error remains when an iterative process is stopped;
- errors propagate through functions according to their sensitivity;
- relative errors in products and quotients approximately add in magnitude;
- subtraction of nearly equal quantities can cause catastrophic cancellation;
- forward error measures output discrepancy;
- backward error asks whether the computed result exactly solves a nearby problem;
- residuals, tolerances, and error bounds help assess numerical reliability.
Where We Go Next
Once error has been identified and tracked, the next question is whether the mathematical problem itself is sensitive and whether the chosen algorithm controls unavoidable perturbations.
The next lesson, Conditioning and Stability, separates these two ideas and develops the framework used to judge whether a numerical result is reliable because the problem is well-conditioned, the algorithm is stable, or both.