The Islamic University of Gaza Faculty of Engineering...

Post on 04-May-2018

234 views 0 download

Transcript of The Islamic University of Gaza Faculty of Engineering...

The Islamic University of GazaFaculty of Engineering

Civil Engineering Department

Numerical AnalysisECIV 3306

Chapter 5Bracketing Methods

PART II ROOTS OF EQUATIONS

Roots ofEquations

Bracketing MethodsBisection method

False Position Method

Open Methods

Simple fixed point iteration

Newton Raphson

Secant

Modified Newton Raphson

System of NonlinearEquations

Roots of polynomials

Muller Method

STUDY OBJECTIVES FOR PART TWO

• Understand the graphical interpretation of a root• Know the graphical interpretation of the false-position method

and why it is usually superior to the bisection method.• Understand the difference between bracketing and open

methods for root location.• Understand the concepts of convergence and divergence.• Know why bracketing methods always converge, whereas open

methods may sometimes diverge.• Know the fundamental difference between the false-position

and secant methods and how it relates to convergence

ROOTS OF EQUATIONS

• Root of an equation: is the value of the equation variable whichmake the equations = 0.0

• But

aacbbxcbxax

240

22

?0sin?02345

xxxxfexdxcxbxax

ROOTS OF EQUATIONS

• Non-computer methods:- Closed form solution (not always available)- Graphical solution (inaccurate)

• Numerical systematic methods suitable forcomputers

Graphical Solution

roots

• The roots exist where f(x) crosses the x-axis.

f(x)

xf(x)=0 f(x)=0

• Plot the function f(x)

Graphical Solution: Example

• The parachutist velocity is

