0% found this document useful (0 votes)
35 views25 pages

CH 05

Uploaded by

w.vwv2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views25 pages

CH 05

Uploaded by

w.vwv2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Chapter 5

~Roots of Equations ~
Bracketing Methods

“These notes are only to be used in class presentations”


1
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Roots of Equations
The root of an equation is the value of x that makes f(x) = 0
(real or complex). Roots are called the zeros of equation.
• Easy
 b  b 2
 4ac
ax  bx  c  0  x 
2

2a

• But, not easy


ax5  bx4  cx3  dx2  ex  f  0  x?

• How about these?


sin x  x  0  x?
cos(10 x)  sin(3x)  0  x  ? 2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
There are two general class of functions:

•Algebraic functions : f n y n  f n 1 y n 1   f1 y1  f 0  0

Polynomials are a simple class of algebraic functions in the


form of
f n ( x)  a0  a1x  a2 x 2    an x n

• Transcendental functions: Non algebraic functions such as


trigonometric, exponential, logarithmic etc.

f ( x)  ln x 2 or f ( x)  e 0.2 x sin(3x  0.5)

3
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The standard methods for locating roots typically fall
into two problems:

• The determination of the real roots of algebraic and


transcendental functions.

•The determination of the real and the complex roots of the


polynomials.

4
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Nonlinear Equation
Solvers for real roots

Bracketing Open Methods

Bisection Newton Raphson


False Position Fixed-point iteration
(Regula-Falsi) Secant

All Iterative
5
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Bracketing Methods

• Bracketing methods consider the


fact that a function typically
changes sign in the vicinity of
the root.
• Two initial guesses for the root
are required. These guesses
must “bracket” or be on either
side of the root.
• If one root of a real and
continuous function, f(x)=0, is
bounded by values x=xl,
x =xu then f(xl)· f(xu) <0. (The
function changes sign on
opposite sides of the root)
6
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Graphical Approach
• Make a plot of the
function f(x) and f(x)=sin(10x)+cos(3x)
observe where it
crosses the x-axis,
i.e. f(x) = 0

• Not very practical


but can be used to
obtain rough
estimates for roots

• These estimates can Two distinct


be used as initial roots between
guesses for
numerical methods x= 4.2 and 4.3
that we’ll study here.
7
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
A root may occur in an interval

xl xu xl xu

xl: lower bound xu: upper bound


If f(xl) and f(xu) have the same sign,
(a) there will be no roots.
(c) there will be an even number of roots within the
interval.

8
8

Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
xl xu
xl xu

If f(xl) and f(xu) have the opposite sign,


(b) and (d) there will be an odd number of roots within
the interval.

9
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Cases where the general rule does not hold

(a) For this case, although f(xl) and


f(xu) have the opposite signs, because
the function is tangential to the x-axis,
an even number of roots occur.

(b) Discontinuous function where end


points of opposite sign bracket an even
number of roots.

10
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Bisection Method
Step 1: Choose lower xl and upper xu guesses for the root such that the function
changes sign over the interval. This can be checked by ensuring that
f ( xl )  f ( xu )  0
Step 2: An estimate of the root xr is determined by
x  xu
xr  l
2
Step 3: Make the following evaluations to determine in which subinterval
the root lies.
a) If f ( xl )  f ( xr )  0 , the root lies in the lower subinterval. Therefore,
set xu=xr and return to step 2.
b) If f ( xl )  f ( xr )  0 , the root lies in the upper subinterval. Therefore,
set xl=xr and return to step 2.
Terminate the computation when εa ≤ εs OR Max.Iteration is reached
xrnew  xrold
Approximate relative error : a 
xrnew

Then xrestimate  xrnew 11


Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
If a function is continuous on [xl , xu ] and f ( xl )  f ( xu )  0
the bisection method generates a sequence of root
approximations with
xu  xl
x (n)
r x true
r  when n  1
2n
Also if εs is the specified or desired error, the number of
iterations to achieve this desired error is

log( xu  xl )  log  s
n
log 2

* Proof will be given in class.

12
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Approximate relative error for the ith iteration

( i 1)
xr  xr xu  xl
(i ) (i ) (i )
a (i )
 a (i )
 (i )
xu  xl
(i ) (i )
xr

13
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 5.1: Determine the real root of f ( x)  x 3  4 x 2  10
using bisection method in the interval [1,2]. Iterate until the
estimated error εa falls below a level of εs=0.01

Iter. no xl xu xr f(xr) εa
1 1 2 1.5 2.375 0.333333
2 1 1.5 1.25 -1.796875 0.2
3 1.25 1.5 1.375 0.162109 0.090909
4 1.25 1.375 1.3125 -0.848389 0.047619
5 1.3125 1.375 1.34375 -0.350983 0.023256
6 1.34375 1.375 1.359375 -0.096409 0.011494
7 1.359375 1.375 1.367188 0.032356 0.005714

