102
Presented By Lalita 1

Lalita - Home Pages of [email protected]/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Presented  By              

Lalita                                                                                                                                                                                                                                                                                                    

1

Page 2: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Nonlinear Equation Solvers

Bracketing Graphical Open Methods

Bisection False Position (Regula-Falsi)

Newton Raphson

Secant

Page 3: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Bracke'ng  Methods    In  bracketing  methods,  the  method  starts  with  an  interval  that  contains  the  root  and  a  procedure  is  used  to  obtain  a  smaller  interval  containing  the  root.  

 Examples  of  bracketing  methods:    Bisection  method    False  position  method  

3

Page 4: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Open  Methods    In  the  open  methods,  the  method  starts  with  one  or  more  initial  guess  points.  In  each  iteration,  a  new  guess  of  the  root  is  obtained.  

 Open  methods  are  usually  more  efficient  than  bracketing  methods.  

 They  may  not  converge  to  a  root.  

4

Examples of Open methods:

Newton Raphson method Secant method

Page 5: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Bisection method

Page 6: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Introduc)on    The  Bisection  method  is  one  of  the  simplest  methods  to  find  a  zero  of  a  nonlinear  function.    

  It  is  also  called  interval  halving  method.    To  use  the  Bisection  method,  one  needs  an  initial  interval  that  is  known  to  contain  a  zero  of  the  function.    

  The  method  systematically  reduces  the  interval.  It  does  this  by  dividing  the  interval  into  two  equal  parts,  performs  a  simple  test  and  based  on  the  result  of  the  test,  half  of  the  interval  is  thrown  away.  

  The  procedure  is  repeated  until  the  desired  interval  size  is  obtained.  

6

Page 7: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Intermediate  Value  Theorem    Let  f(x)  be  defined  on  the  interval  [a,b].  

     Intermediate  value  theorem:        if  a  function  is  continuous  and  f(a)  and  f(b)  have  different  signs  then  the  function  has  at  least  one  zero  in  the  interval  [a,b].  

7

a b

f(a)

f(b)

Page 8: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Examples    If  f(a)  and  f(b)  have  the  same  sign,  the  function  may  have  an  even  number  of  real  zeros  or  no  real  zeros  in  the  interval    [a,  b].  

  Bisection  method  can  not  be  used  in  these  cases.  

8

a b

a b

The function has four real zeros

The function has no real zeros

Page 9: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Two  More  Examples  

9

a b

a b

  If f(a) and f(b) have different signs, the function has at least one real zero.

 Bisection method can be used to find one of the zeros.

The function has one real zero

The function has three real zeros

Page 10: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Bisec)on  Method    If  the  function  is  continuous  on  [a,b]  and  f(a)  and  f(b)  have  different  signs,  Bisection  method  obtains  a  new  interval  that  is  half  of  the  current  interval  and  the  sign  of  the  function  at  the  end  points  of  the  interval  are  different.    

  This  allows  us  to  repeat  the  Bisection  procedure  to  further  reduce  the  size  of  the  interval.      

10

Page 11: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Bisec)on  Method  Assumptions:        Given  an  interval  [a,b]        f(x)    is  continuous  on  [a,b]        f(a)    and    f(b)    have  opposite  signs.                      These  assumptions  ensure  the  existence  of  at  least  one  zero  in  the  interval  [a,b]  and  the  bisection  method  can  be  used  to  obtain  a  smaller  interval  that  contains  the  zero.  

11

Page 12: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Algorithm  of  Bisec)on  Method  

Page 13: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

13

Step  1    Choose  x  and  xu  as  two  guesses  for  the  root  such  that    f  (xl)  f  (xu)  <  0,  or  in  other  words,    f  (x)    changes  sign  between  x  and  xu.    

x

f(x)

xu x

Page 14: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

x

f(x)

xu x

xm

14

Step  2    Estimate  the  root,  xm  of  the  equation  f  (x)  =  0  as  the  mid  point  between  x  and  xu  as  

xx

m = xu +

2

Estimate  of  xm  

Page 15: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

15

Step  3  Now  check  the  following    a)  If                                                                                      ,then  the  root  lies  between  x  and  xm;  

then  x  =  x  ;  xu  =  xm.  

b)  If                                                                            ,  then  the  root  lies  between  xm  and  xu;  then  x  =  xm;    xu  =  xu.  

