0% found this document useful (0 votes)
62 views

Bma3207 Numerical Analysis Lecture 2

Numerical analysis 2 lecture notes

Uploaded by

simonodhiambo652
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Bma3207 Numerical Analysis Lecture 2

Numerical analysis 2 lecture notes

Uploaded by

simonodhiambo652
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

lOMoARcPSD|49076497

BMA3207 Numerical Analysis Lecture 2

Actuarial science (Mount Kenya University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by SIMON ODHIAMBO ([email protected])
lOMoARcPSD|49076497

BMA3207 Numerical Analysis


Lecturer 2 : Solution of Algebraic and
Transcendental Equations
Notes Prepared

Gikonyo Kiguta

Assistant Lecturer department of mathematics


Mount Kenya University

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

Contents

1 Solution of Algebraic and Transcendental Equations . . . . . . . . . . . . 5


1.1 Introduction to Nonlinear Equations 5
1.2 Root of an equation 6
1.3 Bisection Method 6
1.3.1 Worked Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.2 Advantages of Bisection Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.4 Regula-falsi Method 11
1.4.1 Worked Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

1. Solution of Algebraic and Transcendental Equati

1.1 Introduction to Nonlinear Equations


An equation of the type f (x) = 0 is either algebraic or transcendental.
Algebraic Equation:
A polynomial equation of the form

an xn + an−1 xn−1 + · · · + a1 x + a0 = 0, an 6= 0, n>1

Where an , an−1 , . . . , a1 and a0 are constants


For example,

x4 − 4x2 + 5 = 0, 4x2 − 5x + 7 = 0; 2x3 − 5x2 + 7x + 5 = 0

are algebraic equations.

Transcendental Equation
An equation which contains trigonometric ratios, exponential function and logarithmic functions is
called as a Transcendental Equation.
Examples of the transcendental equations are as follows
i) 3 sin(x) − e−x = 0
ii) 3x2 − 2 cos x = 0
iii) 2ex sin x − ln(x) = 0
Transcendental equations may have finite or infinite numbers of real roots or may not have real
roots at all.

In order to solve the above type of equations, the following methods exist

Directive Methods: The methods which are used to find solutions of given equations in the
direct process is called as directive methods.
Example: Synthetic division, remainder theorem, Factorization method etc

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

6 Chapter 1. Solution of Algebraic and Transcendental Equations

Note: By using Directive Methods, it is possible to find exact solutions of the given equation.

Indirect Methods: The methods which are used to find solutions of the given equation in some
indirect process is called as Iterative Methods

Note: By using Iterative methods, it is possible to find approximate solution of the given equation
and also it is possible to find single solution of the given equation at the same time.

To find a root of the given equation, we have following methods


• Bisection Method
• Regula-falsi Method
• Iteration Method
• Newton Raphson Method
• Secant Method

1.2 Root of an equation


What is a root

Fig. 1 Geometrical Interpretation of a root of f (x) = 0

A number α is a simple root of f (x) = 0; if f (α ) = 0 and f 0 (α ) 6= 0


Then, we can write f (x) as, f (x) = (x − α )g(x), g(α ) 6= 0

Note:
There may be many roots of the given nonlinear equation but we will seek the approximation
of only one of its real root α lies in the given interval [a, b] that is
f (α ) = 0, where α ∈ [a, b]

1.3 Bisection Method


Bisection method is the simplest iterative method for finding the real roots of an equation, f (x) = 0.
Let a and b be two initial guesses, which bracket the root. The first approximation to root is the

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

1.3 Bisection Method 7

midpoint of the interval (a, b), i.e.,

a+b
x0 =
2

If f (a) f (x0 ) < 0 then according to intermediate value theorem, the root will lie in the interval
(a, x0 ) . So the next approximation is given by

a + x0
x1 =
2

Else, the root will lie in the interval (x0 , b) and the next approximation is given by

b + x0
x1 =
2

This process can be continued to generate a sequence x1 , x2 , x3 · · · of approximations to the root.


Let xn−3 , xn−2 and xn−1 be three latest approximations to the root, then the n th approximation xn is
given by if f (xn−1 ) f (xn−2 ) ≤ 0

xn−1 + xn−2
xn =
2

else
xn−1 + xn−3
xn =
2

The graphical representation of the method is given by:

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

8 Chapter 1. Solution of Algebraic and Transcendental Equations

1.3.1 Worked Example


Q.1. Show that the equation x3 − 4x − 9 = 0 has a root in the interval ( 2,3 ). Obtain the ten
iterations of the Bisection method to compute the approximate root of the equation.

