ee3561_unit 2(c)al-dhaifallah14351 lecture 5 newton-raphson method assumptions interpretation...
TRANSCRIPT
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 1
Lecture 5 Newton-Raphson
Method
Assumptions Interpretation Examples Convergence Analysis
Reading Assignment: Sections 6.2
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 2
Root finding Problems Many problems in Science and Engineering are
expressed as
0)(such that value thefind
, function continuous aGiven
rfr
f(x)
These problems are called root finding problems
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 3
Solution MethodsSeveral ways to solve nonlinear equations are
possible.
Analytical Solutions possible for special equations only
Graphical Solutions Useful for providing initial guesses for other methods
Numerical Solutions Open methods Bracketing methods
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 4
Bracketing 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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 5
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 the root.
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 6
Solution Methods Many methods are available to solve nonlinear
equations Bisection Method Newton’s Method Secant Method False position Method Muller’s Method Bairstow’s Method Fixed point iterations ……….
These will be covered in EE3561
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 7
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 known An initial guess x0 such that f ’(x0) ≠0 is given
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 8
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 9
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 10
Newton’s Method
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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 11
Example
2130.20742.9
0369.24375.2
)('
)( :3Iteration
4375.216
93
)('
)( :2Iteration
333
334
)('
)( :1Iteration
143'
4 , 32function theof zero a Find
2
223
1
112
0
001
2
023
xf
xfxx
xf
xfxx
xf
xfxx
xx(x) f
xxxxf(x)
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 12
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
Convergence analysis of the Newton’s Method
The Taylor series expansion can be represented as
An approximate solution can be obtained by
At the intersection with x axis f(xi+1)=0, which gives
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 13
Convergence analysis of the Newton’s Method Substituting the true value xr into Eq (B6.2.1) yields
Subtracting Eq (B6.2.2) from Eq (B6.2.3) yields
Substituting and gives
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 14
Convergence analysis of the Newton’s Method If we assume convergence, both xi and should
eventually approximated by the root xr, and Eq(B6.2.5) can be rearranged to yield
Which means that the current error is proportional to the square of the previous error which indicates quadratic convergence rate.
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 15
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 16
Convergence AnalysisRemarks
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.
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 17
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.
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 18
Multiple Roots
1at zeros0at x zeros
twohas threehas
-x
f(x)f(x)
21)( xxf
3)( xxf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 19
Problems with Newton’s Method Runaway
The estimates of the root is going away from the root.
x0 x1
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 20
Problems with Newton’s Method Flat Spot
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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 21
Problems with Newton’s Method Cycle
The algorithm cycles between two values x0 and x1
x0=x2=x4
x1=x3=x5
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 22
Newton’s Method for Systems of nonlinear Equations
2
2
1
2
2
1
1
1
212
211
11
0
)(',,...),(
,...),(
)(
)()('
'
0)( ofroot theof guess initialan :
x
f
x
fx
f
x
f
XFxxf
xxf
XF
XFXFXX
IterationsNewton
xFXGiven
kkkk
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 23
Example Solve the following system of equations
0,1 guess Initial
05
0502
2
yx
yxyx
x.xy
0
1,
1552
112',
5
5002
2
Xxyx
xF
yxyx
x.xyF
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 24
Solution Using Newton’s Method
2126.0
2332.1
0.25-
0.0625
25.725.1
1 1.5
25.0
25.1
25.725.1
1 1.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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 25
ExampleTry this
Solve the following system of equations
0,0 guess Initial
02
0122
2
yx
yyx
xxy
0
0,
142
112',
2
1022
2
Xyx
xF
yyx
xxyF
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 26
ExampleSolution
0.1980
0.5257
0.1980
0.5257
0.1969
0.5287
2.0
6.0
0
1
0
0
_____________________________________________________________
543210
kX
Iteration
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 27
Secant Method Secant Method Examples Convergence Analysis
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 28
Newton’s Method (Review)
lyanalyticalobtain todifficult or
availablenot is )('
:Problem
)('
)(
'
0)('
,),('),(:
1
0
0
i
i
iii
xf
xf
xfxx
estimatenewMethodsNewton
xf
availablearexxfxfsAssumption
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 29
Secant Method
)()(
)()(
)()()(
)(
)(
)()()('
points initial twoare if
)()()('
1
1
1
11
1
1
1
ii
iiii
ii
ii
iii
ii
iii
ii
xfxf
xxxfx
xxxfxf
xfxx
xx
xfxfxf
xandx
h
xfhxfxf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 30
Secant Method
)()(
)()(
:Method)(Secant estimateNew
)()(
points initial Two
:sAssumption
1
11
1
1
ii
iiiii
ii
ii
xfxf
xxxfxx
xfxfthatsuch
xandx
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 31
Secant Method
)()(
)()(
1
0
5.02)(
1
11
1
0
2
ii
iiiii xfxf
xxxfxx
x
x
xxxf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 32
Secant Method
1
;)()(
)()(
1
11
ii
xfxf
xxxfxx
ii
iiiii
1,, 10 ixx
ii xx 1Stop
NO Yes
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 33
Modified Secant Method
divergemay method theproperly, selectednot If
?select toHow :Problem
)()*(
*)(
*)()*(
)(
*
)()*()('
needed is guess initial oneonly methodSecant modified thisIn
1
iii
iii
i
iii
iii
i
iiii
xfxxf
xxfx
xxfxxf
xfxx
x
xfxxfxf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 34
-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
points initial
3)(
of roots thefind
10
35
errorwith
xandx
xxxf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 35
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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 36
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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 37
Comparison of Root
finding methods Advantages/disadvantages Examples
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 38
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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 39
Example
)()(
)()(
5.11 points initial Two
1)(
ofroot thefind tomethodSecant Use
1
11
10
6
ii
iiiii xfxf
xxxfxx
xandx
xxxf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 40
Solution_______________________________ k xk f(xk)
________________________________ 0 1.0000 -1.0000 1 1.5000 8.8906 2 1.0506 -0.7062 3 1.0836 -0.4645 4 1.1472 0.1321 5 1.1331 -0.0165 6 1.1347 -0.0005
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 41
Example
0001.0)(if
or001.0if
or iterations threeafterStop
1 points initial theUse
1)(
ofroot a find toMethod sNewton' Use
1
0
6
k
kk
xf
xx
x
xxxf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 42
Five iterations of the solution k xk f(xk) f’(xk) ERROR ______________________________________ 0 1.0000 -1.0000 5.0000 1 1.2000 0.786 13.93 0.2 2 1.1436 0.0930 10.7348 0.0564 3 1.1349 0.0019 10.2969 0.009 4 1.1347 0.0000 10.2876 0.0002 5 1.1347 0.0000 10.2876 0.0000
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 43
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
x
xexf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 44
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 to MethodsNewton' Use
k
kkkk
xx
xf
xf xf xf x
exfxexf
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 45
Example Estimates 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
EE3561_Unit 2 (c)AL-DHAIFALLAH1435 46
Example In estimating the root of x-cos(x)=0 To 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)