MA 572 Numerical Analysis (August 4, 2021)
MA 572 Numerical Analysis (August 4, 2021)
Lecture 2
(August 4, 2021)
MA572 1 / 12
Errors: Definitions and Sources
While solving a problem, we seek an exact or true solution, denoted by xT . In solving the problem,
approximations are usually made which results in an approximate solution, denoted by xA .
Error(xA ) = Error in xA = xT − xA .
provided xT 6= 0.
Example
19
xT = e = 2.7182818 . . . , xA = = 2.712857 . . . .
7
Error(xA ) = .003996 . . . , Rel(xA ) = .00147 . . .
MA572 2 / 12
Errors: Definitions and Sources
Alternative Concept
In place of relative error, very often the concept of significant digits is used. We say xA has m
significant (decimal) digits with respect to xT if the error xT − xA has magnitude less than or
equal to 5 in the (m + 1)-th digit of xT , counting to the right from the first non-zero digit in xT .
Formal Definition
(i) Let the true value have digits d1 d2 . . . dm dm+1 . . . dp .
(ii) Let the approximate value have digits d1 d2 . . . dm em+1 . . . ep ,
where d1 6= 0 and with the first difference in the digits occurring at the (m + 1)-th digit. Then we
say that (i) and (ii) agree to m significant digits if |dm+1 − em+1 | < 5.
Example
1 .
xT = , i .e., xT = .3333 and xA = .333, |xT − xA | = .00033
3
xA has three significant digits with respect to xT (The error is less than 5 in the fourth digit to
the right of the first non-zero digit in xT ).
MA572 3 / 12
Errors: Definitions and Sources
Example
xT = 23.496, and xA = 23.494, |xT − xA | = .002
xA has four significant digits with respect to xT (The error is less than 5 in the fifth digit to the
right of the first non-zero digit in xT ).
Example
xT = .03148, and xA = .03154, |xT − xA | = .00006
xA has two significant digits with respect to xT , not three (It is counted from the first non-zero
digit which is 3 in this case).
MA572 4 / 12
Errors: Definitions and Sources
Since 0.1 ≤ |xT | < 1, this implies that xA has m significant digits. In a similar manner, the same
may be established for a general xT . It can done by taking xT = x̂T .10e , with 0.1 ≤ |xT | < 1, e
an integer.
(1) is a sufficient condition, but not a necessary one, in order that xA has m significant digits.
Two examples above have one more significant digit than that indicated by (1).
MA572 5 / 12
Errors: Definitions and Sources
One important aspect is how the error propagates and how the errors affect the computation. Let
ω denote one of the arithmetic operations +, −, ×, \. Let ω̂ denote the computer version of the
same operation which will usually include rounding.
Let xA and yA be the numbers used for calculations and suppose they are in error with true values
as follows:
xT = xA + , yT = yA + η.
MA572 6 / 12
Propagation of Errors
Then xA ω̂yA is the number actually computed and its error is given by
The first quantity in brackets on RHS is called the propagated error and the second quantity
usually represents the rounding or chopping error.
Recall
1 1
− β −t+1 ≤ ≤ β −t+1 . (4)
2 2
MA572 7 / 12
Propagation of Errors
Proof:
fl(x)−x
Recall x
= . In our case
fl(xA ωyA ) − xA ωyA
= .
xA ωyA
Therefore
Due to (3) and (4), we can write
xA ω̂yA ) − xA ωyA 1
≤ β −t+1
xA ωyA 2
β
⇒ |xA ωyA − xA ω̂yA )| ≤ |xA ωyA |β −t .
2
MA572 8 / 12
Propagation of Errors
Some particular cases are now considered to discuss propagated error. That is, we examine the
propagation of error for different operations.
Case I: Multiplication
xT yT − xA yA xT η + yT − η
Rel(xA yA ) = =
xT yT xT yT
η η
= + − ×
yT xT xT yT
= Rel(yA ) + Rel(xA ) − Rel(xA ) × Rel(yA )
MA572 9 / 12
Propagation of Errors
xT xT −
Error(xA /yA ) = −
yT yT − η
−ηxT + yT
= .
yT (yT − η)
−ηxT +yT
yT (yT −η)
Rel(xA /yA ) =
xT /yT
−ηxT + yT
=
xT (yT − η)
−η + yT /xT
=
(yT − η)
−η/yT + /xT Rel(xA ) − Rel(yA )
= = .
1 − η/yT 1 − Rel(yA )
MA572 10 / 12
Propagation of Errors
Therefore
Error(xA ± yA ) = Error(xA ) ± Error(yA ).
It can be seen that the error looks quite good and reasonable but the relative error in xA ± yA can
be quite poor when compared with Rel(xA ) and Rel(yA ) as can be observed from the following
example.
Example:
22
xT = π, xA = 3.1416, yT = , yA = 3.1429.
7
Although the error in xA − yA is very small (0.0013), the relative error in xA − yA is much larger
than that in xA or yA alone.
MA572 11 / 12
Propagation of Errors
The first quantity in brackets on RHS is the propagated error and the second quantity in brackets
is the error due to evaluating f (xA ) on a computer. The second error is usually a small random
number.
MA572 12 / 12