1456308539E textofChapter1Module1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Numerical Analysis

by
Dr. Anita Pal
Assistant Professor
Department of Mathematics
National Institute of Technology Durgapur
Durgapur-713209
email: anita.buie@gmail.com
.

Chapter 1

Numerical Errors

Module No. 1

Errors in Numerical Computations


......................................................................................

Two major techniques are used to solve any mathematical problem − analytical and
numerical. The analytical solution is obtained in a compact form and generally it is free
from error. On the other hand, numerical method is a technique which is used to solve
a problem with the help of computer or calculator. In general, the solution obtained by
this method contains some error. But, for some class of problems it is very difficult to
obtain an analytical solution. For these problems we generally use numerical methods.
For example, the solutions of complex non-linear differential equations cannot be de-
termined by analytical methods, but these problems can easily be solved by numerical
methods. In numerical method there always be a scope to occur errors and hence it
is important to understand the source, propagation, magnitude, and rate of growth of
these errors.
To solve a problem with the help of computer, a special method is required and
this method is known as numerical method. Analytical methods are not suitable to
solve a problem by computer. Thus, the numerical methods are highly appreciated and
extensively used by scientists and engineers.
Let us discuss sources of error.

1.1 Sources of error

It is well known that the solution of a problem obtained by numerical method contains
some errors. But, our intension is to minimize the error. To minimize it, the most
essential thing is to identify the causes or sources of the error. Three sources of errors,
viz. inherent errors, round-off errors and truncation errors occur to find a solution of a
problem by using numerical method. They are discussed below.

(i) Inherent errors: These type of errors occur due to the simplified assumptions
made during mathematical modelling of the problem. These errors also occur when the
data is obtained from certain physical measurements of the parameters of the proposed
problem.

(ii) Round-off errors: Generally, the numerical methods are performed using com-
puter. In numerical computation, all the numbers are represented as decimal fraction.
Again, a computer can store finite number of digits for a number. Some numbers viz.
1/3, 1/6, 1/7 etc. can not be represented by decimal fraction in finite numbers of digits.
1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errors in Numerical Computations

Thus, to represent these numbers some digits must be discarded and hence the numbers
should be rounded-off into some finite number of digits. So in arithmetic computation,
some errors will occur due to the finite representation of the numbers; these errors are
called round-off errors. These errors depend on the word length of the used computer.

(iii) Truncation errors: These errors occur due to the finite representation of an
inherently infinite process. These types of errors are explained by an example. Let us
consider the cosine series.
The Taylor’s series expansion of cos x is

x2 x4 x6
cos x = 1 − + − + ··· .
2! 4! 6!

This is well known that this series s infinite. If we consider the first five terms to
calculate the value of cos x for a given x, then we obtained an approximate value. The
error occurs due to the truncation of the remaining terms of the series and it is called
the truncation of error.
Note that the truncation error is independent of the computational machine.

1.2 Exact and approximate numbers

In numerical computation, a number is consider as either exact or approximate value


of a solution of a problem. Exact number represents the true value of a result while the
approximate number represents the value which is closed to the true value.
For example, in the statements ‘a book has 134 pages’, ’the population of a locality
is 15000’ the numbers 134, 15000 are exact numbers. But, in the assertions ‘the time
taken to fly from Kolkata to New Delhi is 2 hrs’, ‘the number of leaves of a mango tree
is 150000’, the numbers 2 and 150000 are approximate numbers, as time to fly from
Kolkata to New Delhi is approximately 2 hrs and similarly, the number of leaves of the
tree is approximately 150000, because it is not possible to count exact number of leaves
of a big tree.
These approximations are coming either from the imperfection of measuring instru-
ments or the measurement depends on other parameters. There are no absolutely exact
measuring instruments; each of them has its own accuracy.
2
......................................................................................

It may be noted that same number may be exact as well as approximate. For ex-
ample, the number 3 is exact when it represents the number of rooms of a house and
approximate when it represents the number π.
The accuracy of a solution is defined in terms of number of digits used in the com-
putation. The significant digits or significant figures of a number are all its digits,
except for zeros which appear to the left of the first non-zero digit. But, the zeros at
the end of a number are always significant digit. The numbers 0.000342 and 8921.2300
have 3 and 8 significant digits respectively.
Some times we need to cut off usable digits. The number of digits to be cut off depends
on the problem. This process to cut off digits from a number is called rounding-off
of numbers. That is, in rounding process the number is approximated to a very close
number consisting of a smaller number of digits. In that case, one or more digits are
kept with the number, taken from left to right, and all other digits are discarded.

