Lecture 39: Root Finding via Newton s Method

Similar documents
Convergence Rates on Root Finding

Solution of Nonlinear Equations

Outline. Math Numerical Analysis. Intermediate Value Theorem. Lecture Notes Zeros and Roots. Joseph M. Mahaffy,

Math Numerical Analysis

THE SECANT METHOD. q(x) = a 0 + a 1 x. with

ROOT FINDING REVIEW MICHELLE FENG

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 5. Nonlinear Equations

Numerical Analysis: Solving Nonlinear Equations

3.1 Introduction. Solve non-linear real equation f(x) = 0 for real root or zero x. E.g. x x 1.5 =0, tan x x =0.

Chapter 1. Root Finding Methods. 1.1 Bisection method

Simple Iteration, cont d

CHAPTER 10 Zeros of Functions

Zeros of Functions. Chapter 10

Chapter 4. Solution of Non-linear Equation. Module No. 1. Newton s Method to Solve Transcendental Equation

SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATIONS BISECTION METHOD

PART I Lecture Notes on Numerical Solution of Root Finding Problems MATH 435

4 Nonlinear Equations

Midterm Review. Igor Yanovsky (Math 151A TA)

Scientific Computing: An Introductory Survey

Outline. Scientific Computing: An Introductory Survey. Nonlinear Equations. Nonlinear Equations. Examples: Nonlinear Equations

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Root Finding (and Optimisation)

Unit 2: Solving Scalar Equations. Notes prepared by: Amos Ron, Yunpeng Li, Mark Cowlishaw, Steve Wright Instructor: Steve Wright

FIXED POINT ITERATION

CS 450 Numerical Analysis. Chapter 5: Nonlinear Equations

1. Method 1: bisection. The bisection methods starts from two points a 0 and b 0 such that

Chapter 3: Root Finding. September 26, 2005

Numerical Methods in Physics and Astrophysics

Numerical Methods I Solving Nonlinear Equations

x 2 x n r n J(x + t(x x ))(x x )dt. For warming-up we start with methods for solving a single equation of one variable.

Introduction to Numerical Analysis

CLASS NOTES Models, Algorithms and Data: Introduction to computing 2018

Solution of Algebric & Transcendental Equations

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

Numerical Methods. King Saud University

Nonlinear Equations. Chapter The Bisection Method

Computational Methods CMSC/AMSC/MAPL 460. Solving nonlinear equations and zero finding. Finding zeroes of functions

Zeroes of Transcendental and Polynomial Equations. Bisection method, Regula-falsi method and Newton-Raphson method

Determining the Roots of Non-Linear Equations Part I

Lecture 7: Numerical Tools

Generalization Of The Secant Method For Nonlinear Equations

Hermite Interpolation

MATH 3795 Lecture 12. Numerical Solution of Nonlinear Equations.

Numerical solutions of nonlinear systems of equations

Lecture 8. Root finding II

BOUNDARY VALUE PROBLEMS

Solving nonlinear equations (See online notes and lecture notes for full details) 1.3: Newton s Method

Chapter 6. Nonlinear Equations. 6.1 The Problem of Nonlinear Root-finding. 6.2 Rate of Convergence

Numerical Methods in Informatics

Numerical Methods in Physics and Astrophysics

15 Nonlinear Equations and Zero-Finders

5 Finding roots of equations

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

CS 323: Numerical Analysis and Computing

Numerical Algorithms. IE 496 Lecture 20

Nonlinear equations. Norms for R n. Convergence orders for iterative methods

Order of convergence

CS 323: Numerical Analysis and Computing

p 1 p 0 (p 1, f(p 1 )) (p 0, f(p 0 )) The geometric construction of p 2 for the se- cant method.

Bisection Method. and compute f (p 1 ). repeat with p 2 = a 2+b 2

NUMERICAL AND STATISTICAL COMPUTING (MCA-202-CR)

Solving nonlinear equations

Solving Non-Linear Equations (Root Finding)

Application - Ray Tracing and Bézier surfaces. TANA09 Lecture 3. Error Estimate. Application - Ray tracing and Beziér surfaces.