14
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 5.2: Determine the real root of f ( x )  e  x  x
using bisection method in the interval [0,1]. Iterate until the
estimated error εa falls below a level of εs=0.01

Iter. no xl xu xr f(xr) εa
1 0 1 0.5 0.106531 1
2 0.5 1 0.75 -0.277633 0.333333
3 0.5 0.75 0.625 -0.089739 0.2
4 0.5 0.625 0.5625 0.007283 0.111111
5 0.5625 0.625 0.59375 -0.041498 0.052632
6 0.5625 0.59375 0.578125 -0.017176 0.027027
7 0.5625 0.578125 0.570313 -0.004964 0.013699
8 0.5625 0.570313 0.566406 0.001155 0.006897

15
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Evaluation of the Method

Advantages Disadvantages
• Easy • Slow
• Always finds root • Doesn’t work for multiple
• Number of iterations roots
required to attain an • No account is taken of f(xl)
absolute error can be and f(xu). If f(xl) is closer to
computed a priori. zero, it is likely that root is
closer to xl .

16
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The False-Position Method

• The false position method works in a


similar fashion to the bisection
method.
• Start with an initial interval [xl,xu]
where f(xl) and f(xu) have opposite
signs, which is the same as the
bisection.
• Instead of choosing the initial guess
xr as the midpoint of the interval, we
join the point {xl, f(xl) } and {xu, f(xu) }
with a straight line and choose xr as the
point where that straight line crosses
the x-axis.
17
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The False-Position Method
Step 1: Choose lower xl and upper xu guesses for the root such that the function
changes sign over the interval. This can be checked by ensuring that
f ( xl )  f ( xu )  0
Step 2: An estimate of the root xr is determined by
f ( xu )  ( xu  xl )
xr  xu 
f ( xu )  f ( xl )
Step 3: Make the following evaluations to determine in which subinterval
the root lies.
a) If f ( xl )  f ( xr )  0 , the root lies in the lower subinterval. Therefore,
set xu=xr and return to step 2.
b) If f ( xl )  f ( xr )  0 , the root lies in the upper subinterval. Therefore,
set xl=xr and return to step 2.
Terminate the computation when εa ≤ εs OR Max.Iteration is reached
xrnew  xrold
Approximate relative error : a 
xrnew

Then xrestimate  xrnew 18


Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 5.3: Determine the real root of f ( x)  x 3  4 x 2  10
using false-position method in the interval [1,2]. Iterate until the
estimated error εa falls below a level of εs=0.01

Iter. no xl xu xr f(xr) εa
1 1 2 1.263158 -1.602274
2 1.263158 2 1.338828 -0.430365 0.05652
3 1.338828 2 1.358546 -0.110009 0.014514
4 1.358546 2 1.363547 -0.027762 0.003668

19
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 5.4: Determine the real root of f ( x)  e  x  x
using false-position method in the interval [0,1]. Iterate until the
estimated error εa falls below a level of εs=0.01

Iter. no xl xu xr f(xr) εa
1 0 1 0.6127 -0.070814
2 0 0.6127 0.572181 -0.007888 0.070814
3 0 0.572181 0.567703 -0.000877 0.007888

20
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 5.5: Determine the real root of f ( x)  x  x1 / 3  2

using false-position method in the interval [3,4]. Iterate until the


estimated error εa falls below a level of εs=0.01

Iter. no xl xu xr f(xr) εa
1 3.00000 4.00000 3.51734 -0.00346
2 3.51734 4.00000 3.52135 -0.00002 0.00114

21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Why this method?
•Faster
•Always converges for a
single root.

22
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Bisection method vs. False Position Method

• They are both convergent.


• They don’t work for multiple roots.
• Need to find initial guesses for xl and xu
• False-position method is usually faster than bisection
method.

23
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Bisection method vs. False Position Method

•Although the interval where the root is [xl,xu] becomes


iteratively smaller with the false position method, unlike the
bisection method, the size of the interval does not necessarily
converges to zero.
• As the iterations proceed, you may get stuck at one of the
bounds especially for the functions with significant curvature
(one-sidedness). This sometimes cause the false position to
converge slower than bisection

Modified False Position Method


– Detect when you get stuck and use a bisection method
– Can get you to convergence faster

24
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 5.6: Use bisection and false position method to locate
the root of f ( x)  x10  1 between 0 and 1.3
Results obtained by using bisection method

Iter. no xl xu xr εa
1 0 1.3 0.65
2 0.65 1.3 0.975 0.333
3 0.975 1.3 1.1375 0.143
4 0.975 1.1375 1.05625 0.077
5 0.975 1.05625 1.01563 0.004

Results obtained by using false-position method

Iter. no xl xu xr εa
1 0 1.3 0.0943
2 0.0943 1.3 0.18176 0.481
3 0.18176 1.3 0.26287 0.309
4 0.26287 1.3 0.33811 0.223
5 0.33811 1.3 0.40788 0.171
25
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

You might also like