CHAPTER 2 (2)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

Computational /Numerical Methods lecture ________________

Chapter 2

Numerical Solution of Algebraic and Transcendental


Equations

(Non-Linear equations)

Introduction

Frequently occurring problem is to find the solution of equations of the form


f ( x )=0.

When f ( x ) is a polynomial of higher degree or an expression involving


logarithmic, trigonometric,exponential functions (transcendental functions),
algebraic methods may not be available

Hence we find roots by approximating methods (we use some numerical


methods for their solutions)

Some of those Numerical methods are;

 Graphical method
 Bisection method
 Secant method
 Regula Falsi method/method of false position
 Newton-Raphson Method
 Fixed point Iteration method

Examples:
3
1. x +2 x=0 Algebraic eqn.
2. tan( x )+cos x=0
x
3. e −4 x=0

Intermediate value theorem (IVT)

If f ( x ) is continuous on the interval [a, b] and f (a ) ∧f (b ) have opposite signs, then


there exist at least one root between a and b.
1. Bisection method
The method is based on the intermediate value theorem
Let f (a ) <0 and f ( b )> 0
Root lies between a and b.

1|Page
Computational /Numerical Methods lecture ________________
a+b
x 0=
Let 2
x
If f ( x 0 )=0 ⇒ 0 is the root of f ( x )=0
Otherwise: root lies either between
x 0 and a or between x 0 and b. (depending

on whether f ( x 0 ) is positive or negative)


|b−a|
Let [a1, b1] be the new interval of length 2
Again:
a 1 +b1
x 1=
2
Now bisect at

If f ( x1 )=0 ⇒ x 1 is the root of f ( x )=0

Otherwise: root lies either between x 1 and a 1 or between x 1 and b 1

Let [a2, b2] be the new interval with length

|b 1−a1| 1 |b−a| |b−a|


= . = 2
2 2 2 2
After a finite number of steps either we find the exact root or the nested interval
will be formed
[ a 1 , b1 ] ⊇ [ a2 , b 2] ⊇ [ a 3 , b3 ] ⊇. . .⊇ [ an , b n]
an + bn
x n=
2
Take

NB: repeat this process until the latest interval (which contain the root) is as
small as desired, sayε

th
step, the new interval will be [an, bn] of length|b−a|
At the end of the n
2n

We then have

2|Page
Computational /Numerical Methods lecture ________________
|b −a|
≤ε
2n
|b−a| |b−a|
ln
log ε ε
n≥ e2 = −−−−−−(∗)
log e ln 2

(*) gives the number of iterations required to achieve an accuracy ε


The method is called Bisection method
3
Example1: Using Bisection Method find a real root of the equation x −x−1=0
(compute five iterations)
Solution

Since f (1)=−1<0 and f ( 2)=5> 0 and f is continuous on [1, 2]


⇒∃ c ∈(1 , 2) such that f (c )=0
1+2 15
x 0= =1 . 5 f (1. 5)= >0
Let 2 and 8
⇒ root lies between 1&1.5

1+1 .5 19
x 1= =1 . 25 f (1. 25 )=− <0
2 and 64
⇒ root lies between 1.25&1.5

1 .25+1. 5
x 2= =1 .375
2 and f (1. 375 )>0
⇒ root lies between 1.25&1.375

1 . 25+1. 375
x 3= =1 .3125
2 and f (1. 3125 )<0
⇒ root lies between 1.3125&1.375

1. 3125+1 .375
x 4= =1. 34375
2 and f (1. 34375 )>0
Example 2: determine approximately how many iterations are necessary to
3 2
solve to solve f ( x )=x + 4 x −10=0 with tolerance of ε =10 for a=1 and b=2.
−5

Solution
|b−a| |2−1|
n
≤ε n
≤10−5
2 ⇒ 2

3|Page
Computational /Numerical Methods lecture ________________
1
n
≤10−5
⇒2
−5
10
⇒ 2 ≤10 ⇒ −n log 2≤log 10 =−5
−n −5

5
n≥ ≈16 .6
log 210
⟹ At least 17 iterations are required (necessary) to achieve the desired
accuracy.

Exercise:
2
1. Find the root of ( x2 ) − sin x =0 on [1.5, 2] using Bisection method( compute
four iterations)
2. If a = 0.1 and b = 1.0, how many steps of the bisection method are needed to
–8
determine the root with an error of at most 0.5  10 .

Note: If an approximate number is correct to n decimal places, then the error is

ε=0 .5 x 10−n (which is the approximate Absolute error)

⟹Continue computing the iterations until |x n+ 1−x n|≤ ε =0.5 x 10−n(which can be used
as a stoppage criteria).
Weak and strong sides of Bisection method