c)  If                                                                          ;  then  the  root  is  xm.    Stop  the  algorithm  if  this  is  true.  

( ) ( ) 0<ml xfxf

( ) ( ) 0>ml xfxf

( ) ( ) 0=ml xfxf

Page 16: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

16

Step  4  

xx

m = xu +

2

100×−

=∈ newm

oldm

new

a xxx

m

root of estimatecurrent =newmx

root of estimate previous=oldmx

Find the new estimate of the root

Find the absolute relative approximate error

where

Page 17: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

17

Step  5  

Is ?

Yes

No

Go to Step 2 using new upper and lower

guesses.

Stop the algorithm

Compare the absolute relative approximate error with the pre-specified error tolerance .

a∈s∈

sa >∈∈

Note one should also check whether the number of iterations is more than the maximum number of iterations allowed. If so, one needs to terminate the algorithm and notify the user about it.

Page 18: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

If f(xm)f(xl) < 0then xu = xmelse xl = xm

end

Solutionobtaindxr = xm

If f(xm) ? = 0

xm =0.5(xl+xu)

Input xl & xuf(xl)*f(xu) < 0

Start

no yes

Bisection Flowchart

Page 19: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

19

Page 20: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

20

Page 21: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

21

Page 22: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

CISE301_Topic2 22

Page 23: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

23

Page 24: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

24

Page 25: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

25

Page 26: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Stopping  Criteria          Two  common  stopping  criteria      1.  Stop  after  a  fixed  number  of  iterations  2.  Stop  when  the  absolute  error  is  less  than  a  specified  

value        How  are  these  criteria  related?  

26

Page 27: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Stopping  Criteria    

 

nnnan

n

n

xabEc-rerror

n

cc

22

:iterations After

function. theof zero theis :r

root). theof estimate theas usedusually is (

iteration n at the interval theofmidpoint theis:

0

th

Δ=

−=≤=

27

Page 28: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

28

Convergence  Analysis    

?) (i.e., estimate bisection theis and of zero theiswhere

:such that needed are iterationsmany How,,),(

kcxxf(x)r

r-xandbaxfGiven

=

≤ ε

ε

)2log()log()log( ε−−

≥abn

Page 29: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

 

29

Page 30: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

  The  bisection  algorithm  is  guaranteed  to  converge  

30

Bisec)on  Method  

Simple and easy to implement

One function evaluation per iterations No knowledge of the derivative is needed The function does not have to be differentiable

Advantages

Disadvantage    Slow  to  converge      Good  intermediate  approximations  may  be  discarded    

Page 31: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

False  Posi1on  method  

31

Page 32: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

False  Posi)on   This  technique  is  similar  to  the  bisection  method  except  that  the  next  iterate  is  taken  as  the  line  of  interception  between  the  pair  of  x-­‐values  and  the  x-­‐axis  rather  than  at  the  midpoint.    

       This  is  slow  convergence  method  and  may  be  thought  of  as  an  attempt  to  improve  the  convergence  characteristic  of  bisection  method.  Its  also  known  as  the  method  of  linear  interpolation.  

Page 33: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

False-­‐Posi'on  (point)  Method  Why  bother  with  another  method?    The  bisection  method  is  simple  and  guaranteed  to  converge  (single  root)  

  But  the  convergence  is  slow  and  non-­‐monotonic!    Bisection  only  the  sign,  not  the  value  f(xk  )  itself    False-­‐position  method  takes  advantage  of  function  curve  shape  

  False  position  method  may  converge  more  quickly  

Page 34: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

(1)  

(2)  

1

34

( )Uxf

Uxrx

( )Lxf

LxO

( )xf

x

Exact root