Lec7p1, ORF363/COS323

Numerical Methods. King Saud University

MATH ASSIGNMENT 03 SOLUTIONS

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

1.1: The bisection method. September 2017

MAT 460: Numerical Analysis I. James V. Lambers

Introductory Numerical Analysis

1 ERROR ANALYSIS IN COMPUTATION

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

Math Numerical Analysis Mid-Term Test Solutions

4 damped (modified) Newton methods

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9

MA 8019: Numerical Analysis I Solution of Nonlinear Equations

Practical Numerical Analysis: Sheet 3 Solutions

Math 4329: Numerical Analysis Chapter 03: Fixed Point Iteration and Ill behaving problems. Natasha S. Sharma, PhD

Numerical differentiation

Numerical Methods. Root Finding

Lecture 7. Root finding I. 1 Introduction. 2 Graphical solution

Root Finding Methods

by Martin Mendez, UASLP Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Applied Mathematics Letters. Combined bracketing methods for solving nonlinear equations

University of Houston, Department of Mathematics Numerical Analysis, Fall 2005

A Few Concepts from Numerical Analysis

Root Finding Convergence Analysis

Roots of equations, minimization, numerical integration

Math Introduction to Numerical Methods - Winter 2011 Homework 2 Assigned: Friday, January 14, Due: Thursday, January 27,

Numerical Analysis and Computing

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

QR Decomposition. When solving an overdetermined system by projection (or a least squares solution) often the following method is used:

NON-LINEAR ALGEBRAIC EQUATIONS Lec. 5.1: Nonlinear Equation in Single Variable

sin x lim x 0 by means of a geometric argument. But let s step back a bit and pretend that we don t know this result. If we encounter the problem lim

SOLVING EQUATIONS OF ONE VARIABLE

Notes for Numerical Analysis Math 5465 by S. Adjerid Virginia Polytechnic Institute and State University. (A Rough Draft)

Iterative Methods to Solve Systems of Nonlinear Algebraic Equations

Homework 2. Matthew Jin. April 10, 2014

Transcription:

Lecture 39: Root Finding via Newton s Method We have studied two braceting methods for finding zeros of a function, bisection and regula falsi. These methods have certain virtues (most importantly, they always converge), but it may be difficult to find an initial interval that bracets a root. Though they exhibit steady linear convergence, rather many evaluations of f may be required to attain sufficient accuracy. In this lecture, we will swap these reliable methods for a famous algorithm that often converges with amazing speed, but is more temperamental. Versions of this algorithm spring up everywhere. 7.2. Newton s Method. The idea behind the method is similar to regula falsi: model f with a line, and estimate the root of f by the root of that line. In regula falsi, this line interpolated the function values at either end of the root bracet. Newton s method is based purely on local information at the current solution estimate, x. Whereas the braceting methods only required that f be continuous, we will now require that f C 2 (R), that is, f and its first two derivatives should be continuous. This will allow us to expand f in a Taylor series around some approximate root x, f(x ) = f(x ) + f (x )(x x ) + 1 2 f (ξ)(x x ) 2, (39.1) where x is the exact solution, f(x ) = 0, and ξ is between x and x. Ignore the error term in this series, and you have a linear model for f; i.e., f (x ) is the slope of the line secant to f at the point x. Specifically, 0 = f(x ) f(x ) + f (x )(x x ), which implies x x f(x ) f (x ), so we get an iterative method by replacing x in the above formulas with x +1, x +1 := x f(x ) f (x ). (39.2) This celebrated iteration is Newton s method, implemented in the MATLAB code below. function xstar = newton(f,fprime,x0) % Compute a root of the function f using Newton s method % f: a function name % fprime: a derivative function name % x0: the starting guess % Example: newton( sin, cos,3), or newton( my_f, my_fprime,1) maxit = 60; fx = feval(f,x0); x=x0; =0; % initialize fprintf( %3d %20.14f %10.7e\n,, x, fx); while (abs(fx) > 1e-15) & ( < maxit) x = x - fx/feval(fprime,x); % Newton s method = +1; fx = feval(f,x); fprintf( %3d %20.14f %10.7e\n,, x, fx); end xstar = x; Richard Tapia gives a lecture titled If It Is Fast and Effective, It Must be Newton s Method. 29 November 2009 39-1 M. Embree, Rice University