Rules of rounding-off
(i) If the discarded digits constitute a number which is larger than half the unit in the
last decimal place that remains, then the last digit that is left is increased by one.
If the discarded digits constitute a number which is smaller than half the unit in
the last decimal place that remains, then the digits that remain do not change.

(ii) If the discarded digits constitute a number which is equal to half the unit in the
last decimal place that remains, then the last digit that is half is increased by one,
if it is odd, and is unchanged if it is even.
This rule is often called a rule of an even digit.

In Table 1.1, we consider different cases to illustrate the round-off process. In this
table the numbers are rounded-off to the six significant figures. But, computer kept
more number of digits during round-off. It depends on the computer and the type of
the number declared in a programming language.
Note that the round-off numbers contain errors and this errors are called round-off
errors.

3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errors in Numerical Computations

Exact number Round-off number to six significant figures


26.0123728 26.0124 (added 1 in the last digit)
23.12432615 23.1243 (last digit remains unchanged)
30.455354 30.4554 (added 1 in the last digit)
19.652456 19.6525 (added 1 in the last digit)
126.3545 126.344 (last digit remains unchanged)
34.4275 34.4280 (added 1 in the last digit to make even digit)
8.999996 9.00000 (added 1 in the last digit)
9.999997 10.0000 (added 1 in the last digit)
0.0023456573 0.00234566 (added 1 in the last digit)
6.237 6.23700 (added two 0’s to make six figures)
67542159 675422×102 (integer is rounded to six digits)

Table 1.1: Different cases of round-off numbers

1.3 Absolute, relative and percentage errors

Let xA be the approximate value of the exact number XT .


The difference between the exact value xT and its approximate value xA is an error.
But, by principle it is not possible to determine the value of the error xT − xA and even
its sign, when the exact number xT is unknown.
The errors are designated as absolute error, relative error and percentage error.

Absolute error:
Let xA be the approximate value of the exact number xT . Then the absolute error is
denoted by (∆x) and satisfies the relation

∆x ≥ |xT − xA |.

Note that the absolute error is the upper bound of the difference between xT and
xA . This definition is applicable when there are many approximate values of the exact
number xT . Otherwise, ∆x = |xT − xA |.
4
......................................................................................

Also, the exact value xT lies between xA − ∆x and xA + ∆x. It can be written as

xT = xA ± ∆x. (1.1)

The upper bound of the absolute error is 1


absolute error ≤ × 10−m , (1.2)
2
when the number is rounded to m decimal places.

Note that the absolute error measures the total error and hence this error measures
only the quantitative side of the error. It does not measure the qualitative, i.e. how
much the measurement is accurate. For example, the length and the width of a pond
are determined by a tape in meter. Suppose that width w = 50 ± 2 m and the length
l = 250 ± 2 m. In both the measurements the absolute error is 2 m, but it is obvious
that the second measure is more accurate.
To determine the quality of measurements, we introduced a new concept called rela-
tive error.

Relative error:
The relative error is denoted by δx and is defined by
∆x ∆x
δx = or , |xT | 6= 0 and |xA | 6= 0.
|xA | |xT |
This expression can also be written as

xT = xA (1 ± δx) or xA = xT (1 ± δx).

Note that the absolute error is the total error when whole thing is measured, while
relative error is the error when we measure 1 unit. That is, the relative error is the error
per unit measurement.
2 2
In case of above example, the relative errors are δw = 50 = 0.04 and δl = 250 =
0.008. Thus, the second measurement is more accurate.
In general, the relative error measures the quantity of error and quality of the mea-
surement. Thus, the relative error is a better measurement of error than absolute error.

Percentage error:
The relative error is measured in 1 unit scale while the percentage error is measured
5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errors in Numerical Computations

in 100 unit scale. The percentage error is measured by δx × 100%. This error is
sometimes called relative percentage error. Percentage error measures both the
quantity and quality. Generally, when relative error is very small then the percentage
error is determined.
Note that the relative and percentage errors are free from the unit of measurement,
while absolute error depends on the measuring unit.
1
Example 1.1 Find the absolute, relative and percentage error in xA when xT = and
7
xA = 0.1429.
Solution. The absolute error

1 1 − 1.0003
∆x = |xT − xA | = − 0.1429 =