• What is the drag coefficient c needed to reach a velocity of40 m/s if m=68.1 kg, t =10 s, g= 9.8 m/s2

)(t

mc

e1c

mgv

40)1(38.667)(

)1()(

146843.0 c

tmc

ec

cf

vec

mgcf

c

f(c)

c=14.75 Check: F (14.75) = 0.059 ~ 0.0

v (c=14.75) = 40.06 ~ 40 m/s

Numerical Systematic MethodsI. Bracketing Methods

f(x)

x

roots

f(xl)=+ve

f(xu)=+ve

xl xu

No roots or evennumber of roots

f(x)

x

roots

f(xl)=+ve

f(xu)=-vexl xu

Odd number of roots

Bracketing Methods (cont.)

• Two initial guesses (xl and xu) are required for the

root which bracket the root (s).

• If one root of a real and continuous function, f(x)=0,

is bounded by values xl , xu then f(xl).f(xu) <0.

(The function changes sign on opposite sides of the root)

Bracketing Methods1. Bisection Method

• Generally, if f(x) is real and continuous in the interval xl to xu

and f (xl).f(xu)<0, then there is at least one real root between

xl and xu to this function.

• The interval at which the function changes sign is located.

Then the interval is divided in half with the root lies in the

midpoint of the subinterval. This process is repeated to

obtained refined estimates.

f(x)

xxuxl

f(xu)

f(xl )

xr1

f(x)

xxuxl

f(xu)

xr2

xr = ( xl + xu )/2

f(xu)

f(xr1)

f(xr2)

(f(xl).f(xr)<0): xu = xrxr = ( xl + xu )/2

Step 1: Choose lower xl and upper xu

guesses for the root such that:

f(xl).f(xu)<0Step 2: The root estimate is:

xr = ( xl + xu )/2

Step 3: Subdivide the interval according to:– If (f(xl).f(xr)<0) the root lies in the

lower subinterval; xu = xr and go tostep 2.

– If (f(xl).f(xr)>0) the root lies in theupper subinterval; xl = xr and go tostep 2.

– If (f(xl).f(xr)=0) the root is xr and stop

Bisection Method - Termination Criteria

• For the Bisection Method a > t

• The computation is terminated when abecomes less than a certain criterion ( a < s)

%100

:

true

eapproximattruet X

XXErrorrelaiveTrue 1

:

100%

100% (Bisection)

n nr r

a nr

u la

u l

Approximate relative Error

X XX

X XX X

Bisection method: Example

• The parachutist velocity is

• What is the drag coefficient c needed to reach a velocity of 40

m/s if m = 68.1 kg, t = 10 s, g= 9.8 m/s2

f(c)

c

)(t

mc

e1c

mgv

40)1(38.667)(

)1()(

146843.0 c

tmc

ec

cf

vec

mgcf

f(x)

x1612 -2.269

6.067

14

f(x)

x14 16-0.425 -2.269

1.569

1.569

(f(12).f(14)>0): xl = 14

1. Assume xl =12 and xu=16f(xl)=6.067 and f(xu)=-2.269

2. The root: xr=(xl+xu)/2= 14f(14)=1.569

3. Check f(12).f(14) = 6.067× 1.569=9.517 >0;the root lies between 14 and 16.

4. Set xl = 14 and xu=16, thus the new rootxr=(14+ 16)/2= 15

f(14)=-0.4255. Check f(14).f(15) = 1.569× -0.425= -0.666 <0;

the root lies bet. 14 and 15.6. Set xl = 14 and xu=15, thus the new root

xr=(14+ 15)/2= 14.5

and so on…... 15

Iter. Xl Xu Xr a% t%1 12 16 14 ----- 5.2792 14 16 15 6.667 1.4873 14 15 14.5 3.448 1.8964 14.5 15 14.75 1.695 1.2045 14.75 15 14.875 0.84 0.6416 14.74 14.875 14.813 0.422 0.291

• In the previous example, if the stopping criterion is t =0.5%; what is the root?

Bisection method: Example

Bisection method

Bracketing MethodsBisection

Example;Use bisection method to find the root of

Continue the iterations until the approximate error fallsbelow a stopping criteria ( s ) = 0.5%

104)( 23 xxxf

Flow Chart –BisectionStart

Input: xl , xu , s, maxi

f(xl). f(xu)<0

i=0a=1.1 s

False

whilea> s &i <maxi

False

Stop

Print: xr , f(xr ) , a , i

12

ii

xxx ulr

xu+xl =0

100%u la

u l

x xx x

True

Test=f(xl).f(xr)

a=0.0Test=

0

xu=xr

Test<0

xl=xr

True

True

False

Bracketing Methods2. False-position Method

• The bisection method divides the interval xl to xu inhalf not accounting for the magnitudes of f(xl) andf(xu). For example if f(xl) is closer to zero than f(xu),then it is more likely that the root will be closer tof(xl).

2. False-position Method

• False position method is analternative approach wheref(xl) and f(xu) are joined bya straight line; theintersection of which withthe x-axis represents animproved estimate of theroot.

f(x)

xxuxl

f(xu)

f(xl)

xr

f(xr)

)()())((

)()(

ul

uluur

ur

u

lr

l

xfxfxxxfxx

xxxf

xxxf

False-position Method -Procedure

Step 1: Choose lower xl and upper xu guesses for theroot such that: f(xl).f(xu)<0Step 2: The root estimate is:

Step 3: Subdivide the interval according to:– If (f(xl).f(xr)<0) the root lies in the lower

subinterval; xu = xr and go to step 2.– If (f(xl).f(xr)>0) the root lies in the upper

subinterval; xl = xr and go to step 2.– If (f(xl).f(xr)=0) the root is xr and stop

)()())((

ul

uluur xfxf

xxxfxx

False-position Method -Procedure

False position method: Example

• The parachutist velocity is

• What is the drag coefficient c needed to reach a

velocity of 40 m/s if m =68.1 kg, t =10 s, g= 9.8 m/s2

f(c)

c

)(t

mc

e1c

mgv

40)1(38.667)(

)1()(

146843.0 c

tmc

ec

cf

vec

mgcf

f(x)

x1612

-2.269

6.067

14.91

False position method: Example1. Assume xl = 12 and xu=16

f(xl)= 6.067 and f(xu)= -2.269

2. The root: xr=14.9113

f(12) . f(14.9113) = -1.5426 < 0;

3. The root lies bet. 12 and 14.9113.

4. Assume xl = 12 and xu=14.9113, f(xl)=6.067 andf(xu)=-0.2543

5. The new root xr= 14.7942

6. This has an approximate error of 0.79%

False position method: Example

Flow Chart –False PositionStart

Input: xl , x0 , s, maxi

f(xl). f(xu)<0

i=0a=1.1 s

False

whilea> s &i <maxi

( )( )( ) ( )

1

u l ur u

l u

f x x xx xf x f x

i i

False

Stop

Print: xr , f(xr ) , a , i

i=1or

xr=0

0 100%r ra

r

x xx

True

Test=f(xl). f(xr)

a=0.0Test=0

xu=xrxr0=xr

Test<0

xl=xrxr0=xr

True

True

False

False Position Method-Example 2

False Position Method - Example 2

Roots of Polynomials: Using SoftwarePackages

MS Excel:Goal seekf(x)=x-cos x