22
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 7 Roots of Equations Bracketing Methods

ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 7 Roots of Equations Bracketing Methods

  • View
    229

  • Download
    1

Embed Size (px)

Citation preview

ECIV 301

Programming & Graphics

Numerical Methods for Engineers

Lecture 7

Roots of Equations

Bracketing Methods

Last Time The Problem

)(1)( tvec

gmcf

tm

c

Define Function

0)( cfc must satisfy

c is the ROOT of the equation

Last Time ClassificationMethods

Bracketing Open

• Graphical• Bisection Method• False Position

• Fixed Point Iteration• Newton-Raphson• Secand

Last Time Graphical Methods)(1)( tve

c

gmcf

tm

c

f(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

c

f(c)

v=10 m/st=3 secm=65 kgg=9.81

Last Time Graphical Methods

No Roots Even Number of Roots

Lower and Upper Bounds of interval yield values of same sign

Last Time Graphical MethodsLower and Upper Bounds of interval yield values of opposite sign

Odd number of Roots

Last Time Bisection Method

Choose Lower, xl and Upper xu guesses that bracket the root

f(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

xl xu

Last Time Bisection Method

Calculate New Estimate xr and f(xr)

f(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

xl xu

xr=0.5(xl+xu)

Last Time Bisection MethodDefine New Interval that Brackets the RootCheck sign of

f(xl)*f(xr) and f(xu)*f(xr)

f(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

xl xu

Previous Guess

xu

Last Time Bisection MethodRepeat until convergence

f(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

xl xu

Previous Guess

xr=0.5(xl+xu)

Last Time Bisection MethodCheck Convergence

ErrorAcceptablex

xxnewr

oldr

newr

%100

Root = newrx

If Error

Objectives

• Master methods to compute roots of equations

• Assess reliability of each method

• Choose best method for a specific problem

• REGULA FALSI Method (False Position)

False Position Method

f(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

xl xu

xr=0.5(xl+xu)

Recall Bisection Method

No consideration on function values

False Position Methodf(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

f(xl)

f(xu)xl

xuxr

NEW ESTIMATE

False Position Methodf(c)

-10

-5

0

5

10

15

20

25

0 50 100 150 200

f(c)

f(xl)

f(xu)xl

xuxr

False Position Methodf(xl)

f(xu)xl

xuxr

From Similar Triangles

ur

lr

u

l

xx

xx

xf

xf

lruurl xxxfxxxf

False Position Method

lruurl xxxfxxxf

ulr xfxfx ullu xfxxfx

ul

ullur xfxf

xfxxfxx

False Position Method

ul

ullur xfxf

xfxxfxx

ul

ul

ul

lur xfxf

xfx

xfxf

xfxx

False Position Method

ul

ulu

ul

luur xfxf

xfxx

xfxf

xfxxx

Add and subtract

ul

uluur xfxf

xxxfxx

New Estimate

Loop

xold=xr

Error=100*abs(x-xold)/xr

Sign=f(xl)*f(xr)

Sign

xu=xr

fu=f(xu)xl=xr

fl=f(xl)Error=0

Error<Eall ROOT=xr

FALSE

<0 >0

ululuur ffxxfxx

fu=f(xu), fl=f(xl)

False Position

Typically

Faster Convergence than Bisection

False Position

Not Efficient in this Case