0)( =xf

0)(*)( <UL xfxf

In  the  Bisection  method  

2UL

rxxx +

= (3)  

Figure  1  False-­‐Position  Method  

Derivation of False Position Method

Page 35: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

35

False-­‐Posi1on  Method  Based  on  two  similar  triangles,  shown  in  Figure  1,    one  gets:  

Ur

U

Lr

L

xxxf

xxxf

−=

)()(

0;0)(0;0)(<−>

>−<

UrU

LrL

xxxfxxxf

The  signs  for  both  sides  of  Eq.  (4)  is  consistent,  since:  

(4)  

Page 36: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

36

( ) ( ) ( ) ( )LUrULr xfxxxfxx −=−

( ) ( ) ( ) ( ){ }ULrULLU xfxfxxfxxfx −=−

From  Eq.  (4),  one  obtains  

The  above  equation  can  be  solved  to  obtain  the  next      predicted  root  

( ) ( )( ) ( )UL

ULLUr xfxf

xfxxfxx−

−=

rx      ,  as    (5)  

Page 37: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

37

The  above  equation,  

( ){ }( ) ( )UL

ULUUr xfxf

xxxfxx−

−−=

( )( ) ( )

⎭⎬⎫

⎩⎨⎧

−−=

LU

LU

LLr

xxxfxf

xfxx

or  

(6)  

(7)  

Page 38: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Algorithm  of  False  posi1on  method  

38

Page 39: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

39

as  two  guesses  for  the  root      

 Choose   Lx Uxand  

( ) ( ) 0<UL xfxf

   

such that

Step 1

Page 40: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

40

Step2

 Estimate  the  root,    

( ) ( )( ) ( )UL

ULLU

xfxfxfxxfxxr

−=

Page 41: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

41

Step  3  

 Now  check  the  following  

,  then  the  root  lies  between    (a)  If  

and   ;  then  

( ) ( ) 0<mL xfxf

Lx mx LL xx = and   mU xx =

,  then  the  root  lies  between    (b)  If  

and   ;  then  

( ) ( ) 0>mL xfxf

mx Ux mL xx = and   UU xx =

Page 42: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

42

 Find  the  new  estimate  of  the  root  ( ) ( )( ) ( )UL

ULLUm xfxf

xfxxfxx−

−=

Find  the  absolute  relative  approximate  error  as  

100×−

=∈ newm

oldm

newm

a xxx

Step 4

where  =  estimated  root  from  present  iteration  new

mx=  estimated  root  from  previous  iteration  old

mx

Page 43: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

                                                                                     http://numericalmethods.eng.usf.edu  43  

.001.010 3 ==∈ −ssay

.

If   sa >∈∈ ,  then  go  to  step  3,  

else  stop  the  algorithm.  

Step 5

Page 44: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

If f(xm)f(xl) < 0then xu = xrelse xl = xr

end

Solutionobtaind

xr

If f(xr) ? = 0or

abs(xr - pxr) < tolerance

xr =xu - f(xu)(xl -xu)/(f(xl) - f(xu))

Input xl & xuf(xl)*f(xu) < 0

Start

no yes

False-point Method Flowchart

Page 45: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

45

Page 46: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

46

Page 47: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

47

Page 48: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

48

11  

(1)

1

Page 49: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

CISE301_Topic2 49

Page 50: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

50

(2)

222(

(2)

Page 51: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

CISE301_Topic2 51

Page 52: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Advantages    and  Disadvantages    of    False  Posi)on    method  

52

Page 53: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

 

 Advantages   Always  converges   Faster  convergence  than  bisection   Often  superior  to  bisection  

 Disadvantages  •   Can  be  VERY  slow  •   Like  Bisec)on,  need  an  ini)al  interval  around  the  root.  

 

Page 54: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

   False-­‐Position  Method  

  f(x)=x10-­‐1    The  root  is  hard  to  find  because  the  curvature  is  steep  

Page 55: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

55

Page 56: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Newton-­‐Raphson  Method    (Also  known  as  Newton’s  Method)  

 Given  an  initial  guess  of  the  root  x0,  Newton-­‐Raphson  method  uses  information  about  the  function  and  its  derivative  at  that  point  to  find  a  better  guess  of  the  root.  

 

Assumptions:    f(x)  is  continuous  and  the  first  derivative  is  known    An  initial  guess  x0  such  that  f’(x0)≠0  is  given  

56

Page 57: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Newton  Raphson  Method  -­‐  Graphical  Depic)on  -­‐    If  the  initial  guess  at  the  root  is  xi,  then  a  tangent  to  the  function  of  xi  that  is  f’(xi)  is  extrapolated  down  to  the  x-­‐axis  to  provide  an  estimate  of  the  root  at  xi+1.  

57

Page 58: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

58

Page 59: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

59

Page 60: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Algorithm  for  Newton-­‐Raphson  Method  

