Docsity

Newton's Method and Rootfinding - Prof. Luke Olson, Study notes of Computer Science

Partial preview of the text

Download Newton's Method and Rootfinding - Prof. Luke Olson and more Study notes Computer Science in PDF only on Docsity!

Lecture 5

Rootfinding: Newton’s Method

L. Olson

Department of Computer Science University of Illinois at Urbana-Champaign

September 8, 2006

Recall Bisection

For the bracket interval [a, b] the midpoint is

xm =

(a + b)

idea: (^1) split bracket in half (^2) select the bracket that has the root (^3) goto step 1

Newton’s Method

x (^2) x 1

f ( x 1 )

f ( x 2 )

x 3

For a current guess xk, use f (xk) and the slope f ′(xk) to predict where f (x) crosses the x axis.

Newton’s Method

Expand f (x) in Taylor Series around xk

f (xk + ∆x) = f (xk) + ∆x

df dx

xk

(∆x)^2 2

d^2 f dx^2

xk

Substitute ∆x = xk+ 1 − xk and neglect 2 nd^ order terms to get

f (xk+ 1 ) ≈ f (xk) + (xk+ 1 − xk) f ′(xk)

where f ′(xk) = df dx

xk

Newton’s Method Algorithm

1 initialize : x 1 =... 2 for k = 2 , 3 ,... 3 xk = xk− 1 − f (xk− 1 )/f ′(xk− 1 ) 4 if converged , stop 5 end

Newton’s Method Example

Solve: x − x^1 /^3 − 2 = 0 First derivative is f ′(x) = 1 −

x−^2 /^3

The iteration formula is

xk+ 1 = xk −

xk − x 1 / 3 k −^2 1 − 13 x− k^2 /^3

Divergence of Newton’s Method

x 1

f ( x 1 )

f ' ( x 1 ) ≈ 0

Since xk+ 1 = xk − f (xk) f ′(xk) the new guess, xk+ 1 , will be far from the old guess whenever f ′(xk) ≈ 0

Divergence of Newton’s Method

Can you guess?

http://www.math.umn.edu/˜garrett/qy/Newton.html

Fractals: What?

Definition

Fractal A mathematical pattern (geometric object) that is reproducible at any level of magnification or reduction.

Definition

Fractal A term used by Benoit Mandelbrot to refer to geometric objects with fractional dimensions rather than integer dimensions. Also used ”fractal” to refer to shapes that are self-similar: they look the same at any zoom level.

Fractals: Application

Scientificly used to describe highly irregular objects fractal image compression Seismology Cosmology life sciences: I (^) clouds and fluid turbulence I (^) trees I (^) coastlines More interesting observations: New music/New art Video games/graphics Chaos theory the Butterfly effect: small changes produces large effects

Fractals: Newton’s Algorithm

The big idea: Take a complex function like f (z) = z^3 + 1 Pick a bunch of initial guesses Z 0 as the roots Run Newton’s Method The initial guesses Z 0 will each converge to one of n = 3 roots Color each guess in the plane depending on the root it converged to

Secant Method

x 2 x 1

f ( x 1 )

a

f ( b )

f ( a )

b

Given two guesses xk− 1 and xk, the next guess at the root is where the line through f (xk− 1 ) and f (xk) crosses the x axis.

Secant Method

Two versions of this formula are (equivalent in exact math)

xk+ 1 = xk − f (xk)

[

xk − xk− 1 f (xk) − f (xk− 1 )

]

and xk+ 1 = f (xk)xk− 1 − f (xk− 1 )xk f (xk) − f (xk− 1 )

Equation (?) is better since it is of the form xk+ 1 = xk + ∆. Even if ∆ is inaccurate the change in the estimate of the root will be small at convergence because f (xk) will also be small. Equation (??) is susceptible to catastrophic cancellation: f (xk) → f (xk− 1 ) as convergence approaches, so cancellation error in denominator can be large. |f (x)| → 0 as convergence approaches, so underflow is possible

Secant Algorithm

1 initialize : x 1 =.. ., x 2 =... 2 for k = 2 , 3... 3 xk+ 1 = xk 4 −f (xk)(xk − xk− 1 )/(f (xk) − f (xk− 1 )) 5 if converged , stop 6 end