1. Bisection method always converges to the exact root of f ( x )=0

2. Always we form [an, bn] such that f (an )<0 ∧ f ( bn )>0 for n≥1
2. Secant Method
The method uses two points in the neighborhood of the solution to determine a
new estimate for the solution.
The two points (say x1& x2) are used to define a straight line (Secant line), and the
point where the line intersects the x-axis (say x 3) is the new estimate for the
solution.

( x 1 , f ( x 1)) .

4|Page
Computational /Numerical Methods lecture ________________

x2(
x3 , 0 )
x1
( x 2 , f ( x 2))

The slope of the secant line is given by


f ( x1 )−f ( x 2 ) f ( x 2 )−f ( x 3 )
⇒ =
x 1−x 2 x 2 −x 3

f ( x1 )−f ( x 2 ) f ( x 2 )−0
⇒ =
x 1−x 2 x 2 −x 3

Solving for X3 :
( x 2−x 1 ) x f ( x 2 )−x 2 f ( x1 )
x 3 =x 2− f ( x 2 )= 1
f (x 2 )−f ( x 1 ) f ( x 2 )−f ( x 1 )

Once x3 is determined ,it is used together with x2 to determine x4.


( x 3 −x 2 )
x 4 =x 3 − f ( x3 )
f ( x 3 )−f ( x 2 )

In general
( x i−x i−1 )
x i+1 =x i− f ( xi )
f ( xi )−f ( x i−1 ) for i=1, 2,3,4,. . .
Example: Using Secant method perform the first four iterations to determine the
root of cosx −x e x =0 (Round your answers to four decimal places)
Solution:
Let f (x)=c osx−x e x
x 0=0 ⟹ f ( x 0 ) =f ( 0 )=1∧x 1=1 ⇒ f ( x 1 )=f ( 1 )=−2.1780
Using Secant method we have
( x 1−x 0 ) ( 1−0 )
x 2=x 1− f ( x 1 )=1− f ( 1)
f ( x 1 )−f ( x0 ) f ( 1 )−f ( 0 )

(1−0)
(−2.1780 ) =0.31466 ≈ 0.3147
¿ 1−
−2.1780−1
⟹ x 2=0.3147 and f ( x 2 ) =f ( 0.3147 )=0.5198
Hence
5|Page
Computational /Numerical Methods lecture ________________
( x 2−x 1 ) (0.3147−1)
x 3=x 2− f ( x 2 )=0.3147− f ( 0.3147 )
f ( x 2 )−f ( x 1) f ( 0.3147 )−f ( 1 )

(0.3147−1)
¿ 0.3147− ( 0.5198 ) =0.4467
0.5198−(−2.1780)
⟹ x 3=0.4467 , f ( x 3 ) =f ( 0.4467 )=0.2036
Using Secant method again, we have
( x 3−x 2 ) ( 0.4467−0.3147 )
x 4 =x3 − f ( x 3 )=0.4467− f ( 0.4467 )=0.5317
f ( x3 ) −f ( x 2 ) f ( 0.4467 )−f ( 0.3147 )
Similarly one can show that ⟹ x 5=0.5169

Therefore the required solutions (the first four iterations) are


x 2=0.3147 , x 3=0.4467 , x 4 =0.5317and x 5=0.5169

Exercise: Compute the fifth and sixth iteration


Answer: x 6=0.5177 and x 7=0.5178

Exercise: Determine the root of f ( x )=x 3−e−0.5 x by using Secant method. Start with
x 1=0 and x 2=1, carry out the first five iterations by rounding to six decimal
places.

3. (Regula -Falsi method/ method of false position)

i. In secant method, no attempt is made to ensure that the root is enclosed


between x i and x i−1.
ii. If we choose the interval which contains the root (by IVT) at each step to
determine a root of the equation, the method is called Regula -Falsi
method/ method of false position
Example: Using Regul-Falsi method perform the first four iterations to determine
the root of cosx −x e x =0 (Round your answers to four decimal places)
Solution:
Let f ( x)=c osx−x e x
x 0=0 ⟹ f ( x 0 ) =f ( 0 )=1∧x 1=1 ⇒ f ( x 1 )=f ( 1 )=−2.1780
⟹root lies between x 0=0 and x 1=1
Using Regul-Falsi method we have
( x 1−x 0 ) ( 1−0 )
x 2=x 1− f ( x 1 )=1− f ( 1)
f ( x 1 )−f ( x0 ) f ( 1 )−f ( 0 )