60

Page 61: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

61

)(xf ʹ′Evaluate

Use an initial guess of the root, , to estimate the new value of the root, , as

ix1+ix

( )( )i

iii xf

xf - = xxʹ′+1

Step  2  

Step  1  

Page 62: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Step  3  

0101

1 x

- xx = i

iia ×∈

+

+

Find the absolute relative approximate error as a∈

62

Page 63: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Step  4    Compare  the  absolute  relative  approximate  error    with  the  pre-­‐specified  relative  error  tolerance          .      

 

   Also,  check  if  the  number  of  iterations  has  exceeded  the  maximum  

number  of  iterations  allowed.  If  so,  one  needs  to  terminate  the  algorithm  and  notify  the  user.  

Is ?

Yes

No

Go to Step 2 using new estimate of the root.

Stop the algorithm

sa >∈∈

63

Page 64: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

64

Page 65: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

65

Page 66: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

66

Page 67: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

67

Page 68: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

68

Page 69: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

CISE301_Topic2 69

Page 70: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Newton’s  Method  

70

endxfxfxx

nifor

xfnAssumputioxxfxfGiven

i

iii )('

)(:0

______________________0)('

),('),(

1

0

0

−=

=

+

Page 71: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Convergence  Analysis    

71

When the guess is close enough to a simple root of the function then Newton’s method is guaranteed to converge quadratically.

Quadratic convergence means that the number of correct digits is nearly doubled at each iteration.

Page 72: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

72

Page 73: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

CISE301_Topic2 73

Page 74: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

74

Page 75: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

75

Page 76: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

76

Page 77: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Advantages  and  Drawbacks  of  Newton  Raphson  Method        

77

Page 78: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Advantages  

 Converges  fast  (quadratic  convergence),  if  it  converges.      

 Requires  only  one  guess  

78

Page 79: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Problems  with  Newton’s  Method  

79

•  If the initial guess of the root is far from

the root the method may not converge.

•  Newton’s method converges linearly near

multiple zeros { f(r) = f’(r) =0 }. In such a

case, modified algorithms can be used to

regain the quadratic convergence.

Page 80: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Problems  with  Newton’s  Method  -­‐  Runaway  -­‐  

80

The estimates of the root is going away from the root.

x0 x1

Page 81: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Problems  with  Newton’s  Method  -­‐  Flat  Spot  -­‐  

81

The value of f’(x) is zero, the algorithm fails.

If f ’(x) is very small then x1 will be very far from x0.

x0

Page 82: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Problems  with  Newton’s  Method  -­‐  Cycle  -­‐  

82

The algorithm cycles between two values x0 and x1

x0=x2=x4

x1=x3=x5

Page 83: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

83

Page 84: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Newton’s  Method  (Review)  

ly.analyticalobtain todifficult or available,not is )('

:Problem)('

)(: '

0)(',),('),(:

1

0

0

i

i

iii

xf

xfxfxx

estimatenewMethodsNewtonxf

availablearexxfxfsAssumption

−=

+

84

Page 85: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

85

Secant  Method  –  Deriva)on  

)()())((

1

11

−+ −

−−=

ii

iiiii xfxf

xxxfxx

The Geometric Similar Triangles

f(x)

f(xi)

f(xi-1)

xi+1 xi-1 xi X

B

C

E D A

11

1

1

)()(

+−

+ −=

− ii

i

ii

i

xxxf

xxxf

DEDC

AEAB

=

Geometrical representation of the Secant method.

The secant method can also be derived from geometry:

can be written as

On rearranging, the secant method is given as

Page 86: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Secant  Method  

)()()()(

)()()(

)(

)()()()('

:points initial twoare if

)()()('

1

1

1

11

1

1

1

−+

−−=

−−

−=

−=

−+≈

ii

iiii

ii

ii

iii

ii

iii

ii

xfxfxxxfx

xxxfxf

xfxx

xxxfxfxf

xandxh

xfhxfxf

86

Page 87: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Secant  Method  

)()()()(

:Method)(Secant estimateNew)()(

points initial Two:sAssumption

1

11

1

1

−+

−−=

ii

iiiii

ii

ii

xfxfxxxfxx

xfxfthatsuchxandx

87

Page 88: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Secant  Method  -­‐  Flowchart  

1

;)()(

)()(1

11

+=

−−=

−+

iixfxf

xxxfxxii

iiiii

1,, 10 =ixx

ε<−+ ii xx 1

88

Stop NO Yes

Page 89: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

89

Algorithm  for  Secant  Method  

Page 90: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

90

Step  1  

0101

1 x

- xx = i

iia ×∈

+

+

Calculate the next estimate of the root from two initial guesses

Find the absolute relative approximate error

)()())((

1

11

−+ −

−−=

ii

iiiii xfxf

xxxfxx

Page 91: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

91

Step  2  

 Find  if  the  absolute  relative  approximate  error    is  greater  than  the  prespecified  relative  error  tolerance.      

   If  so,  go  back  to  step  1,  else  stop  the  algorithm.  

   Also  check  if  the  number  of  iterations  has  exceeded  the  maximum  number  of  iterations.  

Page 92: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Convergence  Analysis    The  rate  of  convergence  of  the  Secant  method  is  super  linear:  

  It  is  better  than  Bisection  method  but  not  as  good  as  Newton’s  method.  

iteration. i at theroot theof estimate::

62.1,

th

1

i

i

i

xrootr

Crxrx

≈≤−

−+ αα

92

Page 93: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Advantages  of  secant  method:    It  converges  at  faster  than  a  linear  rate,  so  that  it    is  more  rapidly  convergent  than  the  bisection  method.     It  does  not  require  use  of  the  derivative  of  the  function,  something  that  is  not  available  in  a  number  of  applications.     It  requires  only  one  function  evaluation  per  iteration,  as  compared  with  Newton’s  method  which  requires  two.  

93

Page 94: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

94

1.  It  may  not  converge. 2.  There  is  no  guaranteed  error  bound  for  the  computed iterates. 3.  It  is  likely  to  have  difficulty  if  f  0(α)  =  0.  This means  the  x-­‐axis  is  tangent  to  the  graph  of  y  =  f  (x) at  x  =  α. 4.  Newton’s  method  generalizes  more  easily  to  new methods  for  solving  simultaneous  systems  of  nonlinear equa)ons.

Disadvantages  of  secant  method

Page 95: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

     Advantages/disadvantages    

95

Page 96: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

96

Page 97: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

97

Page 98: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Comparison  of  the  Secant  and  False-­‐posi)on  method  

 Both  methods  use  the  same  expression  to  compute  xr.  

 They  have  different  methods  for  the  replacement  of  the  initial  values  by  the  new  estimate.    