Ans. The function f (x) = x3 − 4x − 9 is continuous in the interval (2,3) and

f (2) = −9, f (3) = 6

According to intermediate value theorem, at least one root of the equation x3 − 4x − 9 = 0 lies in
the interval ( 2,3 ). To obtain iterations of Bisection method, let us start with initial approximations

a = 2, b = 3

The first approximation to root is the midpoint of the interval (a, b).

a+b 2+3
x0 = 2 = 2 = 2.5

f (2.5) = −3.375000, while f (3) = 6

So, root lies in the interval (2.5,3)

2.5 + 3
x1 = = 2.75, f (2.75) = 0.796875
2

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

1.3 Bisection Method 9

Proceeding in a similar manner, we can obtain following iterations


x2 = 2.625000 f (x2 ) = −1.412109
x3 = 2.687500 f (x3 ) = −0.339111
x4 = 2.718750 f (x4 ) = 0.220917
x5 = 2.703125 f (x5 ) = −0.061077
x6 = 2.710938 f (x6 ) = 0.079423
x7 = 2.707031 f (x7 ) = 0.009049
x8 = 2.705078 f (x8 ) = −0.026045
x9 = 2.706055 f (x9 ) = −0.008506
x10 = 2.706543 f (x10 ) = 0.000270

The difference between 8th and 9th approximations is less than ε = 0.002. Therefore, we can stop
iterations and say that approximate root is x9 = 2.706055

Q.2.Find a real root of f (x) = x3 + x2 + x + 7 = 0 correct to three decimal places.

Ans. The given equation is a cubic and the last term is positive. Hence, f (x) = 0 will have
a negative real root. We find that

f (−1) = 6, f (−2) = 1 and f (−3) = −14

Therefore, a real root lies between -3 and -2 We take


−2 − 3
x1 = = −2.5
2
since f (−2.5) = −4.875, the root lies between -2 and −2.5, and then
−2 − 2.5
x2 = = −2.25
2
Now f (x2 ) = −1.5781, and, therefore, the root lies between -2 and -2.25 It follows that
−4.25
x3 = = −2.125
2
Successive approximations are given by
x4 = −2.0625, x5 = −2.0938, x6 = −2.1094,
x7 = −2.1016, x8 = −2.1055, x9 = −2.1035
x10 = −2.1045, x11 = −2.1050, . . .
The difference between x10 and x11 is 0.0005. Hence, we conclude that the root is given by
x = −2.105, correct to three decimal places.

Q.3. Find the positive root, between 0 and 1, of the equation x = e−x to a tolerance of 0.05%

Ans. Let

f (x) = xex − 1 = 0

We have, f (0) = −1 and f (1) = e − 1, which is positive. Hence, a root exists between 0 and 1, and
0+1
x1 = = 0.5
2

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

10 Chapter 1. Solution of Algebraic and Transcendental Equations

Because, f (x1 ) = −0.1756, the root lies between 0.5 and 1.0. Then
0.5 + 1.0
x2 = = 0.75
2
Now, the tolerance ε1 is given by
X2 − X1
ε1 = × 100
X2
0.25
= × 100 = 33.33%
0.75
since f (x2 ) = 0.5878, the root lies between 0.5 and 0.75 Therefore,
0.5 + 0.75
x3 = = 0.625
2
also,
0.625 − 0.75
ε2 =| × 100 = 20%
0.625

Proceeding in this way, successive approximations and tolerances are obtained:


x4 = 0.5625, ε3 = 11.11%; x5 = 0.5938, ε4 = 5.26%
x6 = 0.5781, ε5 = 2.71%; x7 = 0.5703, ε6 = 1.37%
x8 = 0.5664, ε7 = 0.69%; x9 = 0.5684, ε8 = 0.35%
x10 = 0.5674, ε9 = 0.18%; x11 = 0.5669, ε10 = 0.09%
x12 = 0.5671, ε11 = 0.035%
since ε11 = 0.035% < 0.05%, the required root is 0.567, correct to three decimal places.

Q.4. Find a root, correct to three decimal places and lying between 0 and 0.5, of the equation
4e−x sin x − 1 = 0
Ans
Let
f (x) = 4e−x sin x − 1
We have f (0) = −1 and f (0.5) = 0.163145 Therefore,
x1 = 0.25
since f (0.25) = −0.22929, it follows that the root lies between 0.25 and 0.5 Therefore,
0.75
x2 = = 0.375
2
The successive approximations are given by
x3 = 0.3125,x4 = 0.3438, x5 = 0.3594,
x6 = 0.3672,x7 = 0.3711, x8 = 0.3692,
x9 = 0.3702,x10 = 0.3706, x11 = 0.3704
x12 = 0.3705, . . .
Hence the required root is 0.371, correct to three decimal places.

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

