Computers in Civil Engineering 53:081 Spring 2003
description
Transcript of Computers in Civil Engineering 53:081 Spring 2003
Computers in Civil Computers in Civil EngineeringEngineering
53:081 Spring 200353:081 Spring 2003
Lecture #7Lecture #7
Roots of Equations: Open Roots of Equations: Open MethodsMethods
Open Methods– The Newton-Raphson Algorithm– The Secant Algorithm
Lecture OutlineLecture Outline
Newton-Raphson Newton-Raphson AlgorithmAlgorithm
Graphical DerivationGraphical Derivation
xixi+10
)(')tan( ixfβ
)( ixf
)(xf
1
)()(
ii
ii xx
xfx'f
)(
)(1
i
iii x'f
xfxx
From figure:
(Newton-Raphson Formula)
Derivation from Taylor Derivation from Taylor SeriesSeries
))(()(0
0)(that such selecting
))(()()(
...)(!2
)('' ))(()()(
1
11
11
2111
iiii
ii
iiiii
iiiiiii
xxx'fxf
xfx
xxx'fxfxf
xxf
xxx'fxfxf
)(
)(
i
iii x'f
xfxx 1Which can be rearranged as:
(same result as geometrical one)
• Quadratic convergence (Single Roots)• Number of correct decimal places doubles
with each iteration (single root)• Linear convergence (Multiple Roots)• Some problem cases exist
• Slow or no convergence
• Oscillation• Both function and its derivative must be
evaluated:• Inconvenient
• May not be so easy
Newton-Raphson Algorithm Newton-Raphson Algorithm PropertiesProperties
Example: Example: ff((xx) = ) = ee-x-x-x-x
sr
rra x
xx
100%new
oldnew
-1.0
-0.5
0.0
0.5
1.0
0.2 0.4 0.6 0.8 1.0
x
f(x)
Stopping Criteria:
ConvergenceConvergence
Newton-Raphson Bisection
Iteration xr |t|% |t|%
1 0.50000 11.8 11.8
2 0.56631 0.147 32.2 3 0.56714 0.00002 10.2 4 0.56714 < 10-8 0.819
Newton-Raphson Newton-Raphson PitfallsPitfalls
x1 x2x3 x
x
f(x)
f(x)
x1 x2x3 x4
Secant AlgorithmSecant Algorithm
ii
iii xx
xfxfx'f
1
1 )(( ))(
)(
)
1
11
ii
iiiii xfxf
xxxfxx
)(
)((
Motivation: Inconvenient/difficult to evaluate f '(x) analytically in Newton-Raphson algorithm:
Solution: Approximate f '(x) with a backward finite divided difference:
(1) )(
)(
i
iii x'f
xfxx 1
Substituting in (1) yields the secant algorithm:
Secant AlgorithmSecant Algorithm
xixi-10
)( 1ixf
)( ixf
xixi+10
)(')tan( ixfβ
)( ixf
)(xf
Secant Algorithm
•Use approximate f '(x) at xi
•Two initial estimates required
Newton-Raphson Algorithm
Use true f '(x) at xi
xi+1
Multiple RootsMultiple Roots
1 3
Double Root(even # of rootsno sign change)
Single Root(Odd # of roots,sign change)
f x( )
x
Note: = 0f x’( )
1 3
Triple Root(odd # of rootssign change)
Note: = 0f x’( ) Single Root(Odd # of roots,sign change)
f x( )
x
Multiple roots occur where the function is tangent to the axis. In other words, where
0)(')( xfxf
Multiple Roots Multiple Roots (continued)(continued)
At even multiple roots: no sign change => can’t use bracketing methods.
At multiple roots f(x) and f '(x) are zero.
– Newton-Raphson:
– Secant:
)(
)(
i
iii x'f
xfxx 1
)(
)
1
11
ii
iiiii xfxf
xxxfxx
)(
)((
Both formulas contain derivative (or its estimate) in denominator. This could result in division by zero as the solution converges very close to the root.
Next:Next:Systems of Nonlinear Systems of Nonlinear
EquationsEquations(Read the Textbook!)(Read the Textbook!)