6|Page
Computational /Numerical Methods lecture ________________
(1−0)
¿ 1− (−2.1780 ) =0.31466 ≈ 0.3147(Similar to secant method)
−2.1780−1
⟹ x 2=0.3147 and f ( x 2 ) =f ( 0.3147 )=0.5198>0
Since f ( x 1 ) . f ( x 2 )=f ( 1 ) f ( 0.3147 )<0, root lies in [1, 0.3147]= [ x 1 , x 2]
Hence
( x 2−x 1 ) (0.3147−1)
x 3=x 2− f ( x 2 )=0.3147− f ( 0.3147 )
f ( x 2 )−f ( x 1) f ( 0.3147 )−f ( 1 )

(0.3147−1)
¿ 0.3147− ( 0.5198 ) =0.4467
0.5198−(−2.1780)
⟹ x 3=0.4467 , f ( x 3 ) =f ( 0.4467 )=0.2036 >0
Since f ( x 1 ) . f ( x 3 )=f ( 1 ) f ( 0.4467 ) <0, root lies in [1, 0.4467]= [ x 2 , x 3] (say)
Hence
( x 3−x 2 ) ( 0.4467−1 )
x 4 =x3 − f ( x 3 )=0.4467− f ( 0.4467 )
f ( x3 ) −f ( x 2 ) f ( 0.4467 )−f ( 1 )
( 0.4467−1 )
0.4467− 0.2036 = 0.4940(which is different from that of the secant)
0.2036−−2.1780
and f ( x 4 )=f ( 0.4940 )=cos ( 0.4940 )−0.4940 e 0.4940 =0.0708> 0

Since f ( x 1 ) . f ( x 4 ) =f ( 1 ) f ( 0.4940 )<0, root lies in [1, 0.4940]= [ x 3 , x 4 ] (say)


Thus find x 5(Exercise)

4. Newton-Raphson Method
Let x0 be the approximate root of f(x)=0 and x1=x0+h is exact root.
⟹ f ( x 1 )=f ( x 0+ h )=0
Expanding f ( x 0 +h ) by Taylor series, we obtain
2 3
' h '' h '' '
0=f ( x 0 ) +h f ( x 0 ) + f ( x 0 ) + f ( x 0 ) +. . .
2! 3!
Since h=x 1 −x 0 is small, neglecting the second and higher order derivatives
'
f ( x 0 ) + h f ( x0 ) =0
−f (x )
⟹ h= ' 0
f (x 0 )
⟹ a better approximation than x 0is therefore given by x 1,where
x 1=x 0 +h

f (x 0)
⟹ x 1=x 0− '
f (x 0)

7|Page
Computational /Numerical Methods lecture ________________
Similarly, a better approximation than x 1 is x 2is given by

f (x 1 )
⟹ x 2=x 1− '
f (x 1)

In general

f ( x2 ) f (x )
⟹ x 3=x 2− '
⟹ x 4 =x3 − ' 3 . ..
f (x 2) f (x 3)

f (x n )
⟹ x n+1=x n− ' for n=0, 1, 2, 3 , . . .
f (x n )

Example: use Newton-Raphson method to find the root of x 3−2 x−5=0 correct to
six decimal places (take x 0=2).

Solution: let f ( x )=x 3−2 x−5 ⟹ f ' ( x )=3 x 2−2

using Newton-Raphson, we have


3
f (x n ) x n −2 x n−5
⟹ x n+1=x n− '
=x n− 2 for n=0,1,2,3, …….
f (x n ) 3 x n−2

Hence
3
f (x 0) x 0−2 x 0−5
⟹ x 1=x 0− '
=x 0− 2
f (x 0) 3 x 0 −2
3
2 −2(2)−5 −1
¿ 2− 2
=2− =2.1000000
3(2 )−2 10

f ( x1 ) 3
x 1−2 x1 −5
x 2=x 1− '
=x 1− 2
f ( x1 ) 3 x 1−2

3
2.100000 −2(2.1000000)−5
¿ 2.1000000− =2.0945681211042 ≈ 2.0945681
3 x 2.1000002−2
3
f ( x2 ) x2 −2 x 2−5
⟹ x 3=x 2− '
=x 2− 2
=2.0945514816978≈ 2.0945515
f (x 2) 3 x 2−2
3
f (x 3) x 3−2 x 3−5
⟹ x 4=x 3− '
=x 3− 2
=2.0945514815423 ≈ 2.0945515
f (x 3 ) 3 x 3−2

8|Page
Computational /Numerical Methods lecture ________________
Since|x 4 −x 3|0.000000 ≤ 0.5 x 10 , the desired root is x=2.094552 correct to six
−6

decimal places.

Exercise:

