Lecture 1 NM
Lecture 1 NM
Lecture 1 NM
Precision refers to how big or how small the absolute error X − X * is. The absolute
error is therefore a measure of the precision of an approximation.
Accuracy refers to how closely the approximation X * agrees with the true value X
. Here, what counts is not only the magnitude of the deviation X − X * but its size
relative to the true value X . Accuracy is therefore measured by the relative error
*
X −X
.
X
(d) Types and Sources of Errors
We now list the sources and types of errors and briefly discuss methods of eliminating
or reducing such errors so that the numerical solution we get is not seriously affected
by them to the extent of rendering it meaningless.
(i) Initial errors
Any mathematical problem meriting to be solved numerically involves some initial
data. Such data may be in the form of coefficients in a mathematical expression or
entries in a matrix. If this initial data is not exact, then the deviations from their respec-
tive true values are called initial errors. In some problems, uncertainties in the initial
data can have devastating effect on the final numerical solution to the problem.
(ii) Discretization error
Most of the literature on the subject of computational errors does not make a distinc-
tion between discretization and truncation errors, the reason being that the two types
of errors are almost inseparable. In this presentation we separate the two because
truncation errors are special types of discretization errors.
The true (exact) solutions of some mathematical problems are continuous functions
y = f (x) of their respective independent variables. In almost all cases, numerical
methods for solving such problems approximate the unknown continuous solution
f (x) by a sequence {f ( x n )}of approximate values of the solution at a discrete set of
points {x n } in the domain of the solution function f (x) . For example, the continuous
function f ( x) = x + e− x is the solution of the initial value problem y / + y = 1 + x ,
y (0) = 1
African Virtual University 23
A typical numerical method for solving this problem is given by the recurrence
relation
to − 0 .99999 while all other data items remain unchanged, the resulting system of
equations
x - y = 1
x - = 0
0.99999 y
1 dx
∫ 1+ x 2
. The exact (analytical) value of the integral, correct to six decimal places
0
1
h = 0 .25 . First we evaluate the integrand f ( x) = at the relevant points and
get 1+ x2
African Virtual University 25
i 0 1 2 3 4
xi 0 0 .25 0.5 0 .75 1
f ( xi ) 1.000000 0.941176 0.800000 0.640000 0,500000
h⎧ ⎫
The trapezoidal rule ⎨ f ( x0 ) + 2[f ( x1 ) + f ( x2 ) + f ( x3 )] + f ( x4 )⎬
2⎩ ⎭
gives the numerical solution 0.782794 .
h
Simpson’s rule {f ( x0 ) + 4[f ( x1 ) + f ( x3 )]+ 2 f ( x2 ) + f ( x4 )} leads to
3
the numerical solution 0.785392.
One observes that, while the solution obtained using the trapezoidal rule is correct
to only two decimal places, the solution obtained using Simpson’s rule is correct to
four decimal places. This significant difference in the accuracy of the two numerical
solutions is caused by the differences in the discretization errors of the two nume-
rical methods. Simpson’s rule has a smaller discretization error than the trapezoidal
rule.
In general, discretization errors cannot be avoided. However, one can reduce them
substantially by being careful in selecting a numerical method whose discretization
error is known a priori to be relatively small.
Truncation errors are caused by the unavoidable need to stop a convergent infinite
process in efforts to get a solution. The size of the truncation error will therefore
depend on the particular infinite process (numerical method) being used an on how
far we are prepared to carry on with the infinite process.
The truncation error can be reduced either by
(a) Choosing a numerical method with a small truncation error or
(b) Carrying out the infinite process sufficiently far.
African Virtual University 26
Example 1.2
If one performs only three iterations (truncation after three iterations) with each
method using the starting values x0 = 0 and x1 = 1 for the bisection method and
x1 = 0 for the Newton-Raphson method, one gets the following sequence of ap-
proximations for each method.
These results demonstrate that in stopping the infinite process (iteration) after the
third iteration, the truncation error of the Newton Raphson method is much smaller
than that of the bisection method.
African Virtual University 27
DO THIS
Continue applying the bisect method on the above example until the solution is correct
to three decimal places. How many more iterations did this require?
Before we discuss this important last task in our learning activity we shall first intro-
duce a few terms that will frequently be mentioned and used in the process.
• What are Figures or Digits
In computational mathematics, the words “figure” and “digit” are synonyms. They
are used interchangeably to mean any one of the ten numerals in the set {0, 1, 2, 3,
4, 5, 6, 7, 8, 9}.
N = 00073920600365.00004507000
A number can be viewed as a measure of the size or magnitude of some real or ima-
ginary quantity. The position of each digit in the string of digits has direct bearing
on the importance or significance of that digit (figure) in the overall measure of the
size or magnitude of the quantity the number represents.
Intuitively we know that the leftmost digit 7 in the number N above is more signi-
ficant than the rightmost digit 7.
• Which digits in a number are Significant?
The following rules apply in deciding which digits or figures in a given number are
significant.
1. Nonzero integers are always significant figures.
2. Any zeros on the leftmost part of a number are not significant.
3. All zero digits positioned between nonzero digits are significant.
4. Zeros at the rightmost end of a number are counted as significant only if the
number contains a decimal point.
• How many Significant Figures are in a given Number
The number of significant figures in a given number is found using the following
rule:
Rule 1: The number of significant figures in a purely integer number (with no decimal
digits) is obtained by counting, starting with the leftmost nonzero digit and ending
with the rightmost nonzero digit.
African Virtual University 28
Example 1.3
The number 541500409 has 9 significant figures.
The number 002507030 has 6 significant figures
Rule 2: The number of significant figures in a number having a decimal part is ob-
tained by counting all the digits, starting with the leftmost nonzero digit.
Example 1.4
The number 6.00213 has 6 significant figures.
The number 6.00213000 has 9 significant figures
NOTE: All zero digits at the end of a decimal number are significant.
Armed with the concepts of digits/figures and significant figures in a number we can
now comfortably discuss ways of reducing rounding errors.
One obvious method of dealing with the problem of rounding errors is to work with
the maximum allowable accuracy on our calculating device at each stage in our
calculations.
Example 1.5
Find the sum of the numbers 2.35, 1.48, 4.24 using a calculating device that can only
handle numbers with two significant figures.
If we neglect the second decimal digit from each term and form their sum we find
the approximate sum
The sum S1 has been calculated using terms obtained from the original numbers by
rounding off (chopping) the third decimal digit from each term. The term 2.35 was
rounded to 2.3, the term 1.48 was rounded to 1.4 and the term 4.24 was rounded to
4.2. In each case, the last retained digit (the first decimal place) has not been adjusted
in the process of rounding.
Note
The sum S 2 has also been obtained through rounding. However, the rounding this
time is different. Here, not all the three terms have been rounded off!
The term 2.35 has been rounded to 2.4
The term 1.48 has been rounded to 1.5
The term 4.24 has been rounded to 4.2
We observe that in rounding each of the first two terms 2.35 and 1.48, the digit occu-
pying the second decimal position has been dropped but the digit occupying the first
decimal position has been adjusted by increasing it by one (unity). The third digit
4.24 has simply been rounded off.
This practice (or as yet unknown rule for rounding numbers) seems to have some
significant advantage over rounding off manifested by the above example in which
S 2 is more accurate than S1 .
African Virtual University 30
In order to reduce the error in rounding numbers, the rejection of digits beyond some
predetermined position ( n ) is accompanied by making adjustments to the digit re-
tained in position (n-1). The adjustment involves either leaving the digit in position
( n ) unchanged or increasing it by one (unity). The decision to retain or increase by
1 the digit occupying position (n-1) is governed by the following rules.
(a) If the digit in position ( n + 1 ) is greater than 5 then the digit in position ( n )
is increased by 1.
(b) If the digit in position ( n + 1 ) is 5 and at least one other digit to its right is non
zero then the digit in position ( n ) is increased by 1.
(c) If the digit in position ( n + 1 ) is less than 5 then the digit in position ( n ) is
left unchanged.
(d) If the digit in position ( n + 1 ) is 5 and all other digits to the right of position
( n + 1 ) zero, then
Example1.7
Rounding a given number correct to two significant figures
S/N Number Rounded to 2 Significant Rule Used
figures
1 8.361 8.4 (a)
2 8.351 8.4 (b)
3 8.350 8.4 (d) (i)
4 8.450 8.4 (d) (ii)
5 8.050 8.0 (d) (ii)
6 8.349 8.3 (c)
7 2.55 2.6 (d) (i)
8 2.65 2.6 (d) (ii)
9 0.0557 0.056 (a)
10 0.0554 0.055 (b)
African Virtual University 31
Formative Evaluation: Students should work through this exercise carefully writing
full solutions for each problem. They should check their work thoroughly using the
solutions provided.
Questions
1. (a) Using the method of substitution find the exact solution of the linear system
of equations
5x + 7y = 12 .075
7x + 10 y = 16 .905
(b) Round the values on the right hand side of each equation to two significant figures
and then find the exact solution of the resulting system of linear equation.
(c) Use the solutions obtained from the two systems of equations to explain why
initial errors need to be avoided as much as possible.
2. (a) How many significant figures are in each of the following numbers:
(i) 00001000020000
(ii) 10000200003004
(iii) 000123.0004500
(b) Round each of the following numbers correct to five significant figures.
(i) 0123.395
(ii) 0123.205
(iii) 0123.206
⎛1 3 ⎞ 3
3. Given the quantity X = ⎜ + ⎟− , perform the following calculations:
⎝ 3 11 ⎠ 20