1.4 Regula-falsi Method 11

1.3.2 Advantages of Bisection Method


1. Always convergent
2. The root bracket gets halved with each iteration guaranteed.

Drawbacks
• If one of the initial guesses is close to the root, the convergence is slower
• If a function f(x) is such that it just touches the x-axis it will be unable to find the lower and
upper guesses.

• Function changes sign but root does not exist.

1.4 Regula-falsi Method


In this method, we choose two points a and b such that f (a) and f (b) are of opposite signs. Hence
a root lies in between these points.

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

12 Chapter 1. Solution of Algebraic and Transcendental Equations

The equation of the chord joining the two points, (a, f (a)) and (b, f (b)) is given by
y − f (a) f (b) − f (a)
=
x−a b−a

We replace the part of the curve between the points [a, f (a)] and [b, f (b)] by means of the
chord joining these points and we take the point of intersection of the chord with the x axis as an
approximation to the root. The point of intersection is obtained by putting y = 0
Our first approximation xo to the root of f (x) = 0. is given by

∴ (I) ⇒ 0 − f (a) = f (b)−


b−a
f (a)
(x0 − a)
− f (a)(b−a)
⇒ x0 − a = f (b)− f (a)
f (a)(b−a)
⇒ x0 = a − f (b)− f (a)
a f (b)−b f (a)
⇒ x0 = f (b)− f (a)

The graphical representation of the method is given by:

1.4.1 Worked Examples


Q.1. Find a real root of the equation below using Regular Falsi methods:
f (x) = x3 − 2x − 5 = 0
Ans

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

1.4 Regula-falsi Method 13

In this method following formula is used -

xn+1 = xn − ((xf (x
n −xn−1 ) f (xn )
n )− f (xn−1 ))

We find f (2) = −1 and f (3) = 16.


Hence a = 2, b = 3, and a root lies between 2 and 3.

2(16) − 3(−1) 35
x1 = = = 2.058823529
16 − (−1) 17
Now, f (x1 ) = −0.390799917 and hence the root lies between 2.058823529 and 3.0. Using formula
( 2.7 ), we obtain
2.058823529(16) − 3(−0.390799917)
x2 = = 2.08126366
16.390799917
since f (x2 ) = −0.147204057, it follows that the root lies between 2.08126366 and 3.0. Hence, we
have
2.08126366(16) − 3(−0.147204057)
x3 = = 2.089639211
16.147204057
Proceeding in this way, we obtain successively:
Proceeding in this way, we obtain successively:

x4 = 2.092739575, x5 = 2.09388371
x6 = 2.094305452, x7 = 2.094460846, . . .

The correct value is 2.0945 . . . , so that x7 is correct to five significant figures.

Q.2. Find a root of the equation 4e−x sin x − 1 = 0 by regular-falsi method given that the root
lies between 0 and 0.5

Ans
Let

f (x) = 4e−x sin x − 1, a = 0, b = 0.5

We have

f (a) = −1 and f (b) = 4e−0.5 sin 0.5 − 1 = 0.163145

Therefore,
0(0.163145) − 0.5(−1)
x1 =
1.163145
0.5
= = 0.4298690
1.163145
Now, we take

a = 0 and b = 0.4298690

Then

f (x) = 0.08454

Downloaded by SIMON ODHIAMBO ([email protected])


lOMoARcPSD|49076497

14 Chapter 1. Solution of Algebraic and Transcendental Equations

Therefore,
0(0.08454) − 0.42987(−1)
x2 =
1.08454
= 0.39636

Now,

a = 0, b = 0.39636 and f (b) = 0.038919

Hence
0(0.038919) − 0.39636(−1)
x3 =
1.038919
= 0.381512

and

f (x3 ) = 0.016934

Taking a = 0 and b = 0.381512, we obtain

0(0.016934) − 0.381512(−1)
x4 =
1.016934
= 0.375159

and

f (x4 ) = 0.0071873

Proceeding as above, we obtain

x5 = 0.37248, x6 = 0.37136,
x7 = 0.37089, x8 = 0.370697

It follows that the required root is 0.371, correct to three decimal places.

Downloaded by SIMON ODHIAMBO ([email protected])

You might also like