today’s class roots of equation finish up incremental search open methods numerical methods,...

41
Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Upload: zoe-robbins

Post on 17-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Today’s class

• Roots of equation• Finish up incremental search • Open methods

Numerical Methods, Lecture 5 1

Prof. Jinbo Bi CSE, UConn

Page 2: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Although the interval [a,b] where the root becomes iteratively closer with the false position method, unlike the bisection method, the size of the interval does not necessarily converge to zero.

• Sometimes it can cause the false position to converge slower than bisection

False Position Method

Numerical Methods, Lecture 5 2

Prof. Jinbo Bi CSE, UConn

Page 3: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

False Position Method

Numerical Methods, Lecture 5 3

Prof. Jinbo Bi CSE, UConn

Page 4: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Modified False Position Method• Detect when you get stuck and use a

bisection method• Can get you to convergence faster

False Position Method

Numerical Methods, Lecture 5 4

Prof. Jinbo Bi CSE, UConn

Page 5: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Dependent on knowing the bracket in which the root falls

• Can use bracketed incremental search to speed up exhaustive search• How big a bracket or increment can

determine how long the search will take• Too small increment and it will take too long• Too big increment may miss roots, in

partular, the multiple roots

Incremental Searches

Numerical Methods, Lecture 5 5

Prof. Jinbo Bi CSE, UConn

Page 6: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Incremental Searches

Numerical Methods, Lecture 5 6

Prof. Jinbo Bi CSE, UConn

Page 7: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Open Methods

• Bracket methods depend on knowing the interval in which the root resides

• What if you don’t know the upper and lower bound on the root?

• Open methods• Use a single estimate of the root• Use two starting points but not bracketing the

root• May not converge on root

Numerical Methods, Lecture 5 7

Prof. Jinbo Bi CSE, UConn

Page 8: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Open Methods

Numerical Methods, Lecture 5 8

Prof. Jinbo Bi CSE, UConn

Page 9: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Open Methods

• Fixed-Point Iteration• One-point iteration• Successive substitution

• Start with equation f(x) = 0 and rearrange so x is on left hand side.

• If algebraic manipulation doesn’t work, just add x to both sides

Numerical Methods, Lecture 5 9

Prof. Jinbo Bi CSE, UConn

Page 10: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Fixed-point iteration

• The function transformation allows us to use g(x) to calculate a new guess of x

Numerical Methods, Lecture 5 10

Prof. Jinbo Bi CSE, UConn

Page 11: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Find root of f(x)=e-x-x• Transform f(x)=0 to x=g(x)=e-x

• Start with an estimate of x0=0

• x1=g(x0)=e-0=1

Example

Numerical Methods, Lecture 5 11

Prof. Jinbo Bi CSE, UConn

Page 12: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Example

• true value of the root: 0.56714329

Numerical Methods, Lecture 5 12

Prof. Jinbo Bi CSE, UConn

Page 13: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Example

Numerical Methods, Lecture 5 13

Prof. Jinbo Bi CSE, UConn

Page 14: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Fixed-point iteration

• Convergence properties• If converge, much faster than bracketing

methods• May not converge• Depends on the curve characteristics

Numerical Methods, Lecture 5 14

Prof. Jinbo Bi CSE, UConn

Page 15: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Fixed-point iteration

Numerical Methods, Lecture 5 15

Prof. Jinbo Bi CSE, UConn

Page 16: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Fixed-point iteration

Numerical Methods, Lecture 5 16

Prof. Jinbo Bi CSE, UConn

Page 17: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Fixed-point iteration

Numerical Methods,Lecture 5 17

Prof. Jinbo Bi CSE, UConn

Page 18: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Fixed-point iteration

Numerical Methods, Lecture 5 18

Prof. Jinbo Bi CSE, UConn

Page 19: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Assume xr is the true root

• Combine with the iterative relationship

Convergence Analysis

Numerical Methods, Lecture 5 19

Prof. Jinbo Bi CSE, UConn

Page 20: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Use derivative mean-value theorem

• If the derivative is less than 1, the error will get smaller with each iteration (monotonic or oscillating).

• If the derivative is greater than 1, the error will get larger with each iteration.

Fixed-point iteration

