Numerical Analysis: Solving Nonlinear Equations

Similar documents
Solution of Nonlinear Equations

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

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

CHAPTER-II ROOTS OF EQUATIONS

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

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

Roots of Equations. ITCS 4133/5133: Introduction to Numerical Methods 1 Roots of Equations

Convergence Rates on Root Finding

Numerical Analysis: Approximation of Functions

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

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.

Numerical Methods. Root Finding

1. Nonlinear Equations. This lecture note excerpted parts from Michael Heath and Max Gunzburger. f(x) = 0

Determining the Roots of Non-Linear Equations Part I

CHAPTER 10 Zeros of Functions

Zeros of Functions. Chapter 10

Numerical Analysis: Solving Systems of Linear Equations

Root Finding (and Optimisation)

15 Nonlinear Equations and Zero-Finders

FIXED POINT ITERATIONS

ROOT FINDING REVIEW MICHELLE FENG

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

Solution of Algebric & Transcendental Equations

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

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

Appendix 8 Numerical Methods for Solving Nonlinear Equations 1

5 Finding roots of equations

Chapter 3: Root Finding. September 26, 2005

Introduction to Numerical Analysis

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

Math 471. Numerical methods Root-finding algorithms for nonlinear equations

Nonlinear Equations. Chapter The Bisection Method

The Mean Value Theorem and the Extended Mean Value Theorem

CS 323: Numerical Analysis and Computing

Consequences of Continuity and Differentiability

