Week02_Bracketing Methods.pptx

Post on 14-Jul-2016

5 views 2 download

transcript

CHE 555NUMERICAL METHODS AND

OPTIMIZATION

WEEK 2

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

2

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

To identify and apply the bracketing methods to solve roots of equations

LESSON OUTCOMES

4

• 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?

• But

aacbbxcbxax

240

22

?0sin?02345

xxxxfexdxcxbxax

Roots of Equation

5

Roots of Equations

Bracketing methods Open methods

Methods start with two initial guesses that bracket (or contain) the root and then systematically reduce the width of the bracket.

Methods involve systematic trial-and-error iterations but no need for the initial guesses to bracket the root.

6

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.

7

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.

SolutionFrom equation that derived from Newton’s second law for the parachutist’s velocity:

It can be expressed in the form of f(c) = 0.

vec

gmcf tmc )1()( )/(

Inserting all the known parameters:

40)1(38.667)( 146843.0 cec

cf

Various values of c can be inserted into the right hand side of eq. to calculate f(c)

8

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)4 34.115

8 17.653

12 6.06716 -2.26920 -8.401

f(xl) f(xu) < 0

f(xl) and f(xu) have different signs then,

Lower bound, f(xl)

Upper bound, f(xu)

f(x)

x

* *

f(x)

x

* *

f(x)

x

*

*

f(x)

x

*

*

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

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

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

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

Xl Xu

Xl

Xu

Xl Xu

Xl

Xu

10

Bisection MethodFrom 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,

then there is at least one real root between xl and xu.

f(xl) f(xu) < 0

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.

Otherwise repeat the process.

Procedure for bisection method

% 100εa newr

oldr

newr

xxx

12

ExampleUse 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.

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,

Compute the product of function value at lower bound and at midpoint,

No sign change occurs between lower bound and midpoint. Thus, root must be located between 14 and 16. Set xl = 14 and xu = 16.

142

16122

ulr

xxx

0 519.9)569.1(067.6)14()12()()( ffxfxf rl

40)1(38.667)( 146843.0 cec

cf

13

Calculate new xr,

Compare εa with εs.

Compute the product of function value at lower bound and at midpoint,

The root is between 14 and 15. Set xl = 14 and xu = 15.

Calculate new xr,

Compare εa with εs.

152

16142

ulr

xxx

0 667.0)425.0(569.1)15()14()()( ffxfxf rl

5.142

15142

ulr

xxx

sa ε%667.6% 10015

1415% 100ε

newr

oldr

newr

xxx

sa ε%448.3% 1005.14155.14% 100ε

new

r

oldr

newr

xxx

14

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

15

Exercise

Find the root of the 3rd-order polynomial using bisection

in the interval [3.75,5]. The tolerance εs is 0.5%.

0810)( 23 xxxxf

16

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.

17

)()(

))((

uxflxf

uxlxuxfuxrx

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 such that l(xr) = 0, l(x) is the linear approximation of f(x).Thus, using similar triangle we can write,

Solving for xr ,

l(xr)

Derivation of method: page 125

ur

u

lr

l

xxxf

xxxf

)()(

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

Estimate the root, xr from

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

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

Procedure for false position method

)()())((

ul

uluur xfxf

xxxfxx

Evaluate f(xr), replace xr whichever of xl or xu yields a function value with the same sign as f(xr).

19

ExampleUse 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.

40)1(38.667)( 146843.0 cec

cf

First iteration

9113.14)2688.2(0669.6

)1612(2688.216

2688.2)( 16

0669.6)( 12

rx

uxfux

lxflx

20

Second iteration

%79.0%1007942.14

9113.147942.14

7942.14)2543.0(0669.6

)9113.1412(2543.09113.14

]by replace [ 2543.0)( 9113.14

0669.6)( 12

5428.1)2543.0)(0669.6()()(

a

r

r

rx

xuxuxfux

lxflx

xflxf

21

Third iteration

%0846.0%1007817.14

7942.147817.14

7817.14)0273.0(0669.6

)7942.1412(0273.07942.14

]by replace [ 0273.0)( 7942.14

0669.6)( 12

1656.0)0273.0)(0669.6()()(

a

r

r

rx

xuxuxfux

lxflx

xflxf

22

Exercise

Find the root of the 3rd-order polynomial using FP

in the interval [3.75,5]. The tolerance εs is 0.5%.

0810)( 23 xxxxf

23

Use both the bisection and false-position method to find the root of

in the interval [0, 2] until the approximate percent relative error is less than 5%.

02)( 4 xxf

Lets try

24

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).