numarical metoud lecture 02

Post on 15-Feb-2016

7 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

second part

TRANSCRIPT

ECEG-2112 : Computational MethodsLecture 02:

Solution of Nonlinear Equations

1

ECEG-2112 : Computational MethodsLecture 02:

Solution of Nonlinear Equations

Read Chapters 5 and 6 of the textbook

Lecture 02Solution of Nonlinear Equations

( Root Finding Problems )

Definitions Classification of Methods

Analytical Solutions Graphical Methods Numerical Methods

Bracketing Methods Open Methods

Convergence Notations

Reading Assignment: Sections 5.1 and 5.2

2

Definitions Classification of Methods

Analytical Solutions Graphical Methods Numerical Methods

Bracketing Methods Open Methods

Convergence Notations

Reading Assignment: Sections 5.1 and 5.2

Root Finding ProblemsMany problems in Science and Engineering areexpressed as:

0)(such that value thefind

,functioncontinuousaGiven

rfr

f(x)

3

0)(such that value thefind

,functioncontinuousaGiven

rfr

f(x)

These problems are called root findingproblems.

Roots of Equations

A number r that satisfies an equation is called aroot of the equation.

)1()3)(2(181573i.e.,

.1,3,3,2:rootsfourhas

181573:equationThe

2234

234

xxxxxxx

and

xxxx

4

2.tymultipliciwith(3)rootrepeatedaand

2)and1(rootssimple twohasequationThe

)1()3)(2(181573i.e.,

.1,3,3,2:rootsfourhas

181573:equationThe

2234

234

xxxxxxx

and

xxxx

Zeros of a FunctionLet f(x) be a real-valued function of a realvariable. Any number r for which f(r)=0 iscalled a zero of the function.

Examples:2 and 3 are zeros of the function f(x) = (x-2)(x-3).

5

Let f(x) be a real-valued function of a realvariable. Any number r for which f(r)=0 iscalled a zero of the function.

Examples:2 and 3 are zeros of the function f(x) = (x-2)(x-3).

Graphical Interpretation of Zeros

The real zeros of afunction f(x) are thevalues of x at whichthe graph of thefunction crosses (ortouches) the x-axis.

f(x)

6

The real zeros of afunction f(x) are thevalues of x at whichthe graph of thefunction crosses (ortouches) the x-axis.

Real zeros of f(x)

Simple Zeros

)2(1)( xxxf

7

)1at xoneand2at x(onezerossimple twohas

22)1()( 2

xxxxxf

Multiple Zeros

21)( xxf

8

1at x2)ymuliplicit with(zerozerosdoublehas

121)( 22

xxxxf

Multiple Zeros3)( xxf

9

0at x3ymuliplicit withzeroahas

)( 3

xxf

Facts Any nth order polynomial has exactly n

zeros (counting real and complex zeroswith their multiplicities).

Any polynomial with an odd order has atleast one real zero.

If a function has a zero at x=r withmultiplicity m then the function and itsfirst (m-1) derivatives are zero at x=rand the mth derivative at r is not zero.

10

Any nth order polynomial has exactly nzeros (counting real and complex zeroswith their multiplicities).

Any polynomial with an odd order has atleast one real zero.

If a function has a zero at x=r withmultiplicity m then the function and itsfirst (m-1) derivatives are zero at x=rand the mth derivative at r is not zero.

Roots of Equations & Zeros of Function

)1and,3,3,2are(Which

0)(equationtheofroots theassame theare)(ofzerosThe

181573)(

:as)(Define

0181573

:equation theofsideone to termsallMove

181573

:equationGiven the

234

234

234

xfxf

xxxxxf

xf

xxxx

xxxx

11

)1and,3,3,2are(Which

0)(equationtheofroots theassame theare)(ofzerosThe

181573)(

:as)(Define

0181573

:equation theofsideone to termsallMove

181573

:equationGiven the

234

234

234

xfxf

xxxxxf

xf

xxxx

xxxx

Solution MethodsSeveral ways to solve nonlinear equations arepossible:

Analytical Solutions Possible for special equations only

Graphical Solutions Useful for providing initial guesses for other

methods Numerical Solutions

Open methods Bracketing methods

12

Several ways to solve nonlinear equations arepossible:

Analytical Solutions Possible for special equations only

Graphical Solutions Useful for providing initial guesses for other

methods Numerical Solutions

Open methods Bracketing methods

Analytical MethodsAnalytical Solutions are available for specialequations only.

a

acbbroots

cxbxa

2

4

0:ofsolutionAnalytical2

2

13

Analytical Solutions are available for specialequations only.

a

acbbroots

cxbxa

2

4

0:ofsolutionAnalytical2

2

0:foravailableissolutionanalyticalNo xex

Graphical Methods Graphical methods are useful to provide an

initial guess to be used by other methods.

0.6

]1,0[

root

rootThe

ex

Solvex

xeRoot

14

0.6

]1,0[

root

rootThe

ex

Solvex

xe

x

Root

1 2

2

1

Numerical MethodsMany methods are available to solve nonlinearequations: Bisection Method Newton’s Method Secant Method False position Method Muller’s Method Bairstow’s Method Fixed point iterations ……….

These will be coveredin ECEG-2112

15

Many methods are available to solve nonlinearequations: Bisection Method Newton’s Method Secant Method False position Method Muller’s Method Bairstow’s Method Fixed point iterations ……….

These will be coveredin ECEG-2112

Bracketing Methods In bracketing methods, the method starts

with an interval that contains the root anda procedure is used to obtain a smallerinterval containing the root.

Examples of bracketing methods: Bisection method False position method

16

In bracketing methods, the method startswith an interval that contains the root anda procedure is used to obtain a smallerinterval containing the root.

Examples of bracketing methods: Bisection method False position method

Open Methods In the open methods, the method starts

with one or more initial guess points. Ineach iteration, a new guess of the root isobtained.

Open methods are usually more efficientthan bracketing methods.

They may not converge to a root.

17

In the open methods, the method startswith one or more initial guess points. Ineach iteration, a new guess of the root isobtained.

Open methods are usually more efficientthan bracketing methods.

They may not converge to a root.

Convergence Notation

Nnxx

N

xxxx

n

n

:thatsuchexiststhere0everyto

if to tosaidis,...,...,,sequenceA 21 converge

18

Nnxx

N

xxxx

n

n

:thatsuchexiststhere0everyto

if to tosaidis,...,...,,sequenceA 21 converge

Convergence Notation

Cxx

xxP

Cxx

xx

Cxx

xx

xxx

p

n

n

n

n

n

n

1

21

1

21

:orderofeConvergenc

:eConvergencQuadratic

:eConvergencLinear

. toconverge,....,,Let

19

Cxx

xxP

Cxx

xx

Cxx

xx

xxx

p

n

n

n

n

n

n

1

21

1

21

:orderofeConvergenc

:eConvergencQuadratic

:eConvergencLinear

. toconverge,....,,Let

Speed of Convergence We can compare different methods in

terms of their convergence rate. Quadratic convergence is faster than

linear convergence. A method with convergence order q

converges faster than a method withconvergence order p if q>p.

Methods of convergence order p>1 aresaid to have super linear convergence.

20

We can compare different methods interms of their convergence rate.

Quadratic convergence is faster thanlinear convergence.

A method with convergence order qconverges faster than a method withconvergence order p if q>p.

Methods of convergence order p>1 aresaid to have super linear convergence.

Bisection Method The Bisection Algorithm Convergence Analysis of Bisection Method Examples

Reading Assignment: Sections 5.1 and 5.2

21

The Bisection Algorithm Convergence Analysis of Bisection Method Examples

Reading Assignment: Sections 5.1 and 5.2

Introduction 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 thefunction.

The method systematically reduces the interval.It does this by dividing the interval into two equalparts, performs a simple test and based on theresult of the test, half of the interval is thrownaway.

The procedure is repeated until the desiredinterval size is obtained.

22

The Bisection method is one of the simplestmethods 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 thefunction.

The method systematically reduces the interval.It does this by dividing the interval into two equalparts, performs a simple test and based on theresult of the test, half of the interval is thrownaway.

The procedure is repeated until the desiredinterval size is obtained.

Intermediate Value Theorem Let f(x) be defined on the

interval [a,b].

Intermediate value theorem:if a function is continuousand f(a) and f(b) havedifferent signs then thefunction has at least one zeroin the interval [a,b].

f(a)

23

Let f(x) be defined on theinterval [a,b].

Intermediate value theorem:if a function is continuousand f(a) and f(b) havedifferent signs then thefunction has at least one zeroin the interval [a,b].

a b

f(b)

Examples If f(a) and f(b) have the

same sign, the functionmay have an evennumber of real zeros orno real zeros in theinterval [a, b].

Bisection method cannot be used in thesecases.

a b

24

If f(a) and f(b) have thesame sign, the functionmay have an evennumber of real zeros orno real zeros in theinterval [a, b].

Bisection method cannot be used in thesecases.

a b

The function has four real zeros

The function has no real zeros

Two More Examples

a b

If f(a) and f(b) havedifferent signs, thefunction has at leastone real zero.

Bisection methodcan be used to findone of the zeros.

25

a b

If f(a) and f(b) havedifferent signs, thefunction has at leastone real zero.

Bisection methodcan be used to findone of the zeros.

The function has one real zero

The function has three real zeros

Bisection Method If the function is continuous on [a,b] and

f(a) and f(b) have different signs,Bisection method obtains a new intervalthat is half of the current interval and thesign of the function at the end points ofthe interval are different.

This allows us to repeat the Bisectionprocedure to further reduce the size of theinterval.

26

If the function is continuous on [a,b] andf(a) and f(b) have different signs,Bisection method obtains a new intervalthat is half of the current interval and thesign of the function at the end points ofthe interval are different.

This allows us to repeat the Bisectionprocedure to further reduce the size of theinterval.

Bisection 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 atleast one zero in the interval [a,b] and thebisection method can be used to obtain a smallerinterval that contains the zero.

27

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 atleast one zero in the interval [a,b] and thebisection method can be used to obtain a smallerinterval that contains the zero.

Bisection AlgorithmAssumptions: f(x) is continuous on [a,b] f(a) f(b) < 0

Algorithm:Loop1. Compute the mid point c=(a+b)/22. Evaluate f(c)3. If f(a) f(c) < 0 then new interval [a, c]

If f(a) f(c) > 0 then new interval [c, b]End loop

b

f(a)

c

28

Assumptions: f(x) is continuous on [a,b] f(a) f(b) < 0

Algorithm:Loop1. Compute the mid point c=(a+b)/22. Evaluate f(c)3. If f(a) f(c) < 0 then new interval [a, c]

If f(a) f(c) > 0 then new interval [c, b]End loop

ab

f(b)

c

Bisection Method

b0

29

a0

b0

a1 a2

Example

+ + -

+ - -

30

+ - -

+ + -

Flow Chart of Bisection MethodStart: Given a,b and ε

u = f(a) ; v = f(b)

c = (a+b) /2 ; w = f(c) no

31

is

u w <0

a=c; u= wb=c; v= w

is(b-a) /2<εyes

yesno Stop

no

Example

Answer:

[0,2]?intervalin the13)(

:ofzeroafindtomethodBisectionuseyouCan3 xxxf

32

Answer:

usedbenotcanmethodBisection

satisfiednotaresAssumption

03(1)(3)f(2)*f(0)and

[0,2]oncontinuousis)(

xf

Example

Answer:

[0,1]?intervalin the13)(

:ofzeroafindtomethodBisectionuseyouCan3 xxxf

33

Answer:

usedbecanmethodBisection

satisfiedaresAssumption

01(1)(-1)f(1)*f(0)and

[0,1]oncontinuousis)(

xf

Best Estimate and Error LevelBisection method obtains an interval thatis guaranteed to contain a zero of thefunction.

Questions: What is the best estimate of the zero of f(x)? What is the error level in the obtained estimate?

34

Bisection method obtains an interval thatis guaranteed to contain a zero of thefunction.

Questions: What is the best estimate of the zero of f(x)? What is the error level in the obtained estimate?

Best Estimate and Error LevelThe best estimate of the zero of thefunction f(x) after the first iteration of theBisection method is the mid point of theinitial interval:

35

2

2:

abError

abrzerotheofEstimate

Stopping CriteriaTwo common stopping criteria

1. Stop after a fixed number of iterations2. Stop when the absolute error is less than

a specified value

How are these criteria related?

36

Two common stopping criteria

1. Stop after a fixed number of iterations2. Stop when the absolute error is less than

a specified value

How are these criteria related?

Stopping Criteria

nnnan

n

n

xabEc-rerror

n

c

c

22

:iterationsAfter

function. theofzero theis:r

root). theofestimate theasusedusuallyis(

iterationnat theinterval theofmidpoint theis:

0

th

37

nnnan

n

n

xabEc-rerror

n

c

c

22

:iterationsAfter

function. theofzero theis:r

root). theofestimate theasusedusuallyis(

iterationnat theinterval theofmidpoint theis:

0

th

Convergence Analysis

?)(i.e.,estimatebisection

theisandofzero theiswhere

:such thatneededareiterationsmanyHow

,,),(

kcx

xf(x)r

r-x

andbaxfGiven

38

?)(i.e.,estimatebisection

theisandofzero theiswhere

:such thatneededareiterationsmanyHow

,,),(

kcx

xf(x)r

r-x

andbaxfGiven

)2log(

)log()log(

abn

Convergence Analysis – Alternative Form

)2log(

)log()log(

abn

39

ab

n 22 logerrordesired

intervalinitialofwidthlog

)2log(

)log()log(

abn

Example

11

9658.10)2log(

)0005.0log()1log(

)2log(

)log()log(

?:such thatneededareiterationsmanyHow

0005.0,7,6

n

abn

r-x

ba

40

11

9658.10)2log(

)0005.0log()1log(

)2log(

)log()log(

?:such thatneededareiterationsmanyHow

0005.0,7,6

n

abn

r-x

ba

Example Use Bisection method to find a root of the

equation x = cos (x) with absolute error <0.02(assume the initial interval [0.5, 0.9])

41

Question 1: What is f (x) ?Question 2: Are the assumptions satisfied ?Question 3: How many iterations are needed ?Question 4: How to compute the new estimate ?

42

Bisection MethodInitial Interval

a =0.5 c= 0.7 b= 0.9

f(a)=-0.3776 f(b) =0.2784Error < 0.2

43

Bisection Method

0.5 0.7 0.9

-0.3776 -0.0648 0.2784Error < 0.1

44

0.7 0.8 0.9

-0.0648 0.1033 0.2784Error < 0.05

Bisection Method

0.7 0.75 0.8

-0.0648 0.0183 0.1033 Error < 0.025

45

0.70 0.725 0.75

-0.0648 -0.0235 0.0183 Error < .0125

Summary Initial interval containing the root:

[0.5,0.9]

After 5 iterations: Interval containing the root: [0.725, 0.75] Best estimate of the root is 0.7375 | Error | < 0.0125

46

Initial interval containing the root:[0.5,0.9]

After 5 iterations: Interval containing the root: [0.725, 0.75] Best estimate of the root is 0.7375 | Error | < 0.0125

A Matlab Program of Bisection Methoda=.5; b=.9;u=a-cos(a);v=b-cos(b);

for i=1:5c=(a+b)/2fc=c-cos(c)if u*fc<0

b=c ; v=fc;else

a=c; u=fc;end

end

c =0.7000

fc =-0.0648

c =0.8000

fc =0.1033

c =0.7500

fc =0.0183

c =0.7250

fc =-0.0235

47

a=.5; b=.9;u=a-cos(a);v=b-cos(b);

for i=1:5c=(a+b)/2fc=c-cos(c)if u*fc<0

b=c ; v=fc;else

a=c; u=fc;end

end

c =0.7000

fc =-0.0648

c =0.8000

fc =0.1033

c =0.7500

fc =0.0183

c =0.7250

fc =-0.0235

ExampleFind the root of:

root thefind tousedbecanmethodBisection

0)()(1)1(,10*

continuousis*

[0,1]:intervalin the13)( 3

bfaff)f(

f(x)

xxxf

48

root thefind tousedbecanmethodBisection

0)()(1)1(,10*

continuousis*

[0,1]:intervalin the13)( 3

bfaff)f(

f(x)

xxxf

Example

Iteration a bc= (a+b)

2f(c)

(b-a)2

1 0 1 0.5 -0.375 0.5

2 0 0.5 0.25 0.266 0.25

49

2 0 0.5 0.25 0.266 0.25

3 0.25 0.5 .375 -7.23E-3 0.125

4 0.25 0.375 0.3125 9.30E-2 0.0625

5 0.3125 0.375 0.34375 9.37E-3 0.03125

Bisection MethodAdvantages Simple and easy to implement One function evaluation per iteration The size of the interval containing the zero is reduced

by 50% after each iteration The number of iterations can be determined a priori No knowledge of the derivative is needed The function does not have to be differentiable

50

Advantages Simple and easy to implement One function evaluation per iteration The size of the interval containing the zero is reduced

by 50% after each iteration The number of iterations can be determined a priori No knowledge of the derivative is needed The function does not have to be differentiable

Disadvantage Slow to converge Good intermediate approximations may be discarded

Newton-Raphson Method Assumptions Interpretation Examples Convergence Analysis

51

Assumptions Interpretation Examples Convergence Analysis

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

Given an initial guess of the root x0,Newton-Raphson method uses informationabout the function and its derivative atthat point to find a better guess of theroot.

Assumptions: f(x) is continuous and the first derivative is

known An initial guess x0 such that f’(x0)≠0 is given

52

Given an initial guess of the root x0,Newton-Raphson method uses informationabout the function and its derivative atthat point to find a better guess of theroot.

Assumptions: f(x) is continuous and the first derivative is

known An initial guess x0 such that f’(x0)≠0 is given

Newton Raphson Method- Graphical Depiction - If the initial guess at

the root is xi, then atangent to thefunction of xi that isf’(xi) is extrapolateddown to the x-axisto provide anestimate of the rootat xi+1.

53

If the initial guess atthe root is xi, then atangent to thefunction of xi that isf’(xi) is extrapolateddown to the x-axisto provide anestimate of the rootat xi+1.

Derivation of Newton’s Method

)('

)(:root theofguessnewA

)('

)(

.0)(such thatFind

)(')()(:TheroremTaylor

____________________________________

?estimatebetteraobtain wedoHow:

0)(ofroot theofguessinitialan:

1

1

i

iii

i

i

xf

xfxx

xf

xfh

hxfh

hxfxfhxf

xQuestion

xfxGiven

54

)('

)(:root theofguessnewA

)('

)(

.0)(such thatFind

)(')()(:TheroremTaylor

____________________________________

?estimatebetteraobtain wedoHow:

0)(ofroot theofguessinitialan:

1

1

i

iii

i

i

xf

xfxx

xf

xfh

hxfh

hxfxfhxf

xQuestion

xfxGiven

FormulaRaphsonNewton

Newton’s Method

end

xf

xfxx

n:ifor

xfnAssumputio

xxfxfGiven

i

iii )('

)(

0

______________________

0)('

),('),(

1

0

0

END

STOP

CONTINUE

XPRINT

XFPXFXX

IDO

X

XXXFP

XXXF

PROGRAMFORTRANC

10

*,

)(/)(

5,110

4

*62***3)(

12***33**)(

55

end

xf

xfxx

n:ifor

xfnAssumputio

xxfxfGiven

i

iii )('

)(

0

______________________

0)('

),('),(

1

0

0

END

STOP

CONTINUE

XPRINT

XFPXFXX

IDO

X

XXXFP

XXXF

PROGRAMFORTRANC

10

*,

)(/)(

5,110

4

*62***3)(

12***33**)(

Newton’s Method

end

xf

xfxx

nifor

xfnAssumputio

xxfxfGiven

i

iii )('

)(

:0

______________________

0)('

),('),(

1

0

0

XXFP

XFPFPfunction

XXF

XFFfunction

*62^*3

)(][

12^*33^

)(][

F.m

FP.m

56

end

xf

xfxx

nifor

xfnAssumputio

xxfxfGiven

i

iii )('

)(

:0

______________________

0)('

),('),(

1

0

0

end

XFPXFXX

ifor

X

PROGRAMMATLAB

)(/)(

5:1

4

%

XXFP

XFPFPfunction

XXF

XFFfunction

*62^*3

)(][

12^*33^

)(][

F.m

FP.m

Example

2130.20742.9

0369.24375.2

)('

)(:3Iteration

4375.216

93

)('

)(:2Iteration

333

334

)('

)(:1Iteration

143'

4,32function theofzeroaFind

2

223

1

112

0

001

2

023

xf

xfxx

xf

xfxx

xf

xfxx

xx(x)f

xxxxf(x)

57

2130.20742.9

0369.24375.2

)('

)(:3Iteration

4375.216

93

)('

)(:2Iteration

333

334

)('

)(:1Iteration

143'

4,32function theofzeroaFind

2

223

1

112

0

001

2

023

xf

xfxx

xf

xfxx

xf

xfxx

xx(x)f

xxxxf(x)

Examplek (Iteration) xk f(xk) f’(xk) xk+1 |xk+1 –xk|

0 4 33 33 3 1

1 3 9 16 2.4375 0.5625

58

2 2.4375 2.0369 9.0742 2.2130 0.2245

3 2.2130 0.2564 6.8404 2.1756 0.0384

4 2.1756 0.0065 6.4969 2.1746 0.0010

Convergence Analysis

)('min

)(''max

2

1

such that

0existsthen there0'.0where

rat xcontinuousbe''',Let

:Theorem

0

0

21

0

xf

xf

C

C-rx

-rx-rx

(r)fIff(r)

(x)f(x) andff(x)

-rx

-rx

k

k

59

)('min

)(''max

2

1

such that

0existsthen there0'.0where

rat xcontinuousbe''',Let

:Theorem

0

0

21

0

xf

xf

C

C-rx

-rx-rx

(r)fIff(r)

(x)f(x) andff(x)

-rx

-rx

k

k

Convergence AnalysisRemarks

When the guess is close enough to a simpleroot of the function then Newton’s method isguaranteed to converge quadratically.

Quadratic convergence means that the numberof correct digits is nearly doubled at eachiteration.

60

When the guess is close enough to a simpleroot of the function then Newton’s method isguaranteed to converge quadratically.

Quadratic convergence means that the numberof correct digits is nearly doubled at eachiteration.

Problems with Newton’s Method

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

61

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

Multiple Roots

21)( xxf

3)( xxf

62

1atzeros0at xzeros

twohas threehas

-x

f(x)f(x)

Problems with Newton’s Method- Runaway -

63

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

x0 x1

Problems with Newton’s Method- Flat Spot -

64

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

Problems with Newton’s Method- Cycle -

65

The algorithm cycles between two values x0 and x1

x0=x2=x4

x1=x3=x5

Newton’s Method for Systems ofNon Linear Equations

2

2

1

2

2

1

1

1

212

211

11

0

)(',,...),(

,...),(

)(

)()('

'

0)(ofroot theofguessinitialan:

x

f

x

fx

f

x

f

XFxxf

xxf

XF

XFXFXX

IterationsNewton

xFXGiven

kkkk

66

2

2

1

2

2

1

1

1

212

211

11

0

)(',,...),(

,...),(

)(

)()('

'

0)(ofroot theofguessinitialan:

x

f

x

fx

f

x

f

XFxxf

xxf

XF

XFXFXX

IterationsNewton

xFXGiven

kkkk

Example Solve the following system of equations:

0,1guessInitial

05

0502

2

yx

yxyx

x.xy

67

0,1guessInitial

05

0502

2

yx

yxyx

x.xy

0

1,

1552

112',

5

5002

2

Xxyx

xF

yxyx

x.xyF

Solution Using Newton’s Method

2126.0

2332.1

0.25-

0.0625

25.725.1

11.5

25.0

25.1

25.725.1

11.5',

0.25-

0.0625

:2Iteration

25.0

25.1

1

50

62

11

0

1

62

11

1552

112',

1

50

5

50

:1Iteration

1

2

1

1

2

2

X

FF

.X

xyx

xF

.

yxyx

x.xyF

68

2126.0

2332.1

0.25-

0.0625

25.725.1

11.5

25.0

25.1

25.725.1

11.5',

0.25-

0.0625

:2Iteration

25.0

25.1

1

50

62

11

0

1

62

11

1552

112',

1

50

5

50

:1Iteration

1

2

1

1

2

2

X

FF

.X

xyx

xF

.

yxyx

x.xyF

ExampleTry this

Solve the following system of equations:

0,0guessInitial

02

0122

2

yx

yyx

xxy

69

0,0guessInitial

02

0122

2

yx

yyx

xxy

0

0,

142

112',

2

1022

2

Xyx

xF

yyx

xxyF

ExampleSolution

0.1980

0.5257

0.1980

0.5257

0.1969

0.5287

2.0

6.0

0

1

0

0

_____________________________________________________________

543210

kX

Iteration

70

0.1980

0.5257

0.1980

0.5257

0.1969

0.5287

2.0

6.0

0

1

0

0

_____________________________________________________________

543210

kX

Iteration

Secant Method Secant Method Examples Convergence Analysis

71

Secant Method Examples Convergence Analysis

Newton’s Method (Review)

ly.analyticalobtaintodifficultor

available,notis)('

:Problem

)('

)(

:'

0)('

,),('),(:

1

0

0

i

i

iii

xf

xf

xfxx

estimatenewMethodsNewton

xf

availablearexxfxfsAssumption

72

ly.analyticalobtaintodifficultor

available,notis)('

:Problem

)('

)(

:'

0)('

,),('),(:

1

0

0

i

i

iii

xf

xf

xfxx

estimatenewMethodsNewton

xf

availablearexxfxfsAssumption

Secant Method

)()(

)()(

)()()(

)(

)(

)()()('

:pointsinitial twoareif

)()()('

1

1

1

11

1

1

1

ii

iiii

ii

ii

iii

ii

iii

ii

xfxf

xxxfx

xx

xfxfxf

xx

xx

xfxfxf

xandx

h

xfhxfxf

73

)()(

)()(

)()()(

)(

)(

)()()('

:pointsinitial twoareif

)()()('

1

1

1

11

1

1

1

ii

iiii

ii

ii

iii

ii

iii

ii

xfxf

xxxfx

xx

xfxfxf

xx

xx

xfxfxf

xandx

h

xfhxfxf

Secant Method

)()(

)()(

:Method)(SecantestimateNew

)()(

pointsinitialTwo

:sAssumption

1

11

1

1

ii

iiiii

ii

ii

xfxf

xxxfxx

xfxfthatsuch

xandx

74

)()(

)()(

:Method)(SecantestimateNew

)()(

pointsinitialTwo

:sAssumption

1

11

1

1

ii

iiiii

ii

ii

xfxf

xxxfxx

xfxfthatsuch

xandx

Secant Method

)()(

)()(

1

0

5.02)(

1

11

1

0

2

ii

iiiii xfxf

xxxfxx

x

x

xxxf

75

)()(

)()(

1

0

5.02)(

1

11

1

0

2

ii

iiiii xfxf

xxxfxx

x

x

xxxf

Secant Method - Flowchart

1

;)()(

)()(

1

11

ii

xfxf

xxxfxx

ii

iiiii

1,, 10 ixx

76

1

;)()(

)()(

1

11

ii

xfxf

xxxfxx

ii

iiiii

ii xx 1Stop

NO Yes

Modified Secant Method

.divergemaymethod theproperly,selectednotIf

?selectto How:Problem

)()()(

)()()(

)()()('

:neededisguessinitialoneonlymethod,SecantmodifiedthisIn

1

iii

iii

i

iii

iii

i

iiii

xfxxf

xfxx

x

xfxxfxf

xx

x

xfxxfxf

77

.divergemaymethod theproperly,selectednotIf

?selectto How:Problem

)()()(

)()()(

)()()('

:neededisguessinitialoneonlymethod,SecantmodifiedthisIn

1

iii

iii

i

iii

iii

i

iiii

xfxxf

xfxx

x

xfxxfxf

xx

x

xfxxfxf

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2-40

-30

-20

-10

0

10

20

30

40

50

Example

001.0

1.11

pointsInitial

3)(

:ofroots theFind

10

35

errorwith

xandx

xxxf

78

-2 -1.5 -1 -0.5 0 0.5 1 1.5 2-40

-30

-20

-10

0

10

20

30

40

50

001.0

1.11

pointsInitial

3)(

:ofroots theFind

10

35

errorwith

xandx

xxxf

Examplex(i) f(x(i)) x(i+1) |x(i+1)-x(i)|

-1.0000 1.0000 -1.1000 0.1000

-1.1000 0.0585 -1.1062 0. 0062

79

-1.1062 0.0102 -1.1052 0.0009

-1.1052 0.0001 -1.1052 0.0000

Convergence Analysis

The rate of convergence of the Secant methodis super linear:

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

iteration.iat theroot theofestimate::

62.1,

th

1

i

i

i

xrootr

Crx

rx

80

The rate of convergence of the Secant methodis super linear:

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

iteration.iat theroot theofestimate::

62.1,

th

1

i

i

i

xrootr

Crx

rx

Comparison of RootFinding Methods

81

Advantages/disadvantages Examples

SummaryMethod Pros ConsBisection - Easy, Reliable, Convergent

- One function evaluation periteration- No knowledge of derivative isneeded

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

82

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

- May diverge- Needs derivative and aninitial guess x0 such thatf’(x0) is nonzero

Secant - Fast (slower than Newton)- One function evaluation periteration- No knowledge of derivative isneeded

- May diverge- Needs two initial pointsguess x0, x1 such thatf(x0)- f(x1) is nonzero

Example

)()(

)()(

5.11pointsinitialTwo

1)(

:ofroot thefind tomethodSecantUse

1

11

10

6

ii

iiiii xfxf

xxxfxx

xandx

xxxf

83

)()(

)()(

5.11pointsinitialTwo

1)(

:ofroot thefind tomethodSecantUse

1

11

10

6

ii

iiiii xfxf

xxxfxx

xandx

xxxf

Solution_______________________________

k xk f(xk)_______________________________

0 1.0000 -1.00001 1.5000 8.89062 1.0506 -0.70623 1.0836 -0.46454 1.1472 0.13215 1.1331 -0.01656 1.1347 -0.0005

84

_______________________________k xk f(xk)

_______________________________0 1.0000 -1.00001 1.5000 8.89062 1.0506 -0.70623 1.0836 -0.46454 1.1472 0.13215 1.1331 -0.01656 1.1347 -0.0005

Example

.0001.0)(if

or,001.0if

or,iterationsthreeafterStop

.1:pointinitial theUse

1)(

:ofrootafind toMethodsNewton'Use

1

0

3

k

kk

xf

xx

x

xxxf

85

.0001.0)(if

or,001.0if

or,iterationsthreeafterStop

.1:pointinitial theUse

1)(

:ofrootafind toMethodsNewton'Use

1

0

3

k

kk

xf

xx

x

xxxf

Five Iterations of the Solution k xk f(xk) f’(xk) ERROR ______________________________________ 0 1.0000 -1.0000 2.0000 1 1.5000 0.8750 5.7500 0.1522 2 1.3478 0.1007 4.4499 0.0226 3 1.3252 0.0021 4.2685 0.0005 4 1.3247 0.0000 4.2646 0.0000 5 1.3247 0.0000 4.2646 0.0000

86

k xk f(xk) f’(xk) ERROR ______________________________________ 0 1.0000 -1.0000 2.0000 1 1.5000 0.8750 5.7500 0.1522 2 1.3478 0.1007 4.4499 0.0226 3 1.3252 0.0021 4.2685 0.0005 4 1.3247 0.0000 4.2646 0.0000 5 1.3247 0.0000 4.2646 0.0000

Example

.0001.0)(if

or,001.0if

or,iterationsthreeafterStop

.1:pointinitial theUse

)(

:ofrootafind toMethodsNewton'Use

1

0

k

kk

x

xf

xx

x

xexf

87

.0001.0)(if

or,001.0if

or,iterationsthreeafterStop

.1:pointinitial theUse

)(

:ofrootafind toMethodsNewton'Use

1

0

k

kk

x

xf

xx

x

xexf

Example

0.0000-1.5671-0.00000.5671

0.0002-1.5672-0.00020.5670

0.0291-1.5840-0.04610.5379

0.46211.3679-0.6321-1.0000

)('

)()(')(

1)(',)(

:ofrootafind toMethodsNewton'Use

k

kkkk

xx

xf

xf xf xf x

exfxexf

88

0.0000-1.5671-0.00000.5671

0.0002-1.5672-0.00020.5670

0.0291-1.5840-0.04610.5379

0.46211.3679-0.6321-1.0000

)('

)()(')(

1)(',)(

:ofrootafind toMethodsNewton'Use

k

kkkk

xx

xf

xf xf xf x

exfxexf

ExampleEstimates of the root of: x-cos(x)=0.

0.60000000000000 Initial guess0.74401731944598 1 correct digit0.73909047688624 4 correct digits0.73908513322147 10 correct digits0.73908513321516 14 correct digits

89

Estimates of the root of: x-cos(x)=0.

0.60000000000000 Initial guess0.74401731944598 1 correct digit0.73909047688624 4 correct digits0.73908513322147 10 correct digits0.73908513321516 14 correct digits

ExampleIn estimating the root of: x-cos(x)=0, toget more than 13 correct digits:

4 iterations of Newton (x0=0.8) 43 iterations of Bisection method (initial

interval [0.6, 0.8]) 5 iterations of Secant method

( x0=0.6, x1=0.8)

90

In estimating the root of: x-cos(x)=0, toget more than 13 correct digits:

4 iterations of Newton (x0=0.8) 43 iterations of Bisection method (initial

interval [0.6, 0.8]) 5 iterations of Secant method

( x0=0.6, x1=0.8)

top related