What distinguishes this iteration? For a bad starting guess x 0, it can diverge entirely. When it converges, the root it finds can, in some circumstances, depend sensitively on the initial guess: this is a famous source of beautiful fractal illustrations. However, for a good x 0, the convergence is usually lightning quic. Let e = x x be the error at the th step. Subtract x from both sides of the iteration (39.2) to obtain a recurrence for the error, e +1 = e f(x ) f (x ). The Taylor expansion of f(x ) about the point x given in (39.1) gives 0 = f(x ) f (x )e + 1 2 f (ξ)e 2. Solving this equation for f(x ) and substituting that formula into the expression for e +1 we just derived, we obtain e +1 = e f (x )e + 1 2 f (ξ)e 2 f (x ) = f (ξ)e 2 2f (x ). Supposing that x is a simple root, so that f (x ) 0, the above analysis suggests that when x is near x, e +1 C e 2 for some constant C independent of. This is quadratic convergence, and it roughly means that you double the number of correct digits at each iteration. Compare this to bisection, where e +1 1 2 e, meaning that the error was halved at each step. Significantly, Newton s method will often exhibit a transient period of linear convergence while it gets sufficiently close to the answer, but once in a region of quadratic convergence, full machine precision is attained in just a couple more iterations. The following example approximates the zero of f(x) = x 2 2, i.e., x = 2. As initial guesses, we choose x 0 = 1.25 (left), which gives us very rapid convergence, and x 0 = 1000 (right), which is a ridiculous estimate of 2, but illustrates the linear phase of convergence that can precede superlinear convergence when x 0 is far from x. f(x ) 10 0 10 10 10 20 10 30 f(x ) 10 0 10 10 10 20 10 30 linear quadratic 10 40 10 50 0 1 2 3 4 5 6 10 40 x 0 = 1.25 x 0 = 1000 10 50 0 2 4 6 8 10 12 14 16 29 November 2009 39-2 M. Embree, Rice University

The table below shows the iterates for x 0 = 1000, computed exact arithmetic in Mathematica, and displayed here to more than eighty digits. This is a bit excessive: in the floating point arithmetic we have used all semester, we can only expect to get 15 or 16 digits of accuracy in the best case. It is worth looing at all these digits to get a better appreciation of the quadratic convergence. Once we are in the quadratic regime, notice the characteristic doubling of the number of correct digits (underlined) at each iteration. x_ --------------------------------------------------------------------------------------------- 0 1000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000 1 500.00100000000000000000000000000000000000000000000000000000000000000000000000000000000 2 250.00249999600000799998400003199993600012799974400051199897600204799590400819198361603 3 125.00524995800046799458406305526512856598014823595622393441695800477446685799463896484 4 62.51062464301703314888691358403320464529759944325744566631164600631017391478309761341 5 31.27130960206219455596422358771700548374565801842332086536365236578278080406153827364 6 15.66763299486836640030755527100281652065100159710324459452581543767403479921834012248 7 7.89764234785635806719051360934236238116968365174167025116461034160777628217364960111 8 4.07544124051949892088798573387067133352991149961309267159333980191548308075360961862 9 2.28309282439255383986306690358177946144339233634377781606055538481637200759555376236 10 1.57954875240601536527547001727498935127463981776389016188975791363939586265860323251 11 1.42286657957866825091209683856309818309310929428763928162890934673847036238184992693 12 1.41423987359153062319364616441120035182529489347860126716395746896392690040774558375 13 1.41421356261784851265589000359174396632207628548968908242398944391615436335625360056 14 1.41421356237309504882286807775717118221418114729423116637254804377031332440406155716 15 1.41421356237309504880168872420969807856983046705949994860439640079460765093858305190 16 1.41421356237309504880168872420969807856967187537694807317667973799073247846210704774 exact: 1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753... 7.2.1. Convergence analysis. We have already performed a simple analysis of Newton s method to gain an appreciation for the quadratic convergence rate. For a broader perspective, we shall now put Newton s method into a more general framewor, so that the accompanying analysis will allow us to understand simpler iterations lie the constant slope method: x +1 = x αf(x ) for some constant α (which could approximate 1/f (x ), for example). We begin by formalizing our notion of the rate of convergence. Definition. A root-finding algorithm is pth-order convergent if e +1 C e p for some p 1 and positive constant C. If p = 1, then C < 1 is necessary for convergence, and C is called the linear convergence rate. Newton s method is second-order convergent (i.e., it converges quadratically) for f C 2 (R) when f (x ) 0 and x 0 is sufficiently close to x. Bisection is linearly convergent for f C[a 0, b 0 ] with rate C = 1/2. 29 November 2009 39-3 M. Embree, Rice University

