Computers in Civil Engineering 53:081 Spring 2003

13
Computers in Civil Computers in Civil Engineering Engineering 53:081 Spring 2003 53:081 Spring 2003 Lecture #7 Lecture #7 Roots of Equations: Open Roots of Equations: Open Methods Methods

description

Computers in Civil Engineering 53:081 Spring 2003. Lecture #7. Roots of Equations: Open Methods. Lecture Outline. Open Methods The Newton-Raphson Algorithm The Secant Algorithm. Newton-Raphson Algorithm Graphical Derivation. . 0. x i+ 1. x i. From figure:. (Newton-Raphson Formula). - PowerPoint PPT Presentation

Transcript of Computers in Civil Engineering 53:081 Spring 2003

Page 1: 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

Page 2: Computers in Civil Engineering 53:081 Spring 2003

Open Methods– The Newton-Raphson Algorithm– The Secant Algorithm

Lecture OutlineLecture Outline

Page 3: Computers in Civil Engineering 53:081 Spring 2003

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)

Page 4: Computers in Civil Engineering 53:081 Spring 2003

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)

Page 5: Computers in Civil Engineering 53:081 Spring 2003

• 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

Page 6: Computers in Civil Engineering 53:081 Spring 2003

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:

Page 7: Computers in Civil Engineering 53:081 Spring 2003

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

Page 8: Computers in Civil Engineering 53:081 Spring 2003

Newton-Raphson Newton-Raphson PitfallsPitfalls

x1 x2x3 x

x

f(x)

f(x)

x1 x2x3 x4

Page 9: Computers in Civil Engineering 53:081 Spring 2003

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:

Page 10: Computers in Civil Engineering 53:081 Spring 2003

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

Page 11: Computers in Civil Engineering 53:081 Spring 2003

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

Page 12: Computers in Civil Engineering 53:081 Spring 2003

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.

Page 13: Computers in Civil Engineering 53:081 Spring 2003

Next:Next:Systems of Nonlinear Systems of Nonlinear

EquationsEquations(Read the Textbook!)(Read the Textbook!)