+ All Categories
Home > Documents > SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear...

SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear...

Date post: 29-Aug-2021
Category:
Upload: others
View: 11 times
Download: 0 times
Share this document with a friend
90
SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term 063) Read Chapters 5 and 6 of the textbook
Transcript
Page 1: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301: Numerical MethodsTopic 2:

Solution of Nonlinear EquationsLectures 5-11:

SE301_Topic 2 (c)AL-AMER2006 ١

Dr. Samir Al-Amer (Term 063)

Read Chapters 5 and 6 of the textbook

Page 2: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

Lecture 5Solution of Nonlinear Equations

( Root finding Problems )

SE301_Topic 2 (c)AL-AMER2006 ٢

Definitions Classification of methods

Analytical solutionsGraphical methodsNumerical methods

Bracketing methodsOpen methods

Convergence Notations

Reading Assignment: Sections 5.1 and 5.2

Page 3: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣

Root finding ProblemsMany problems in Science and Engineering are expressed as

0)(such that value thefind , function continuous aGiven

=rfrf(x)

These problems are called root finding problems

Page 4: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤

Roots of Equations

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

13,3,2181573 equationThe 234

−−−=+−−

androotsfourhasxxxx

2tymultipliciwith (3)root repeated a and 2) and 1( roots simple twohas equationThe

=−−

Page 5: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥

Zeros of a functionLet f(x) be a real-valued function of a real variable.

Any number r for which f(r)=0 is called a zero of the function.

Examples:

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

Page 6: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦

Graphical Interpretation of zerosThe real zeros of a function f(x) are the values of x at which the graph of the function crosses (or touches ) the x-axis.

Real zeros of f(x)

f(x)

Page 7: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧

Multiple zeros

( )21)( −= xxf

( )1at x 2)y muliplicit with (zero zeros double has

121)( 22

==+−=−= xxxxf

Page 8: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨

Multiple Zeros3)( xxf =

0at x 3y muliplicit with zero a has)( 3

=== xxf

Page 9: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٩

Simple Zeros

( ) )2(1)( −+= xxxf

( ))1at x one and 2at x (one zeros simple twohas

22)1()( 2

−==−−=−+= xxxxxf

Page 10: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٠

FactsAny nth order polynomial has exactly n zeros (counting real and complex zeros with their multiplicities).Any polynomial with an odd order has at least one real zero.If a function has a zero at x=r with multiplicity m then the function and its first (m-1) derivatives are zero at x=r and the mth derivative at r is not zero.

Page 11: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١١

Roots of Equations & Zeros of function

)1and3,3,2are(Which equationtheofroots theas same theare )( of zeros The

181573)()(

0181573equation theof side one to termsall Move

181573equationGiven the

234

234

234

−−

++−−=

=++−−

−=+−−

xfxxxxxf

asxfDefinexxxx

xxxx

Page 12: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٢

Solution MethodsSeveral ways to solve nonlinear equations are

possible.

Analytical Solutionspossible for special equations only

Graphical SolutionsUseful for providing initial guesses for other methods

Numerical SolutionsOpen methodsBracketing methods

Page 13: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٣

Solution Methods:Analytical SolutionsAnalytical Solutions are available for special

equations only.

aacbbroots

cxbxa

24

0ofsolutionAnalytical2

2

−±−=

=++

0for available issolution analytical No =− −xex

Page 14: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٤

Graphical MethodsGraphical methods are useful to provide an initial guess to be used by other methods

xe−

xRoot

1 2

2

1

0.6]1,0[

≈∈

= −

rootrootThe

exSolve

x

Page 15: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٥

Bracketing MethodsIn 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 methodFalse position method

Page 16: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٦

Open MethodsIn 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 the a root.

Page 17: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٧

Solution MethodsMany methods are available to solve nonlinear

equationsBisection MethodNewton’s MethodSecant MethodFalse position MethodMuller’s MethodBairstow’s MethodFixed point iterations……….

These will be covered in SE301

Page 18: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٨

Convergence Notation

Nnxx

Nifxxxx

n

n

>∀<−

>

ε

ε

thatsuchexistthere0everyto to tosaid is,...,...,, sequenceA 21 converge

Page 19: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ١٩

Convergence Notation

Cxx

xx

Cxx

xx

Cxxxx

xxx

pn

n

n

n

n

n

≤−

≤−

≤−−

+

+

+

1

21

1

21

porder of eConvergenc

eConvergenc Quadratic

eConvergencLinear

toconverges,....,,Let

Page 20: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٠

Speed of convergenceWe 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 with convergence order p if q>p.A Method of convergence order p>1 are said to have super linear convergence.

Page 21: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

Lectures 6-7Bisection Method

SE301_Topic 2 (c)AL-AMER2006 ٢١

The Bisection Algorithm Convergence Analysis of Bisection MethodExamples

Reading Assignment: Sections 5.1 and 5.2

Page 22: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٢

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

Page 23: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٣

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

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

a b

f(a)

f(b)

Page 24: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٤

ExamplesIf f(a) and f(b) have the same sign, the function may have an even number of real zeros or no real zero in the interval [ a,b]Bisection method can not be used in these cases

a b

The function has four real zeros

a b

The function has no real zeros

Page 25: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٥

Two more ExamplesIf f(a) and f(b) have different signs, the function has at least one real zeroBisection method can be used to find one of the zeros.

a b

The function has one real zero

a b

The function has three real zeros

Page 26: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٦

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.

Page 27: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٧

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

abc

f(a)

f(b)

Page 28: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٨

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

Page 29: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٢٩

Bisection Method

a0

b0

a1 a2

Page 30: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٠

Example

+ + -

+ - -

+ + -

Page 31: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣١

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

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

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

is

u w <0

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

is (b-a) /2<εyes

yesno Stop

no

Page 32: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٢

Example

Answer:

[0,2]? interval in the13)(ofzero afind tomethodBisectionuseyouCan

3 +−= xxxf

used benot can methodBisection satisfiednot are sAssumption

03(1)(3)f(2)*f(0)[0,2]on continuous is)(>==

xf

Page 33: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٣

Example:

Answer:

[0,1]? interval in the13)(ofzero afind tomethodBisectionuseyouCan

3 +−= xxxf

used becan methodBisection satisfied are sAssumption

01(1)(-1)f(1)*f(0)[0,1]on continuous is)(<−==

xf

Page 34: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٤

Best Estimate and error level

Bisection method obtains an interval that is guaranteed to contain a zero of the function

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

Page 35: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٥

Best Estimate and error level

The best estimate of the zero of the function is the mid point of the last interval generated by the Bisection method.

2

2abError

abrzerotheofEstimate

−≤

+=

Page 36: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٦

Stopping Criteria

Two common stopping criteria

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

a specified value

How these criteria are related?

Page 37: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٧

Stopping Criteria

12

iterationsn After

function theof zero theis r

root). theof estimate theas usedusually is (

iterationn th at the interval theofmidpoint the

+

−≤= nn

n

n

abc-rerror

c

isc

Page 38: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٨

Convergence Analysis

) (i.e. estimatebisection theis x and f(x) of zero theisrwhere

such that needed are iterationsmany How,),(

kcx

r-xandbaxfGiven

=

≤ εε

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

≥abn

Page 39: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٣٩

Convergence AnalysisAlternative form

) (i.e. estimatebisection theis x and f(x) of zero theisrwhere

such that needed are iterationsmany How,),(

kcx

r-xandbaxfGiven

=

≤ εε

⎟⎠⎞

⎜⎝⎛ −

=⎟⎠⎞

⎜⎝⎛≥

ε2log

interval desired ofwidth interval initial ofwidth log 22

abn

Page 40: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٠

Example

10

9658.9)2log(

)001.0log()1log()2log(

)2log()log(

such that needed are iterationsmany How0005.0,7,6

≥⇒

=−

=−−

===

n

abn

r-xba

ε

εε

Page 41: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤١

ExampleUse 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])

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 ?