Numerical Methods, Lecture 5 20

Prof. Jinbo Bi CSE, UConn

Page 21: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Similar idea to False Position Method• Use tangent to guide you to the root

Newton-Raphson Method

Numerical Methods, Lecture 5 21

Prof. Jinbo Bi CSE, UConn

Page 22: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Find root of f(x)=e-x-x

• Start with an estimate of x0=0

Example

Numerical Methods, Lecture 5 22

Prof. Jinbo Bi CSE, UConn

Page 23: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Example

• true value of the root: 0.56714329

Numerical Methods, Lecture 5 23

Prof. Jinbo Bi CSE, UConn

Page 24: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Convergence analysis• First-order Taylor series expansion

• At root

Newton-Raphson Method

Numerical Methods, Lecture 5 24

Prof. Jinbo Bi CSE, UConn

Page 25: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Newton-Raphson method is quadratically convergent

Newton-Raphson Method

2,1, )('2

)("it

r

rit E

xf

xfE

Numerical Methods, Lecture 5 25

Prof. Jinbo Bi CSE, UConn

Page 26: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Problems and Pitfalls• Slow convergence when initial guess is not

close enough• May not converge at all• Problems with multiple roots

Newton-Raphson Method

Numerical Methods, Lecture 5 26

Prof. Jinbo Bi CSE, UConn

Page 27: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Newton-Raphson Method

Numerical Methods, Lecture 5 27

Prof. Jinbo Bi CSE, UConn

Page 28: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Newton-Raphson Method

Numerical Methods, Lecture 5 28

Prof. Jinbo Bi CSE, UConn

Page 29: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Newton-Raphson Method

Numerical Methods, Lecture 5 29

Prof. Jinbo Bi CSE, UConn

Page 30: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Newton-Raphson Method

Numerical Methods, Lecture 5 30

Prof. Jinbo Bi CSE, UConn

Page 31: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Algorithm should guard against slow convergence or divergence

• If slow convergence or divergence detected, use another method

Newton-Raphson Method

Numerical Methods, Lecture 5 31

Prof. Jinbo Bi CSE, UConn

Page 32: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Newton-Raphson method requires calculation of the derivative

• Instead, approximate the derivative using backward finite divided difference

Secant method

Numerical Methods, Lecture 5 32

Prof. Jinbo Bi CSE, UConn

Page 33: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• From Newton-Raphson method

• Replace with backward finite difference approximation

Secant method

Numerical Methods, Lecture 5 33

Prof. Jinbo Bi CSE, UConn

Page 34: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Find root of f(x)=e-x-x

• Start with an estimate of x-1=0 and x0=1

Example

Numerical Methods, Lecture 5 34

Prof. Jinbo Bi CSE, UConn

Page 35: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Example

• true value of the root: 0.56714329

Numerical Methods, Lecture 5 35

Prof. Jinbo Bi CSE, UConn

Page 36: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• False-Position method always brackets the root

• False-Position will always converge• Secant method may not converge• Secant method usually converges much

faster

Secant Method vs. False-Position Method

Numerical Methods, Lecture 5 36

Prof. Jinbo Bi CSE, UConn

Page 37: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Secant Method vs. False-Position Method

Numerical Methods, Lecture 5 37

Prof. Jinbo Bi CSE, UConn

Page 38: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Instead of using backward finite difference to estimate the derivative, use a small delta

• Substitute back into Newton-Raphson formula

Modified Secant Method

Numerical Methods, Lecture 5 38

Prof. Jinbo Bi CSE, UConn

Page 39: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Find root of f(x)=e-x-x

• Start with an estimate of x0=1 and δ=0.01

Example

Numerical Methods, Lecture 5 39

Prof. Jinbo Bi CSE, UConn

Page 40: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

Example

• true value of the root: 0.56714329

Numerical Methods, Lecture 5 40

Prof. Jinbo Bi CSE, UConn

Page 41: Today’s class Roots of equation Finish up incremental search Open methods Numerical Methods, Lecture 5 1 Prof. Jinbo Bi CSE, UConn

• Polynomial roots• Read Chapter 7

Next class

Numerical Methods, Lecture 5 41

Prof. Jinbo Bi CSE, UConn