You are on page 1of 8

9/14/2012

WEEK 2
Roots of Equations: Bracketing method
Graphical method
Bisection method
False Position method
2

LESSON OUTCOMES

At the end of this topic, the students will be able:

To identify and apply the bracketing methods to


solve roots of equations

1
9/14/2012

Roots of Equation
Root of equation is obtained at value of x when the f(x)=0
Before digital computers, root of algebraic and transcendental
equations could be found by
direct method that can be solved analytically, but not easy for complex
function
plot function and determine where it crosses the x axis, but it lacks of
precision
Why?
b b 2 4ac
ax 2 bx c 0 x
2a
But
ax 5 bx 4 cx 3 dx 2 ex f 0 x ?
sin x x 0 x ?
4

Roots of Equations

Bracketing methods Open methods

Methods start with two Methods involve systematic


initial guesses that bracket trial-and-error iterations but
(or contain) the root and no need for the initial
then systematically reduce guesses to bracket the root.
the width of the bracket.

Graphical Methods
This is a simple method to get an estimate of the root of the
equation f(x) =0.

The function f(x) is plotted against x and the location(s)


where it crosses the x axis (i.e. f(x) = 0) provides a rough
approximation of the root(s).

Graphical techniques are limited practical value (not precise).

It can be utilized to obtain rough estimates of roots.

These estimates can be used as initial guesses for advanced


numerical methods.

2
9/14/2012

Example
Use the graphical approach to determine the drag coefficient c needed
for a parachutist of mass m = 68.1kg to have a velocity of 40m/s after free
falling for time t=10s. Note: acceleration due to gravity is 9.8 m/s2.

Solution
From equation that derived Inserting all the known
from Newtons second law parameters:
for the parachutists velocity:
667.38
f (c ) (1 e 0.146843c ) 40
c

Various values of c can be


It can be expressed in the
inserted into the right hand
form of f(c) = 0.
side of eq. to calculate f(c)
gm
f (c ) (1 e ( c / m ) t ) v
c

The resulting curve crosses


the c axis between 12 and 16.

Visual inspection of the plot


provides a rough estimate of
the root at 14.75.

c f(c) Upper bound,


4 34.115 f(xu)
8 17.653
12 6.067
16 -2.269
20 -8.401

f(xl) and f(xu) have


Lower bound,
different signs then, f(xl)
f(xl) f(xu) < 0

f(x) f(x)

*
* * *
x x
Xl Xu Xl Xu

a. f(xl) and f(xu) have the same sign, no c. f(xl) and f(xu) have the same sign, no
roots or even number of roots in interval roots or even number of roots in interval
f(x)
f(x)

Xu

* Xl

*
x
x
* Xl
*
Xu

b. Function has different signs at the end d. Function has different signs at the end
points, there will be an odd number of points, there will be an odd number of
roots in the interval roots in the interval

3
9/14/2012

Bisection Method
From the graphical method, we found that when a function f(x) is continuous
and real in the interval from xl to xu , and f(xl) and f(xu) have opposite signs,
f(xl) f(xu) < 0
then there is at least one real root between xl and xu.

10

Procedure for bisection method

Choose xl and xu guesses point, and ensure f(xl)f(xu) < 0

Estimate the root, xr by

If f(xl) f(xr) <0 the root lies in the lower subinterval, then
set xr as xu, and repeat to find new xr

If f(xl) f(xr) >0 the root lies in the upper subinterval, then
set xr as xl, and repeat to find new xr

If f(xl)f(xr)=0 the root equals to xr, STOP!!

Compare s with a.If a< s, stop. xrnew xrold


a 100 %
Otherwise repeat the process. xrnew

Example
Use the bisection method to determine the drag coefficient c needed for a
parachutist of mass m = 68.1kg to have a velocity of 40m/s after free falling
for time t=10s. Note: acceleration due to gravity is 9.8 m/s2. Given s=0.5%
and true value = 14.7802.
667.38
f (c ) (1 e 0.146843c ) 40
c
Solution
Guess two values of the unknown that give values for f(c) with different signs.
From previous example, f(c) changes sign between 12 and 16. Therefore,
set xl = 12 and xu = 16.

Estimate the root,


xl xu 12 16
xr 14
2 2
Compute the product of function value at lower bound and at midpoint,
f ( xl ) f ( xr ) f (12) f (14) 6.067(1.569) 9.519 0
No sign change occurs between lower bound and midpoint. Thus, root must be
located between 14 and 16. Set xl = 14 and xu = 16.

12

4
9/14/2012

Calculate new xr,