98

)()())((:position False

)()())((:Secant

1

11

ul

uluur

ii

iiiii

xfxfxxxfxx

xfxfxxxfxx

−−

−=

−−

−=−

−+

Page 99: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Comparison  of  the  different  Root    finding  method  

99

xef(x) x −= −

Page 100: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Difficul1es  when  we  have  mul1ple  roots   Bracketing  methods  do  not  work  for  even  multiple  roots.  

  f(α) = f'(α) = 0,  so  both  f(xi)  and  f'(xi)  approach  zero  near  the  root.  This  could  result  in  division  by  zero.  A  zero  check  for  f(x)  should  be  incorporated  so  that  the  computation  stops  before  f'(x)  reaches  zero.  

  For  multiple  roots,  Newton-­‐Raphson  and  Secant  methods  converge  linearly,  rather  than  quadratic  convergence.  

100

Page 101: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

Summary  Method Advantages Disadvantages Bisection - Easy, Reliable, Convergent

- One function evaluation per iteration - No knowledge of derivative is needed

- Slow - Needs an interval [a,b] containing the root, i.e., f(a)f(b)<0

Newton - Fast (if near the root) - Two function evaluations per iteration

- May diverge - Needs derivative and an initial guess x0 such that f’(x0) is nonzero

Secant - Fast (slower than Newton) - One function evaluation per iteration - No knowledge of derivative is needed

- May diverge - Needs two initial points guess x0, x1 such that f(x0)- f(x1) is nonzero

101

Page 102: Lalita - Home Pages of People@DUpeople.du.ac.in/~pmehta/FinalSem/Lalitafinaltalk.pdf · Introduc)on* The Bisection)methodisoneofthesimplestmethodsto(findazeroofanonlinearfunction.((

THANKYOU