Page 42: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٢

Page 43: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٣

Bisection MethodInitial Interval

f(a)=-0.3776 f(b) =0.2784

a =0.5 c= 0.7 b= 0.9

Page 44: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٤

-0.3776 -0.0648 0.2784Error < 0.1

0.5 0.7 0.9

0.7 0.8 0.9

-0.0648 0.1033 0.2784Error < 0.05

Page 45: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٥

-0.0648 0.0183 0.1033 Error < 0.0250.7 0.75 0.8

0.70 0.725 0.75

-0.0648 -0.0235 0.0183 Error < .0125

Page 46: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٦

SummaryInitial interval containing the root [0.5,0.9]After 4 iterations

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

Page 47: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٧

Programming 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

Page 48: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٨

ExampleFind the root of

root thefind toused becan methodBisection *0)()(1)1(,10 *

continuous is *

[0,1] interval in the13)( 3

<⇒−==

+−=

bfaff)f(f(x)

xxxf

Page 49: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٤٩

ExampleIteration a b c= (a+b)

2f(c) (b-a)

2

0 0 1 0.5 -0.375 0.5

1 0 0.5 0.25 0.266 0.25

2 0.25 0.5 .375 -7.23E-3 0.125

3 0.25 0.375 0.3125 9.30E-2 0.0625

4 0.3125 0.375 0.34375 9.37E-3 0.03125

Page 50: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٠

Bisection MethodAdvantages

Simple and easy to implementOne function evaluation per iterationThe size of the interval containing the zero is reduced by 50% after each iterationThe number of iterations can be determined a prioriNo knowledge of the derivative is neededThe function does not have to be differentiable

DisadvantageSlow to converge Good intermediate approximations may be discarded

Page 51: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

Lecture 8-9Newton-Raphson Method

SE301_Topic 2 (c)AL-AMER2006 ٥١

AssumptionsInterpretationExamplesConvergence Analysis

Page 52: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٢

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 first derivative is knownAn initial guess x0 such that f ’(x0) ≠0 is given

Page 53: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٣

Newton’s Method

ENDSTOPCONTINUE

XPRINTXFPXFXX

IDOX

XXXFPXXXF

PROGRAMFORTRANC

10*,

)(/)(5,110

4*62***3)(

12***33**)(

−==

=−=

+−=

endxfxfxx

nifor

xfnAssumputioxxfxfGiven

i

iii )('

)(:0

______________________0)('

),('),(

1

0

0

−=

=

+

Page 54: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٤

Newton’s Method

endXFPXFXX

iforX

PROGRAMMATLAB

)(/)(5:1

4%

−==

=

XXFPXFPFPfunction

XXFXFFfunction

*62^*3)(][

12^*33^)(][

−==

+−==F.m

FP.m

endxfxfxx

nifor

xfnAssumputioxxfxfGiven

i

iii )('

)(:0

______________________0)('

),('),(

1

0

0

−=

=

+

Page 55: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٥

Derivation of Newton’s Method

)(')( root theof guess new a

)(')(

.0)(such that Find)(')()(:TheroremTaylor

____________________________________estimate?better aobtain wedo How:

0)( ofroot theof guess initialan :

0

001

0

xfxfxx

xfxfh

hxfhhxfxfhxf

QuestionxfxGiven

−=

−≈⇒

=++≈+

=

Page 56: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٦

Example

2130.20742.90369.24375.2

)(')( :3Iteration

4375.21693

)(')( :2Iteration

333334

)(')( :1Iteration

143'

4 , 32function theof zero a Find

2

223

1

112

0

001

20

23

=−=−=

=−=−=

=−=−=

+−=

=−+−=

xfxfxx

xfxfxx

xfxfxx

xx(x) f

xxxxf(x)

Page 57: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٧

ExampleIteration xk f(xk) f’(xk) xk+1 |xk+1 –xk|

0 4 33 33 3 1

1 3 9 16 2.4375 0.5625

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

Page 58: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٨

Convergence Analysis

)('min

)(''max

21

such that

0exist then there0'.0 whererat x continuous be''',Let

:Theorem

0

0

21

0

xf

xfC

C-rx

-rx-rx

(r)fIff(r)(x) f(x) andff(x)

-rx

-rx

k

k

δ

δ

δ

δ

+

=

≤⇒≤

>≠=≈

Page 59: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٥٩

Convergence AnalysisRemarks

When the guess is close enough to a simpleroot 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 60: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٠

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.

Page 61: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦١

Multiple Roots3)( xxf =

( )21)( += xxf

1at zeros0at x zeros twohas has threehas has-x

f(x)f(x)==

Page 62: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٢

Problems with Newton’s MethodRunaway

x0 x1

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

Page 63: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٣

Problems with Newton’s MethodFlat Spot

x0

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

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

Page 64: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٤

Problems with Newton’s MethodCycle

x0=x2=x4

x1=x3=x5

The algorithm cycles between two values x0 and x1

Page 65: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٥

Newton’s Method for Systems of nonlinear Equations

[ ]

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

∂∂

∂∂

∂∂

∂∂

=⎥⎥⎥

⎢⎢⎢

⎡=

−=

=

−+

M

M

M 2

2

1

2

2

1

1

1

212

211

11

0

)(',,...),(,...),(

)(

)()('

'0)( ofroot theof guess initialan :

xf

xf

xf

xf

XFxxfxxf

XF

XFXFXX

IterationsNewtonxFXGiven

kkkk

Page 66: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٦

ExampleSolve the following system of equations

0,1 guess Initial05

0502

2

===−−

=−−+

yxyxyx

x.xy

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡−−−

−=

⎥⎥⎦

⎢⎢⎣

−−−−+=

01

,1552

112',

550

02

2X

xyxx

Fyxyx

x.xyF

Page 67: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٧

Solution Using Newton’s Method

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡−

−⎥⎦

⎤⎢⎣

⎡=

⎥⎦

⎤⎢⎣

⎡−

==⎥⎦

⎤⎢⎣

⎡=

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡−⎥⎦

⎤⎢⎣

⎡−

−⎥⎦

⎤⎢⎣

⎡=

⎥⎦

⎤⎢⎣

⎡−

=⎥⎦

⎤⎢⎣

⎡−−−

−==⎥

⎤⎢⎣

⎡−=⎥

⎤⎢⎣

−−−−+

=

2126.02332.1

0.25-0.0625

25.725.11 1.5

25.025.1

25.725.11 1.5

',0.25-

0.0625:2Iteration

25.025.1

150

6211

01

6211

1552112

',1

505

50

:1Iteration

1

2

1

1

2

2

X

FF

.X

xyxx

F.

yxyxx.xy

F

Page 68: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٨

ExampleTry this

Solve the following system of equations

0,0 guess Initial02

0122

2

===−−

=−−+

yxyyx

xxy

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡−−

−=

⎥⎥⎦

⎢⎢⎣

−−−−+=

00

,142

112',

21

022

2X

yxx

FyyxxxyF

Page 69: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٦٩

ExampleSolution

⎥⎦

⎤⎢⎣

⎡−⎥⎦

⎤⎢⎣

⎡−⎥⎦

⎤⎢⎣

⎡−⎥⎦

⎤⎢⎣

⎡−⎥⎦

⎤⎢⎣

⎡−⎥⎦

⎤⎢⎣

⎡0.19800.5257

0.19800.5257

0.19690.5287

2.06.0

01

00

_____________________________________________________________543210

kX

Iteration

Page 70: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

Lectures 10

Secant Method

SE301_Topic 2 (c)AL-AMER2006 ٧٠

Secant MethodExamplesConvergence Analysis

Page 71: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧١

Newton’s Method (Review)

lyanalyticalobtain todifficult or availablenot is )('

:Problem)('

)('

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

1

0

0

i

i

iii

xf

xfxfxx

estimatenewMethodsNewtonxf

availablearexxfxfsAssumption

−=

+

Page 72: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٢

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

Page 73: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٣

Secant Method

)()()()(

:Method)(Secant estimateNew)()(

points initial Two:sAssumption

1

11

1

1

−+

−−

−=

ii

iiiii

ii

ii

xfxfxxxfxx

xfxfthatsuchxandx

Page 74: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٤

Secant Method

)()()()(

10

5.02)(

1

11

1

0

2

−+ −

−−=

==

+−=

ii

iiiii xfxf

xxxfxx

xx

xxxf

Page 75: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٥

Secant Method

1

;)()(

)()(1

11

+=−−

−=−

−+

iixfxf

xxxfxxii

iiiii

1,, 10 =ixx

ε<−+ ii xx 1Stop

YesNO

Page 76: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٦

Modified Secant Method

divergemay method theproperly, selectednot If?select toHow :Problem

)()()(

)()()(

)()()('

needed is guess initial oneonly methodSecant modified thisIn

1

i

iii

iii

i

iii

iii

i

iiii

xfxfxfxxfxf

xfxx

xfxfxf

δ

δδ

δδ

δδ

−+−=

−+−=

−+≈

+

Page 77: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٧

Example

-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 points initial

3)( of roots thefind

10

35

<

−=−=

++=

errorwith

xandx

xxxf

Page 78: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٨

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

-1.0000 1.0000

-1.1000 0.0585 -1.1062 0. 0062

-1.1062 0.0102 -1.1052 0.0009

-1.1052 0.0001 -1.1052 0.0000

Page 79: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٧٩

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

Crx

rx≈≤

−+ αα

Page 80: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

Lectures 11

Comparison of Root finding methods

SE301_Topic 2 (c)AL-AMER2006 ٨٠

Advantages/disadvantages

Examples

Page 81: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨١

SummaryBisection Reliable, Slow

One function evaluation per iterationNeeds an interval [a,b] containing the root, f(a) f(b)<0No knowledge of derivative is needed

Newton Fast (if near the root) but may divergeTwo function evaluation per iterationNeeds derivative and an initial guess x0, f ’ (x0) is nonzero

Secant Fast (slower than Newton) but may divergeone function evaluation per iterationNeeds two initial points guess x0, x1 such that f (x0)- f (x1) is nonzero.No knowledge of derivative is needed

Page 82: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٢

Example

)()()()(

5.11 points initial Two1)(

ofroot thefind tomethodSecant Use

1

11

10

6

−+ −

−−=

==−−=

ii

iiiii xfxf

xxxfxx

xandxxxxf

Page 83: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٣

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

Page 84: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٤

Example

0001.0)(if

or001.0if or iterations threeafterStop

1 points initial theUse1)(

ofroot a find toMethod sNewton' Use

1

0

3

<

<−

=−−=

+

k

kk

xf

xx

xxxxf

Page 85: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٥

Five iterations of the solutionk xk f(xk) f’(xk) ERROR

______________________________________0 1.0000 -1.0000 2.0000 1 1.5000 0.8750 5.7500 0.15222 1.3478 0.1007 4.4499 0.02263 1.3252 0.0021 4.2685 0.00054 1.3247 0.0000 4.2646 0.00005 1.3247 0.0000 4.2646 0.0000

Page 86: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٦

Example

0001.0)(if

or001.0if or iterations threeafterStop

1 points initial theUse)(

ofroot a find toMethod sNewton' Use

1

0

<

<−

=−=

+

k

kk

x

xf

xx

xxexf

Page 87: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٧

Example

0.0000- 1.5671- 0.0000 0.5671 0.0002- 1.5672- 0.0002 0.5670 0.0291- 1.5840- 0.0461 0.5379 0.4621 1.3679- 0.6321- 1.0000

)(')()(')(

1)(',)(

ofroot a find toMethod sNewton' Use

k

kkkk

xx

xf xf xf xf x

exfxexf −−=−= −−

Page 88: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٨

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

0.60000000000000 initial guess 0.74401731944598 1 correct digit 0.73909047688624 4 correct digits 0.73908513322147 10 correct digits 0.73908513321516 14 correct digits

Page 89: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٨٩

ExampleIn estimating the root of x-cos(x)=0To get more than 13 correct digits

4 iterations of Newton (x0=0.6)

43 iterations of Bisection method (initial interval [0.6, .8]

5 iterations of Secant method( x0=0.6, x1=0.8)

Page 90: SE301: Numerical Methods · 2008. 3. 8. · SE301: Numerical Methods Topic 2: Solution of Nonlinear Equations Lectures 5-11: SE301_Topic 2 (c)AL-AMER2006 ١ Dr. Samir Al-Amer (Term

SE301_Topic 2 (c)AL-AMER2006 ٩٠

Homework AssignmentCheck the webCT for the HW and due date


Recommended