Functional iteration. One can analyze Newton s method and its variants through the following general framewor. Consider iterations of the form x +1 = Φ(x ), for some iteration function Φ. For example, for Newton s method Φ(x) = x f(x) f (x). If the starting guess is an exact root, x 0 = x, the method should be smart enough to return x 1 = x. Thus the root x is a fixed point of Φ, i.e., x = Φ(x ). We see an expression for the error e +1 = x +1 x in terms of e and properties of Φ. Assume, for example, that Φ(x) C 2 (R), so that we can write the Taylor series for Φ expanded about x : x +1 = Φ(x ) = Φ(x ) + (x x )Φ (x ) + 1 2 (x x ) 2 Φ (ξ) = x + (x x )Φ (x ) + 1 2 (x x ) 2 Φ (ξ) for some ξ between x and x. From this we obtain an expression for the errors: e +1 = e Φ (x ) + 1 2 e2 Φ (ξ). Convergence analysis is reduced to the study of Φ (x ), Φ (x ), etc. Example: Newton s method. For Newton s method so the quotient rule gives Φ(x) = x f(x) f (x), Φ (x) = 1 f (x) 2 f(x)f (x) f (x) 2 = f(x)f (x) f (x) 2. Provided x is a simple root so that f (x ) 0 (and supposing f C 2 (R)), we have Φ (x ) = 0, and thus e +1 = 1 2 e2 Φ (ξ), and hence we again see quadratic convergence provided x is sufficiently close to x. What happens when f (x ) = 0? If x is a multiple root, we might worry that Newton s method might have trouble converging, since we are dividing f(x ) by f (x ), and both quantities are nearing zero as x x. This general convergence framewor allows us to investigate this situation more precisely. We wish to understand lim Φ f(x)f (x) (x) = lim x x x x f (x) 2. For further details on this standard approach, see G. W. Stewart, Afternotes on Numerical Analysis, 2 4; J. Stoer & R. Bulirsch, Introduction to Numerical Analysis, 2nd ed., 5.2; L. W. Johnson and R. D. Riess, Numerical Analysis, second ed., 4.3. 29 November 2009 39-4 M. Embree, Rice University

This limit has the indeterminate form 0/0. Assuming sufficient differentiability, we can invoe l Hôpital s rule: f(x)f (x) f (x)f (x) + f(x)f (x) lim x x f (x) 2 = lim x x 2f (x)f, (x) but this is also of the indeterminate form 0/0 when f (x ) = 0. Again using l Hôpital s rule and now assuming f (x ) 0, f(x)f (x) f (x) 2 + 2f (x)f (x) + f(x)f (iv) (x) f (x) 2 lim x x f (x) 2 = lim x x 2(f (x)f (x) + f (x) 2 = lim ) x x 2f (x) 2 = 1 2. Thus, Newton s method converges locally to a double root according to e +1 = 1 2 e + O(e 2 ). Note that this is linear convergence at the same rate as bisection! If x has multiplicity exceeding two, then f (x ) = 0 and further analysis is required. One would find that the rate remains linear, and gets even slower. The slow convergence of Newton s method for multiple roots is exacerbated by the chronic ill-conditioning of such roots. Let us summarize what might seem to be a paradoxical situation: the more copies of root there are present, the more difficult that root is to find! 29 November 2009 39-5 M. Embree, Rice University