7 7
0.0003
= = 0.000043 rounding up to two significant figures.
7
The relative error
∆x 0.000043
δx = = = 0.000329 ' 0.0003.
xT 1/7
The percentage error is δx × 100% = 0.0003 × 100% ' 0.03%.

Example 1.2 Find the absolute error and the exact number corresponding to the ap-
proximate number xA = 7.543. Assume that the percentage error is 0.1%.

Solution. The relative error is δx = 0.1% = 0.001.


Therefore, the absolute error is ∆x = |xA × δx| = 7.543 × 0.001 = 0.007543 ' 0.0075.
Thus, the exact value is = 7.543 ± 0.0075.

Example 1.3 Suppose two exact numbers and their approximate values are given by
17 √
xT = ' 0.8947 and yT = 71 ' 8.4261.
19
Find out which approximation is better.

Solution. To find the absolute error, we take the numbers xA and yA with a larger

number of decimal digits as xA ' 0.894736 · · · , yA = 71 ' 8.426149 · · · .
Therefore, the absolute error in xT is ∆x = |0.894736 · · · − 0.8947| ' 0.000036,
and ∆y = |8.426149 · · · − 8.4261| ' 0.000049.
6
......................................................................................

Thus, δx = 0.000036/0.8947 ' 0.000040 = 0.0040%


δy = 0.000049/8.4261 = 0.0000058 = 0.00058%.
The percentage error in second case is 0.00058 while in first case it is 0.0040. Thus
the second measurement is more better than the first one.

1.4 Valid significant digits

A decimal integer can be represented in many ways. For example, the number 7600000
can be written as 760 × 104 or 76.0 × 105 or 0.7600000 × 107 . Note that each number has
two parts, the first part is called mantissa and second part is called exponent. In last
form, the mantissa is a proper fraction and first digit after decimal point is non-zero.
This form is known as normalize form and it is commonly used in computer.
Every positive decimal number a can be expressed as

a = d1 × 10m + d2 × 10m−1 + · · · + dn × 10m−n+1 + · · · ,

where di are the digits constituting the number (i = 1, 2, . . .). The digit d1 6= 0 and
10m−i+1 is the value of the ith decimal place starting from left.
Let dn be the nth digit of the approximate number x. This digit is called valid
significant digit (or simply a valid digit) if it satisfies the following condition

∆x ≤ 0.5 × 10m−n+1 . (1.3)

If the inequality of (1.3) does not satisfied, the digit dn is said to be doubtful. If dn
is a valid digit then all the digits preceding to dn are also valid.
Theorem 1.1 If a number is correct up to n significant figures and the first significant
digit is k, then the relative error is less than
1
.
k × 10n−1
Proof. Let xA and xT be the approximate and exact values. Also, assume that xA is
correct up to n significant figures and m decimal places. There are three cases arise:
(i) m < n
(ii) m = n and
(iii) m > n.
7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errors in Numerical Computations

From (1.2) it is known that the absolute error ∆x ≤ 0.5 × 10−m .

(i) When m < n.


In this case, the total number of digits in integral part is n − m. Let k be the first
significant digit in xT . Therefore,

∆x ≤ 0.5 × 10−m and |xT | ≥ k × 10n−m−1 − 0.5 × 10−m .

Thus, the relative error


∆x 0.5 × 10−m
δx = ≤
|xT | k × 10n−m−1 − 0.5 × 10−m
1
= .
2k × 10n−1 − 1
Since, n is a positive integer and k is an integer lies between 1 and 9,

2k × 10n−1 − 1 > k × 10n−1

for all k and n except k = n = 1.


Hence,
1
δx < .
k × 10n−1
(ii) When m = n.
In this case, the first significant digit is same as first digit after decimal point, i.e. the
number is proper fraction.
As in previous case,
0.5 × 10−m
δx =
k × 10n−m−1 − 0.5 × 10−m
1 1
= < .
2k × 10n−1 − 1 k × 10n−1
(iii) When m > n.
In this case, the first significant digit k is at the (n−m+1) = −(m−n−1)th position and
the integer part is zero. Then ∆x ≤ 0.5 × 10−m and |xT | ≥ k × 10−(m−n+1) − 0.5 × 10−m .
Thus, 0.5 × 10−m
δx =
k × 10−(m−n+1) − 0.5 × 10−m
1 1
= < .
2k × 10n−1 − 1 k × 10n−1
Hence the theorem.
8

You might also like