STOP, a i+ 1 is the desired root. )f(a i) > 0. Else If f(a i+ 1. Set a i+1 = a i+ 1 and b i+1 = b Else Set a i+1 = a i and b i+1 = a i+ 1

Caculus 221. Possible questions for Exam II. March 19, 2002

Math 473: Practice Problems for Test 1, Fall 2011, SOLUTIONS

Lecture 8: Optimization

Simple Iteration, cont d

Lecture 39: Root Finding via Newton s Method

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

COURSE Iterative methods for solving linear systems

1 + lim. n n+1. f(x) = x + 1, x 1. and we check that f is increasing, instead. Using the quotient rule, we easily find that. 1 (x + 1) 1 x (x + 1) 2 =

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Chapter 1. Root Finding Methods. 1.1 Bisection method

Math Numerical Analysis

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

Section 4.2: The Mean Value Theorem

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

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

Midterm Review. Igor Yanovsky (Math 151A TA)

Scientific Computing: An Introductory Survey

MATH 2053 Calculus I Review for the Final Exam

X. Numerical Methods

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.

Solving Non-Linear Equations (Root Finding)

INTRODUCTION TO NUMERICAL ANALYSIS

The Mean Value Theorem Rolle s Theorem

h(x) lim H(x) = lim Since h is nondecreasing then h(x) 0 for all x, and if h is discontinuous at a point x then H(x) > 0. Denote

Roots of equations, minimization, numerical integration

Continuity. MATH 161 Calculus I. J. Robert Buchanan. Fall Department of Mathematics

Introductory Numerical Analysis

SOLVING EQUATIONS OF ONE VARIABLE

Induction, sequences, limits and continuity

Chapter 8: Taylor s theorem and L Hospital s rule

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.

Continuity. To handle complicated functions, particularly those for which we have a reasonable formula or formulas, we need a more precise definition.

DRAFT - Math 101 Lecture Note - Dr. Said Algarni

Hence a root lies between 1 and 2. Since f a is negative and f(x 0 ) is positive The root lies between a and x 0 i.e. 1 and 1.

Generalization Of The Secant Method For Nonlinear Equations

Bisection and False Position Dr. Marco A. Arocha Aug, 2014

Supplementary Notes for W. Rudin: Principles of Mathematical Analysis

The Intermediate Value Theorem If a function f (x) is continuous in the closed interval [ a,b] then [ ]

APPLICATIONS OF DIFFERENTIABILITY IN R n.

MA 8019: Numerical Analysis I Solution of Nonlinear Equations

Numerical Methods I Solving Nonlinear Equations

Chapter 2. Limits and Continuity. 2.1 Rates of change and Tangents to Curves. The average Rate of change of y = f(x) with respect to x over the

Numerical Methods in Informatics

INTRODUCTION TO COMPUTATIONAL MATHEMATICS

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

A nonlinear equation is any equation of the form. f(x) = 0. A nonlinear equation can have any number of solutions (finite, countable, uncountable)

CS 323: Numerical Analysis and Computing

AP Calculus Testbank (Chapter 9) (Mr. Surowski)

THE LIMIT PROCESS (AN INTUITIVE INTRODUCTION)

NUMERICAL AND STATISTICAL COMPUTING (MCA-202-CR)

8.7 Taylor s Inequality Math 2300 Section 005 Calculus II. f(x) = ln(1 + x) f(0) = 0

Nonlinear Equations. Not guaranteed to have any real solutions, but generally do for astrophysical problems.

Math 131. Rolle s and Mean Value Theorems Larson Section 3.2

INVERSE FUNCTION THEOREM and SURFACES IN R n

INFINITE SEQUENCES AND SERIES

Chapter 1 Mathematical Preliminaries and Error Analysis

Contraction Mappings Consider the equation

Calculus. Mathematics FRDIS. Mendel university in Brno

MATH 2400: PRACTICE PROBLEMS FOR EXAM 1

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

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

CS 450 Numerical Analysis. Chapter 5: Nonlinear Equations

Transcription:

Numerical Analysis: Solving Nonlinear Equations Mirko Navara http://cmp.felk.cvut.cz/ navara/ Center for Machine Perception, Department of Cybernetics, FEE, CTU Karlovo náměstí, building G, office 104a http://math.feld.cvut.cz/nemecek/nummet.html November 10, 2014 Task: Find a real solution to the equation f(x) = 0, where f is a continuous real function at interval [a 0, b 0 ]. More specification is needed: Task: Find a real solution to the equation f(x) = 0, where f is a continuous real function at interval [a 0, b 0 ]. We assume that f(a 0 ) f(b 0 ) < 0 (i.e., f(a 0 ), f(b 0 ) have the opposite signs) and f has exactly one root, x, at interval [a 0, b 0 ]. The required precision of the solution is ε > 0, i.e., we have to find a value in the interval [x ε, x + ε]. The first step is the separation of roots, which is not algorithmizable. x i = a i + b i 2 if f(x i ) f(a i ) < 0, then a i+1 = a i, b i+1 = x i, if f(x i ) f(b i ) < 0, then a i+1 = x i, b i+1 = b i, if f(x i ) = 0, then x = x i. b i a i Ending condition: ε 2 It always converges with a constant speed, approx. 3 decimal places in 10 iterations. We divide the interval [a i, b i ] in proportion f(a i) f(b i ) : x i a i = f(a i) x i b i f(b i ) x i = a if(b i ) b i f(a i ) f(b i ) f(a i ) 1

Typically, one endpoint remains unchanged (e.g., if f does not change its sign). b i a i 0 lim (b i a i ) { x a j, x b j : j N 0 } i Ending condition: f(x i ) δ Evaluate the Taylor series of function f with center x i at x: for some θ i I(x i, x) If m 1 > 0 x I(x i, x) : m 1 f (x), for absolute values we get f(x) = f(x i ) + (x x i ) f (θ i ) }{{} 0 x x i = f(x i) f (θ i ) f(x i) m 1 Theorem: Let f have a continuous derivative at interval I(x i, x) and m 1 > 0 x I(x i, x) : m 1 f (x). Then f(x i) m 1 δ m 1 The theorem cannot be used if the derivative does not exist or the root is multiple. (The method can still be applicable.) Regula falsi converges faster if the given function is approximately linear (in a neighborhood of the root). 2

Modification of regula falsi: We always continue with the last two points, independently of the signs: x 0 = b 0, x 1 = a 0 x i = x i 2f(x i 1 ) x i 1 f(x i 2 ) f(x i 1 ) f(x i 2 ) Ending condition: f(x i ) δ or x i x i 1 η The convergence is usually faster, but it is not guaranteed. Methods single-point double-point multiple-point Tangent to the graph of function f at ( x i 1, f(x i 1 ) ) : x i is its zero point (root): t i 1 (x) = f(x i 1 ) + (x x i 1 ) f (x i 1 ) x i = x i 1 f(x i 1) f (x i 1 ) It assumes the existence of a known first derivative; it is necessary to fix overlow and division by zero. Ending condition: f(x i ) δ or x i x i 1 η The convergence is usually faster, but it is not guaranteed. Evaluate the Taylor series of function f with center x i 1 at x i : f(x i ) = f(x i 1 ) + (x i x i 1 ) f (x i 1 ) + 1 }{{} 2 (x i x i 1 ) 2 f (ξ i ) 0 where ξ i I(x i, x i 1 ). Substitute in the universal estimate of the error: If there are estimates x x i = f(x i) f (θ i ) = f (ξ i ) 2f (θ i ) (x i x i 1 ) 2 M 2 x I(x i, x) : f (x) M 2 m 1 > 0 x I(x i, x i 1 ) : f (x) m 1 then we obtain (for absolute values) M 2 (x i x i 1 ) 2 3

Theorem: Let x be a simple root of function f, which has a continuous second derivative at interval I(x i, x i 1, x) (where x i is the result of one step of Newton s method applied to the estimate x i 1 ). Let there exist real numbers M 2, m 1 > 0 such that Then we have an estimate of the error x I(x i, x) : f (x) m 1 x I(x i, x i 1 ) : f (x) M 2 M 2 (x i x i 1 ) 2 Corollary: When the ending condition x i x i 1 η is satisfied, we get an estimate of the error M 2 η 2 Simple rule: If Newton s method converges and the approximation is near the root, the number of valid digits behind the decimal point doubles in each iteration. Correction: If the error is much smaller than 1 and absolute values of the first two derivatives of f are approximately the same, then we may neglect the factor M2 and the latter rule is valid because (x i x i 1 ) 2 (x x i 1 ) 2. However, if the proportion M2 is much different from 1, the rule cannot be used. Not guaranteed, in particular for a bad initial estimate. Assumption: Function f has a continuous second derivative in a neighborhood of a simple root x. Then f (x) 0 and f is continuous in a neighborhood of x we can find a neighborhood I of point x such that m 1 > 0 x I : f (x) m 1 M 2 x I : f (x) M 2 Let x i 1 I \ {x}. We evaluate the Taylor series of function f with center x i 1 at x: where ξ i I(x, x i 1 ). Subtract For x i 1 sufficiently close to x: f(x) = f(x i 1 ) + (x x i 1 ) f (x i 1 ) + 1 }{{} 2 (x x i 1) 2 f (ξ i ), 0 0 = f(x i 1 ) + (x i x i 1 ) f (x i 1 ) 0 = (x x i ) f (x i 1 ) + 1 2 (x x i 1) 2 f (ξ i ) x x i (x x i 1 ) 2 = f (ξ i ) 2f (x i 1 ) (x x i 1 ) 2 M 2 x x i 1 M 2 x x i 1 M 2 x x i 1 q x x i 1 q for some (fixed) q < 1, i.e., the error is reduced at least by a factor q in one iteration and the method converges. Theorem: Let f have a continuous second derivative in a neighborhood of a simple root x. Then Newton s method converges in some neighborhood of the root x. 4

Alternative: Numerical approximation of the derivative as a part of the method. We avoid the need of additional evaluations of the function by using the last two computed values, f(x i 1 ), f(x i 2 ); the derivative (=the slope of the tangent) is approximated by the slope of the secant: f (x i 1 ) f(x i 1) f(x i 2 ) x i 1 x i 2 x i = f(x i 1 ) x i 1 f(x i 1 ) f(x i 2 ) x i 1 x i 2 = x i 2f(x i 1 ) x i 1 f(x i 2 ) f(x i 1 ) f(x i 2 ) This is nothing new but the secant method (but the idea was good). Definition: Let a method solving the equation f(x) = 0 produce a sequence of approximations x i, i N, converging to a root x. Then the order of the method is a number p such that the limit exists and it is finite and nonzero. x x i lim i x x i x x i 1 p For smaller p, x x i 1 0. For bigger p, p and nonzero; this value is the order of the method. x x i 1 p method order condition bisection undef. ( 1) regula falsi 1 the second derivative does not change its sign secant (1 + 5)/2 simple root Newton s 2 simple root Equation f(x) = 0 can be tranformed to an equivalent form ϕ(x) = x, e.g., by taking ϕ(x) = f(x) + x Initial estimate x 0, x i = ϕ(x i 1 ). Ending condition:. For at most one p the limit exists and it is finite x i x i 1 < η. Proposition: If the iteration method converges to x where ϕ is continuous, then ϕ( x) = x, f( x) = 0. Proof: ( ) ϕ( x) = ϕ lim x i = lim ϕ(x i ) = lim x i+1 = lim x i = x. i i i i Find the least positive solution to the equation f(x) = 0, where f(x) = x cot x. f( π 4 ) = π 4 1 < 0, f( π 2 ) = π 2 > 0 x ( π 4, π 2 ) Choose ϕ(x) = λf(x) + x, where λ 0; ending condition for η = 0.001. We shall try λ { 0.2, 0.2, 0.65, 0.8}. x i+1 = 0.8 x i + 0.2 cot x i, x i+1 = 1.2 x i 0.2 cot x i, x 0 = 1.5, x 0 = 0.88 converges monotonically diverges monotonically 5

x i+1 = 0.35 x i + 0.65 cot x i, x i+1 = 0.2 x i + 0.8 cot x i, x 0 = 1.5, x 0 = 0.88, converges non-monotonically diverges non-monotonically Definition: A function ϕ is called contractive at interval I (with coefficient q) if q < 1 u, v I : ϕ(u) ϕ(v) q u v. contractivity continuity Theorem: (Sufficient condition for contractivity) Let function ϕ have a continuous derivative at interval I and let there exist q < 1 such that x I : ϕ (x) q. Then ϕ is contractive at I with coefficient q. Proof: ϕ(u) ϕ(v) = u v u ϕ (x) dx ϕ (x) dx v u v q dx = q u v. Theorem: (Banach fixed point theorem for a real function) Let ϕ be a function contractive at a closed interval I = [a, b] with coefficient q < 1 and let ϕ map I into I. Then the equation ϕ(x) = x as a unique solution, x, at interval I. This solution is the limit of the iteration method with an arbitrary initial value x 0 I and the following estimate of the error holds: q 1 q x i x i 1. Proof: Existence of the solution: ϕ maps I into I ψ(x) = ϕ(x) x is ψ non-negative at a and non-positive at b; it is continuous, hence it has a root in I, which is a solution to the equation ϕ(x) = x. Uniqueness of the solution: Assume that x I is another solution. Then Convergence of the iteration method to the solution: Estimate of the error: x x = ϕ(x) ϕ(x) q x x x = x = ϕ(x) ϕ(x i 1 ) q x x i 1... q i x x 0 0 q x x i 1 = q (x x i ) + (x i x i 1 ) q + q x i x i 1 q 1 q x i x i 1 6

How to transform the equations f(x) = 0 to an equivalent form ϕ(x) = x such that the iteration method converges fast? Possible solution: ϕ(x) = x + λf(x), where λ 0 and is small. ϕ (x) = 1 + λf (x) Example: (continued) f (x) = 2 + cot 2 x [2, 3] λ [ 1 2, 1 3 ] 1/f (0.86) 0.365 λ = 0.365 ϕ(x) = 0.635 x + 0.365 cot x. x i+1 = 0.635 x i + 0.365 cot x i, x 0 = 1.5 converges monotonically and fast Theorem: Let the iteration method converge to x. Let p be the least natural number such that ϕ (p) (x) 0, and let ϕ (p) be continuous in some neighborhood of x. Then the order of the iteration method is p. Proof: Evaluate the Taylor series of function ϕ with center x at x i 1 : ϕ(x i 1 ) = ϕ(x) + 1 p! (x i 1 x) p ϕ (p) (ξ i 1 ), where ξ i 1 I(x, x i 1 ), x i = x + 1 p! (x i 1 x) p ϕ (p) (ξ i 1 ), x x i 1 p = 1 p! ϕ(p) (ξ i 1 ) 1 p! ϕ(p) (x) (0, + ). Comment: Usually ϕ (x) 0, hence the iteration method is of order 1. However, this is not a rule, e.g., Newton s method is a special case of the iteration method. Idea: In each iteration, choose a new coefficient λ i so that ϕ (x i ) = 0, i.e. We get λ i = 1 f (x i ), x i+1 = x i + λ i f(x i ) = x i f(x i) f (x i ), which is Newton s method (as a special case of the iteration method); this is usually of order 2, while the iteration method is usually of order 1. 7

x i+1 = x i f(xi) f (x i), x 0 = 1.5 converges non-monotonically and fast single-point, e.g., iteration method (which is in a sense a universal single-point method), Newton s method, double-point, e.g., bisection, regula falsi, secant method, multiple-point. From the programmer s point of view: not requiring the derivative, e.g., bisection, regula falsi, secant method, and usually iteration method (depending on the iterative formula), requiring the first derivative, e.g., Newton s method, requiring higher-order derivatives. According to convergence, we divide the methods to always convergent, e.g., bisection and regula falsi, others, e.g., Newton s, secant, and iteration method. In a neighborhood of a root of an even multiplicity, the function does not change its sign, hence bisection and regula falsi cannot be used. Secant and Newton s method are applicable to the computation of multiple roots, but in this case their convergence is only of the first order. In the iteration method, only the iterative formula, not the multiplicity of the root in the original equation, is important. Method 1: Find all roots of function f and test whether some of them is a root of function f. At roots of f of an even multiplicity, f has a root of an odd multiplicity and changes its sign. Method 2: Consider the function h(x) = f(x) f (x) (where removable discontinuities are removed ). Proposition: Let x be a root of function f of multiplicity k, such that in its neighborhood f has a continuous derivative of order k. Then x is a simple root of function h = f/f. Proof: The definition of a root of multiplicity k says that f (j) (x) = 0 if j < k and f (k) (x) 0. Repeated application of l Hospital s rule results in a nonzero limit lim x x f(x) (x x) k = lim x x f (x) f (k) (x) =... = lim 0. k (x x) k 1 x x k! Thus the proportion of the first two expressions is defined and equal to 1, which implies the limit of h lim x x f(x) k (x x)k 1 (x x) k f = 1, (x) lim x x h(x) x x = 1 k 0. In the latter limit, the denominator converges to zero and so does the numerator, hence lim x x h(x) = 0 and x is a root of function h. According to l Hospital s rule, also lim x x h (x) is nonzero, hence x is a simple root of function h. 8

If function f has only roots of finite multiplicities, then function h has the same roots, but simple (however, h is usually not continuous). Special case of equation f(x) = 0, where f is a polynomial. Theorem: (Estimate of the position of the roots of a polynomial) The absolute value of all (complex) roots of the equation n a i x i = 0 is at most i=0 1 + max( a 0,..., a n 1 ) a n. Bisection and regula falsi depend on the total order of reals not useful for higher dimensions. The secant and Newton s method are applicable. Complex roots can be found only for initial estimates with a nonzero imaginary part. Newton s method can be generalized to systems of equations; the Jacobian plays the role of a derivative and instead of division, multiplication by an inverse matrix is needed. This causes higher complexity and problems with singularities. The conditions of convergence are more complex than in the one-dimensional case. The iterative method is applicable; it may by difficult to maintain contractivity. Because of problems with convergence, other methods were suggested which work on different principles not used in the one-dimensional case. 9