xl xu 14 16
xr 15
2 2
Compare a with s.
xrnew xrold 15 14
a 100 % 100 % 6.667% s
xrnew 15
Compute the product of function value at lower bound and at midpoint,
f ( xl ) f ( xr ) f (14) f (15) 1.569(0.425) 0.667 0
The root is between 14 and 15. Set xl = 14 and xu = 15.

Calculate new xr,


xl xu 14 15
xr 14.5
2 2
Compare a with s.
xrnew xrold 14.5 15
a 100 % 100 % 3.448% s
xrnew 14.5

13

Repeat the calculation until termination criteria is met.

Iteration xl xu xr a(%) t(%)


1 12 16 14 5.279
2 14 16 15 6.667 1.487
3 14 15 14.5 3.448 1.896
4 14.5 15 14.75 1.695 0.204
5 14.75 15 14.875 0.840 0.641
6 14.75 14.875 14.8125 0.422 0.219

14

Exercise
Find the root of the 3rd-order polynomial using bisection
f ( x) x3 x 2 10 x 8 0
in the interval [3.75,5]. The tolerance s is 0.5%.

15

5
9/14/2012

False Position Method


The false-position method takes into account the
magnitudes of the function at the lower and upper
bounds, f(xl) and f(xu).

For example, if f(xl) is closer to zero than f(xu) then


xl is likely to be closer to the root xr than xu is.

This results in an improved estimate of the root.

16

If a real root is bounded by xl


and xu of f(x) = 0, then we can
approximate the solution by
doing a linear interpolation
between the points [xl, f(xl)] and
[xu, f(xu)] to find the xr value l(xr)
such that l(xr) = 0, l(x) is the
linear approximation of f(x).
Thus, using similar triangle we
can write,
f ( xl ) f ( xu )

xr xl xr xu
Solving for xr ,

f ( xu )( xl xu )
xr xu
f ( xl ) f ( xu )

Derivation of method: page 125


17

Procedure for false position method

Choose xl and xu guesses point, , and ensure f(xl)f(xu) < 0

Estimate the root, xr from


f ( xu )( xl xu )
xr xu
f ( xl ) f ( xu )

Evaluate f(xr), replace xr whichever of xl or xu yields a


function value with the same sign as f(xr).

If f(xr) = 0 the root equals to xr, terminate the computation

Compare s with a If a< s, stop. Otherwise repeat the process.

6
9/14/2012

Example
Use the false position method with guess of xl = 12 and xu = 16 to determine
the drag coefficient c needed for a parachutist of mass m = 68.1kg to have a
velocity of 40m/s after free falling for time t=10s. Note: acceleration due to
gravity is 9.8 m/s2. Given s=0.5% and true value = 14.7802.
667.38
f (c ) (1 e 0.146843c ) 40
c
First iteration

xl 12 f ( xl ) 6.0669

xu 16 f ( xu ) 2.2688

2.2688(12 16)
x r 16 14.9113
6.0669 ( 2.2688)

19

Second iteration

f ( xl ) f ( x r ) ( 6.0669)( 0.2543) 1.5428

xl 12 f ( xl ) 6.0669

xu 14.9113 f ( xu ) 0.2543 [ xu replace by x r ]

0.2543(12 14.9113)
x r 14.9113 14.7942
6.0669 ( 0.2543)
14.7942 14.9113
a 100% 0.79%
14.7942

20

Third iteration

f ( xl ) f ( x r ) ( 6.0669)( 0.0273) 0.1656

xl 12 f ( xl ) 6.0669

xu 14.7942 f ( xu ) 0.0273 [ xu replace by x r ]

0.0273(12 14.7942)
x r 14.7942 14.7817
6.0669 ( 0.0273)
14.7817 14.7942
a 100% 0.0846%
14.7817

21

7
9/14/2012

Exercise
Find the root of the 3rd-order polynomial using FP
f ( x) x3 x 2 10 x 8 0
in the interval [3.75,5]. The tolerance s is 0.5%.

22

Lets try
Use both the bisection and false-position method to find the
root of
f ( x) x 4 2 0

in the interval [0, 2] until the approximate percent relative


error is less than 5%.

23

Exercise
(5.4) Determine the roots of f(x) = -12 21x +18x2 2.75x3
with
a) Bisection
b) False position
Using initial guess of xl = -1 and xu = 0 and stopping criterion
of 1%.

(5.6) Determine the positive real root of ln(x4)=0.7


a) Using three iterations of the bisection method with
initial guesses of xl = 0.5 and xu = 2,
b) Using three iterations of the false position method with
same initial guesses as in (a).

24

You might also like