Find the root of x=e− xusing Newton-Raphson method correct to 3 decimal places
(Take x 0=1 ¿.

5. Fixed point Iteration method

f ( x )=0
To describe this method for finding the roots of
We rewrite this equation in the form of
x=φ ( x ) (*)
3 2
Example: x + x −1=0 can be expressed as
1

2
a. x=(1+ x ) =φ( x )
1
3 2
b. x=(1−x ) =φ( x )
1
2 3
c. x=(1−x ) =φ( x )

Let
x 0 be the approximate value of the desired root α

From (*) we obtain

x 1=φ( x 0 )

Successive approximations are then given by

x 2 =φ( x 1 )

x 3 =φ( x 2 )

x 4 =φ( x 3 )

x n =φ( x n−1 )

Where the sequence of approximations


x 0 , x 1 , x 2 , x 3 , . . . x n always converge to the root
of x=φ ( x ) .

9|Page
Computational /Numerical Methods lecture ________________
x , x , x , x , . . . x n does not always converge
Note: the sequences of approximations 0 1 2 3
to some numberα .
x
Example: consider x=10 +1=φ( x )

If we take
x 0 =0 ,then

x 1=2, x 2 =101 , x 3 =10101 +1 , etc.

⟹The sequence of approximations x 0 , x 1 , x 2 , x 3 , . . . x n does not converge.

Theorem:(Condition for convergence)

Let x=α be a root of f ( x )=0 which is equivalent to x=φ ( x ) and I be an interval

containing α andφ ( x ) is continuous in I .if |φ' ( x)|<1 for ∀ x ∈ I ,then the sequence

of approximations
x 0 , x 1 , x 2 , x 3 , . . . x n will converge to α provided that the initial

approximation
x 0 is chosen in I.

Proof:
α is a root of f ( x )=0

⇒ α is a root of x=φ ( x )
⇒ α=φ(α )
x x
And x n =φ( x n−1 ) where n and n−1 two successive approximations of α

⇒ x n −α=φ ( x n−1 )−φ (α )


φ( x n−1 )−φ(α ) '
=φ ( β )
and by MVT x n−1−α x < β< α
where n−1
'
⇒ φ ( x n−1 )−φ (α )=(x n−1−α )φ ( β )

⇒ x n −α = ( x n−1 −α )φ ( β )
'

If we let |φ' ( x)|≤k<1 ∀ x ∈ I ,then


|x n −α|=|( x n−1 −α )φ' ( β )|≤k|x n−1−α|
⇒ |x n −α|≤k|x n−1 −α|
⇒ |x n −α|≤k|x n−1 −α|≤k.k|x n−2−α |≤k .k .k|x n−3 −α| . . .
n
In general |x n −α|≤k |x 0 −α|
n
as n→∞ , k |x 0 −α|→0 ,(since 0<k<1)

10 | P a g e
Computational /Numerical Methods lecture ________________
⇒ |x n −α|→0 as n →∞
lim |x n −α|=0
⇒ n→∞

Therefore, the sequence of successive approximations


x 0 , x 1 , x 2 , x 3 , . . . x n converge to
the root α if k<1

i.e. |φ' ( x)|<1

if k > 1
|x n −α|→∞ as n →∞

⇒ The sequence of successive approximations does not converge.

3 2
Example1: Find the root of the equation f ( x )=x + x −1=0 on the interval [0, 1]
correct to three decimal places.

f ( x )=x 3 + x 2 −1=0
Solution

x 3 + x 2 −1=0
x 2 ( x +1)=1

1
x=
√ x +1
1
let x= =φ ( x )
√ x +1
1 1 1
⇒ φ' ( x )=− =−
2 √(1+x )3 2 √(1+x )3

1 1
≤ <1 ∀ x ∈[ 0 , 1 ]
|φ ( x)|= 2 √(1+x ) 2
' 3

Thus the iteration method can be applied

Let
x 0 =0 .75 be the initial approximation

1
x 1=φ( x 0 )= =0 . 7559
Hence √ 0. 75+1

11 | P a g e
Computational /Numerical Methods lecture ________________
1
x 2 =φ( x 1 )= =0 .7547
√0 . 7559+1
1
x 3 =φ( x 2 )= =0 . 7549
√ 0. 7547+1
Since|x 3−x 2|0.0002 ≤0.5 x 10 , the approximate root is 0.755correct to three
−3

decimal places.
Exercise:
1. Find the root of the equationcos x=3 x−1 correct to three decimal places on
π
[0, ]
2 using fixed point iteration method
2. Using fixed point iteration compute three iterations to find a real root of the
equation sin x +5 x+2=0 (take x 0=0 ).

12 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy