Lec17p1
Lec17p1
UNIT NUMBER
17.1
NUMERICAL MATHEMATICS 1
(Approximate solution of equations)
by
A.J.Hobson
17.1.1 Introduction
17.1.2 The Bisection method
17.1.3 The rule of false position
17.1.4 The Newton-Raphson method
17.1.5 Exercises
17.1.6 Answers to exercises
UNIT 17.1 - NUMERICAL MATHEMATICS 1
17.1.1 INTRODUCTION
In the work which follows, we shall consider the solution of the equation
f (x) = 0,
where f (x) is a given function of x.
It is assumed that examples of such equations will have been encountered earlier at an
elementary level; as, for instance, with quadratic equations where there is simple formula for
obtaining solutions.
Three so called “iterative” methods will be included, below, where repeated use of the
method is able to improve the accuracy of an approximate solution, already obtained.
Suppose a and b are two numbers such that f (a) < 0 and f (b) > 0. We may obtain these
by trial and error or by sketching, roughly, the graph of the equation
y = f (x),
in order to estimate convenient values a and b between which the graph crosses the x-axis;
whole numbers will usually suffice.
1
y
6
O -x
(ii) f (c) < 0, in which case there is a solution between c and b enabling us repeat the
procedure with these two numbers;
(iii) f (c) > 0, in which case there is a solution between c and a enabling us to repeat the
procedure with these two numbers.
Each time we apply the method, we bisect the interval between the two numbers being used
so that, eventually, the two numbers used will be very close together. The method stops
when two consecutive values of the mid-point agree with each other to the required number
of decimal places or significant figures.
Convenient labels for the numbers used at each stage (or iteration) are
a0 , b0 , c0 , a1 , b1 , c1 , a2 , b2 , c2 , a3 , b3 , c3 , ..., an , bn , cn , ....
EXAMPLE
Determine, correct to three decimal places, the positive solution of the equation
ex = x + 2.
Solution
2
that the graphs intersect each other at a positive value of x. This confirms that there is
indeed a positive solution to our equation.
y
6
O -x
The rest of the solution may be set out in the form of a table as follows:
n an bn cn f (cn )
0 1.00000 2.00000 1.50000 0.98169
1 1.00000 1.50000 1.25000 0.24034
2 1.00000 1.25000 1.12500 - 0.04478
3 1.12500 1.25000 1.18750 0.09137
4 1.12500 1.18750 1.15625 0.02174
5 1.12500 1.15625 1.14062 - 0.01191
6 1.14063 1.15625 1.14844 0.00483
7 1.14063 1.14844 1.14454 - 0.00354
8 1.14454 1.14844 1.14649 0.00064
9 1.14454 1.14649 1.14552 - 0.00144
As a general rule, it is appropriate to work to two more places of decimals than that of the
required accuracy; and so, in this case, we work to five.
We can stop at stage 9, since c8 and c9 are the same value when rounded to three places of
decimals. The required solution is therefore x = 1.146
3
17.1.3 THE RULE OF FALSE POSITION
This method is commonly known by its Latin name, “Regula Falsi”, and tries to compen-
sate a little for the shortcomings of the Bisection Method.
Instead of taking c as the average of a and b, we consider that the two points, (a, f (a)) and
(b, f (b)), on the graph of the equation,
y = f (x),
are joined by a straight line; and the point at which this straight line crosses the x-axis is
taken as c.
y
6
O -x
From elementary co-ordinate geometry, the equation of the straight line is given by
y − f (a) x−a
= .
f (b) − f (a) b−a
4
In setting out the tabular form of a Regula Falsi solution, the cn column uses the general
formula
an f (bn ) − bn f (an )
cn = .
f (bn ) − f (an )
EXAMPLE
Solution
We have f (0) = −1 and f (1) = 2, so that there is certainly a solution between x = 0 and
x = 1.
Note:
The Bisection Method would have given c0 = 21 .
at the point x0 , f (x0 ) to find out where this tangent crosses the x-axis. The point obtained
is normally a better approximation x1 to the solution.
5
y
6
O -x
In the diagram,
AB f (x0 )
f 0 (x0 ) = = .
AC h
Hence,
f (x0 )
h= ,
f 0 (x0 )
so that a better approximation to the exact solution at point D is given by
x1 = x0 − h.
Notes:
(i) To guess the starting approximation, x0 , it is normally sufficient to use a similar technique
to that in the Bisection Method; that is, we find a pair of whole numbers, a and b, such
that f (a) < 0 and f (b) > 0; then we take x0 = (a + b)/2. In some exercises, however,
an alternative starting approximation may be suggested in order to speed up the rate of
convergence to the final solution.
(ii) There are situations where the Newton-Raphson Method fails to give a better approx-
imation; as, for example, when the tangent to the curve has a very small gradient, and
consequently meets the x-axis at a relatively great distance from the previous approxima-
tion. In this Unit, we shall consider only examples in which the successive approximations
converge rapidly to the required solution.
6
EXAMPLE
√
Use the Newton-Raphson method to calculate 5, correct to three places of decimals.
Solution
By trial and error, we find that a solution exists between x = 2 and x = 3 since f (2) = −1 < 0
and f (3) = 4 > 0. Hence, we use x0 = 2.5
Furthermore,
f 0 (x) = 2x,
so that
x2n − 5
xn+1 = xn − .
2xn
Thus,
1.25
x1 = 2.5 − = 2.250,
5
0.0625
x2 = 2.250 − ' 2.236,
4.5
−0.000304
x3 = 2.236 − ' 2.236
4.472
At each stage, we round off the result to the required number of decimal places and use the
rounded figure in the next iteration.
The last two iterations give the same result to three places of decimals and this is therefore
the required result.
7
17.1.5 EXERCISES
1. Determine the smallest positive solution to the following equations (i) by the Bisec-
tion Method and (ii) by the Regula Falsi Method, giving your answers correct to four
significant figures:
(a)
x − 2sin2 x = 0;
(b)
ex − cos(x2 ) − 1 = 0.
2. Use the Newton-Raphson Method to determine the smallest positive solution to each
of the following equations, correct to five decimal places:
(a)
x4 = 5;
(b)
x3 + x2 − 4x + 1 = 0;
(c)
x − 2 = ln x.
1. (a)
x ' 1.849;
(b)
x ' 0.6486
2. (a)
x ' 1.49535;
(b)
x ' 0.27389;
(c)
x ' 3.14619