Numerical Analysis 7th Edition Burden
Numerical Analysis 7th Edition Burden
4 digits of precision, a minimum exponent emin, and a maximum exponent emax. Then the set of floating-point numbers in this machine consists of 0 and the numbers of the form x= f-10%, where f= +(f107'+ fyl0? +--- + F109, where 1 < fi <9 and0< fi <9, foreach i = 2,... ,1, and where emin < € = emax: ‘These constraints imply that the smallest positive number represented in the machine is o = 10°""=!, so any computed number x with |x| < o causes underflow and results in x being set to 0. The largest positive number is 2. = (1 — 10!) 10°", and any com- puted number x with |x| > A causes overflow. When underflow occurs, the program will continue, often without a significant loss of accuracy. If overflow occurs, the program will fail The algorithm assumes that the floating-point characteristics of the machine are de~ scribed using parameters N, s, S, y, and Y. The maximum number of entries that can be summed with at least t/2 digits of accuracy is given by N. This implies the algorithm will proceed to find the norm of a vector x = (1, X2,... ,%,)! only ifm = N. To resolve the underflow-overflow problem, the nonzero floating-point numbers are partitioned into three groups: small-magnitude numbers x, those satisfying 0 < |x| < y; medium-magnitude numbers x, where y < |x| < ¥; and large-magnitude numbers x, where ¥ < |x|. The parameters y and Y are chosen so that there will be no underflow-overflow problem in squaring and summing the medium-magnitude numbers. Squaring small-magnitude num- bers can cause underflow, so a scale factor S much greater than 1 is used with the result that (Sx)? avoids the underflow even when x? does not. Summing and squaring numbers having a large magnitude can cause overflow, so in this case, a positive scale factor s much smaller than 1 is used to ensure that (sx)? does not cause overflow when calculated or incorporated into a sum, even though x? would. To avoid unnecessary scaling, y and Y are chosen so that the range of medium- magnitude numbers is as large as possible. The algorithm that follows is a modification42 CHAPTER 1 + Mathematical Preliminaries of one described in (Brow, W, p. 471]. It incorporates a procedure for scaling the compo- nents of the vector that are small in magnitude until a component with medium magnitude is encountered. It then unscales the previous sum and continues by squaring and summing small and medium numbers until a component with a large magnitude is encountered. Once a component with large magnitude appears, the algorithm scales the previous sum and pro- ceeds to scale, square, and sum the remaining numbers. The algorithm assumes that, in transition from small to medium numbers, unscaled small numbers are negligible when compared to medium numbers. Similarly, in transition from medium to large numbers, un- scaled medium numbers are negligible when compared to large numbers. Thus, the choices of the scaling parameters must be made so that numbers are equated to 0 only when they are truly negligible. Typical relationships between the machine characteristics as described by t,.0,, emin, emax, and the algorithm parameters Ns, S, y, and ¥ are given after the algorithm. ‘The algorithm uses three flags to indicate the various stages in the summation process. These flags are given initial values in Step 3 of the algorithm. FLAG 1 is I until a medium of large component is encountered; then it is changed to 0. FLAG 2 is 0 while small num bers are being summed, changes to 1 when a medium number is first encountered, and changes back to 0 when a large number is found. FLAG 3 is initially 0 and changes to 1 when a large number is first encountered. Step 3 also introduces the flag DONE, which is O until the calculations are complete, and then changes to 1 INPUT Ny s,S. 9, ¥odsm tis tases on OUTPUT NORM or an appropriate error message. Step 1 ifn <0 then OUTPUT (‘The integer n must be positive”); STOP, Step 2. Ifn > N then OUTPUT (‘The integer n is too large."); STOP, Step 3 Set SUM = 0; FLAGL (The small numbers are being summed.) FLAG2 FLAG3 DONE i=l Step 4 While (in then set NORM = (SUM)'/S; DONE =1 else set SUM = (SUM/S)/S; (Scale for larger numbers.) FLAG2 Step 7 While (i m then set NORM DONE else set SUM FLAG3 (suM)'”, (SUM)s)s; (Scale the large numbers.) Step 10 While (i < n and FLAG3 = 1) do Step II. Step 11 Set SUM = SUM +(sx,)*; (Sum the large numbers.) i= +1 Step 12. If DONE =0 then if SUM"? < 4s then set NORM DONE else set SUM (The norm is too large.) Step 13 If DONE = 1 then OUTPUT (‘Norm is’, NORM) else OUTPUT (‘Norm >", NORM, ‘overflow occurred’). = (SUM)"7/s; Step 14 STOP. The relationships between the machine characteristics 1, 0, 2, emin, emax, and the algorithm parameters N, 5, S, y, and ¥ were chosen in [Brow, W, p. 471] as: N= 10%, where ey = [(¢ ~2)/2), _ the greatest imteger less than or equal to (f= 2)/2 10%, where e, = |—(emax + ey)/2]; s S= 10°, where es = [(1—emin)/2], the smallest integer greater than or equal to (I~ emin)/2; y= 10%, where ey = [(emin +1 ~ 2)/21; Y=10%, where ey = [(emax ~ ey)/2] The reliability built into this algorithm has greatly increased the complexity compared to the algorithm given earlier in the section. There are many forms of general-purpose numerical software available commercially and in the public domain. Most of the early software was written for mainframe computers, and a good reference for this is Sources and Development of Mathematical Software, edited by Wayne Cowell [Co]. Now that the desktop computer has become sufficiently powerful, standard numerical software is available for personal computers and workstations. Most of this numerical software is written in FORTRAN, although some packages are written in C, (C++, and FORTRANSO. ALGOL procedures were presented for matrix computations in 1971 in [WR]. A pack- age of FORTRAN subroutines based mainly on the ALGOL procedures was then devel- oped into the EISPACK routines. These routines are documented in the manuals publishedCHAPTER 1 = Mathematical Preliminaries by Springer-Verlag as part of their Lecture Notes in Computer Science series [Sm,B] and [Gar]. The FORTRAN subroutines are used to compute eigenvalues and eigenvectors for a variety of different types of matrices. The EISPACK project was the first large-scale numerical software package to be made available in the public domain and led the way for many packages to follow. EISPACK is maintained by netlib and can be found on the Internet at bttp://www.netlib.org/eispack. LINPACK is a package of FORTRAN subroutines for analyzing and solving systems of linear equations and solving linear least squares problems. The documentation for this, package is contained in [DBMS] and located at hutp://www.netlib.org/linpack. A step-by- step introduction to LINPACK, EISPACK, and BLAS (Basic Linear Algebra Subprograms) is given in (CV). ‘The LAPACK package, first available in 1992, is a library of FORTRAN subroutines that supercedes LINPACK and EISPACK by integrating these two sets of algorithms into a unified and updated package. The software has been restructured to achieve greater ef- ficiency on vector processors and other high-performance or shared-memory multipro- cessors. LAPACK is expanded in depth and breadth in version 3.0, which is available in FORTRAN, FORTRAN9O, C, C++, and JAVA. FORTRAN90, C, and JAVA are only available as language interfaces or translations of the FORTRAN libraries of LAPACK. ‘The package BLAS is not a part of LAPACK, but the code for BLAS is distributed with LAPACK. The LAPACK User's Guide, 3rd ed. [An] is available from SIAM or on the Internet at http://www.netlib.org/lapack/Iug/lapack Jug.html. The complete LAPACK or individual routines from LAPACK can be obtained through netlib at netlibornl.gov, netli- bresearch.att.com, or http://www.netlib.org/lapack. Other packages for solving specific types of problems are available in the public do- main. Information about these programs can be obtained through electronic mail by send- ing the line “help” to one of the following addresses: netlibresearch att.com, netlibornl.gov, netlibnac.no, or netlibdraci.cs.uow.edu.au or to the wucp address wunet!research!netlib. As an alternative to netlib, you can use Xnetlib to search the database and retrieve software. More information can be found in the article Software Distribution using Netlib by Don- garra, Roman, and Wade [DRW] These software packages are highly efficient, accurate, and reliable. They are thor- oughly tested, and documentation is readily available. Although the packages are portable, it is a good idea to investigate the machine dependence and read the documentation thor- oughly. The programs test for almost all special contingencies that might result in error and failures, At the end of each chapter we will discuss some of the appropriate general- purpose packages. ‘Commercially available packages also represent the state of the art in numerical meth- ods. Their contents are often based on the public-domain packages but include methods in libraries for almost every type of problem. IMSL (Intemational Mathematical and Statistical Libraries) consists of the libraries MATH, STAT, and SFUN for numerical mathematics, statistics, and special functions, re- spectively. These libraries contain more than 900 subroutines originally available in FOR- ‘TRAN 77 and now available in C, FORTRAN90, and JAVA. These subroutines solve the most common numerical analysis problems. In 1970 IMSL became the first large-scale scientific library for mainframes. Since that time, the libraries have been made available for computer systems ranging from supercomputers to personal computers. The libraries are available commercially from Visual Numerics, 9990 Richmond Ave $400, Houston,1.4 Numerical software 45 ‘TX 77042-4548, with Intemet address http://www.vni.com. The packages are delivered in compiled form with extensive documentation. There is an example program for each routine as well as background reference information. IMSL contains methods for linear systems, eigensystem analysis, interpolation and approximation, integration and differen- tiation, differential equations, transforms, nonlinear equations, optimization, and basic ma- trix/vector operations. The library also contains extensive statistical routines. The Numerical Algorithms Group (NAG) has been in existence in the United Kingdom since 1970. NAG offers more than 1000 subroutines in a FORTRAN 77 library, about 400 subroutines in a C library, over 200 subroutines in 2 FORTRAN 90 library, and an ‘MPI FORTRAN numerical library for parallel machines and clusters of workstations or personal computers. A subset of their FORTRAN 77 library (the NAG Foundation Library) is available for personal computers and workstations where work space is limited. The NAG C Library, the FORTRAN 90 library, and the MPI FORTRAN library offer many of the same routines as the FORTRAN Library. The NAG user's manual includes instructions and examples, along with sample output for each of the routines. A useful introduction to the NAG routines is {Ph}. The NAG library contains routines to perform most standard numerical analysis tasks in 2 manner similar to those in the IMSL. It also includes some statistical routines and a set of graphic routines. The library is commercially available from Numerical Algorithms Group, Inc., 1400 Opus Place, Suite 200, Downers Grove, IL 60515-5702, with Internet address http://www-nag.com. ‘The IMSL and NAG packages are designed for the mathematician, scientist, or engi- neer who wishes to call high-quality FORTRAN subroutines from within a program. The documentation available with the commercial packages illustrates the typical driver pro- ‘gram required to use the library routines. The next three software packages are stand-alone environments. When activated, the user enters commands to cause the package to solve a problem. However, each package allows programming within the command language. ‘MATLAB is a matrix laboratory that was originally a Fortran program published by Cleve Moler [Mo]. The laboratory is based mainly on the EISPACK and LINPACK subrou- tines, although functions such as nonlinear systems, numerical integration, cubic splines, curve fitting, optimization, ordinary differential equations, and graphical tools have been incorporated. MATLAB is currently written in C and assembler, and the PC version of this package requires a numeric coprocessor. The basic structure is to perform matrix opera- tions, such as finding the eigenvalues of a matrix entered from the command line or from an external file via function calls. This is a powerful self-contained system thet is especially useful for instruction in an applied linear algebra course. MATLAB has been available since 1985 and can be purchased from The MathWorks Inc., Cochituate Place, 24 Prime Park Way, Natick, MA 01760. The electronic mail address of The Mathworks is infomath- ‘works.com, and the Internet address is http://www.mathworks.com. MATLAB software is designed to run on many computers, including IBM PC compatibles, APPLE Macintosh, and SUN workstations. A student version of MATLAB does not require a coprocessor but will use one if it is available The second package is GAUSS, a mathematical and statistical system produced by Lee E. Ediefson and Samuel D. Jones in 1985. It is coded mainly in assembler and based primarily on EISPACK and LINPACK. As in the case of MATLAB, integra- tion/differentiation, nonlinear systems, fast Fourier transforms, and graphics are available. GAUSS is oriented less toward instruction in linear algebra and more toward statistical analysis of data. This package also uses a numeric coprocessor if one is available. It can46 CHAPTER 1 + Mathematical Preliminaries be purchased from Aptech Systems, Inc., 23804 S.E. Kent-Kangley Road, Maple Valley, WA 98038 (infoaptech.com). ‘The third package is Maple, a computer algebra system developed in 1980 by the ‘Symbolic Computational Group at the University of Waterloo. The design for the orig- inal Maple system is presented in the paper by B.W. Char, K.0. Geddes, W.M. Gen- tlemen, and G.H. Gonnet [CGGG]. Maple has been available since 1985 and can be purchased from Waterloo Maple Inc., 57 Etb Street, Waterloo, ON N21. 6C2. The elec- tronic mail address of Waterloo Maple is infomaplesoft.com, and the Internet address is hitp://www.maplesoft.com. Maple, which is written in C, has the ability to manipulate information in a symbolic manner. This symbolic manipulation allows the user to obtain exact answers instead of numerical values. Maple can give exact answers to mathematical problems such as integrals, differential equations, and linear systems. It contains a pro- gramming structure and permits text, as well as commands, to be saved in its worksheet files. These worksheets can then be loaded into Maple and the commands executed. Be- cause of the properties of symbolic computation, numerical computation, and worksheets, Maple is the language of choice for this text. Throughout the book Maple commands will ‘be embedded into the text. Numerous packages are available that can be classified as supercalculator packages for the PC. These should not be confused, however, with the general-purpose software listed here. If you have an interest in one of these packages, you should read Supercalculators on the PC by B. Simon and R, M. Wilson {SW}. Additional information about software and software libraries can be found in the books by Cody and Waite [CW] and by Kockler [Ko], and in the 1995 article by Dongarra and ‘Walker [DW]. More information about floating-point computation can be found in the book by Chaitini-Chatelin and Frayse [CF] and the article by Goldberg [Go]. Books that address the application of numerical techniques on parallel computers in- clude those by Schendell [Schel, Phillips and Freeman [PF], and Golub and Ortega [GO)CHAPTER 2 Solutions of Equations in One Variable The growth of a population can be modeled over short periods of time by assuming that the population grows continuously with time at a rate Proportional to the number present at that time. If we let N(é) denote the number at time ¢ and A denote the constant birth rate of the population, then the population satisfies the differential equation an eC ‘The solution to this equation is N(t) = Noe, where No denotes the initial population, PO) 3 uy = 1000 + 3 (es — 1) 1564 1435 Population (thousands) g Birth rate48 CHAPTER 2 = Solutions of Equations in One Variable ‘This exponential model is valid only when the population is isolated, with no immigration. If immigration is permitted at a constant rate v, then the differential equation becomes ano | Oe =ano+y, whose solution is No ae + 500% — 1). Suppose a certain population contains 1,000,000 individuals ini- tially, that 435,000 individuals immigrate into the community in the first year, and that 1,564,000 individuals are present at the end of one year. ‘To determine the birth rate of this population, we must solve for in the equation e*—1). 1,564,000 = 1,000,000¢* + Seem, ‘The numerical methods discussed in this chapter are used to approxi- ate solutions of equations of this type, when the exact solutions cannot be obtained by algebraic methods. The solution to this particular prob- lem is considered in Exercise 20 of Section 2.3. 1 The Bisection Method In this chapter, we consider one of the most basic problems of numerical approximation, the root-finding problem. This process involves finding a root, or solution, of an equation of the form f(x) = 0, fora given function f. A root of this equation is also called a zero of the function f. The problem of finding an approximation to the root of an equation can be traced back at least as far as 1700 B.C. A cuneiform table in the Yale Babylonian Collection dating from that period gives a sexigesimal (base-60) number equivalent to 1.414222 as an approximation to ¥/2, a result that is accurate to within 10-5. This approximation can be found by applying a technique described in Exercise 19 of Section 2.2 The first technique, based on the Intermediate Value Theorem, is called the Bisection, or Binary-search, method. Suppose f is a continuous function defined on the interval [a, 6}, with f(a) and f(b) of opposite sign. By the Intermediate Value Theorem, there exists a number p in (a, b) with f(p) = 0. Although the procedure will work when there is more than one root in the interval (a, b), we assume for simplicity that the root in this interval is unique. The method calls for a repeated halving of subintervals of [a, 6] and, at each step, locating the half containing p.Figure 2.1 2.1. The Bisection Method 49 To begin, set a, =a and b; = b, and let p; be the midpoint of [a, bj; that is, b-a +b raat ogo =S So If f(p:) = 0, then p = py, and we are done. If f(p:) # 0, then f(p1) has the same sign as either f(a;) or (by). When f(p,) and f(a)) have the same sign, p € (p1,51), and we set ay = p and by = by. When f(pi) and f (ay) have opposite signs, p € (a1, pi), and we set a) = a; and by = p,. We then reapply the process to the interval [az, b2]. This produces the method described in Algorithm 2.1. (See Figure 2.1.) Bisection ‘To find a solution to f (x) = 0 given the continuous function f on the interval (a, b], where f(a) and f(b) have opposite signs: INPUT endpoints a, b; tolerance TOL; maximum number of iterations No OUTPUT approximate solution p or message of failure. step 1 Seti =1; FA= f(a), Step 2 While i < No do Steps 3-6. Step 3 Set p=a+(b—a)/2; (Compute p,.) FP = f(p)50 CHAPTER 2 * Solutions of Equations in One Variable Step 4 If FP =O or (6 — a)/2 < TOL then OUTPUT (p); (Procedure completed successfully.) STOP. Step5 Seti=i+1 Step 6 If FA-FP > Othen seta =p; (Compute a;,bj.) FA= FP else set b = p. Step 7 OUTPUT (‘Method failed after No iterations, No (The procedure was unsuccessful.) STOP. . Other stopping procedures can be applied in Step 4 of Algorithm 2.1 or in any of the iterative techniques in this chapter. For example, we can select a tolerance ¢ > 0 and generate p1.... , pw until one of the following conditions is met: Ipw - Pw-il <€, Q1 \pw = Pw-i “a or Ife) <6. 23) Unfortunately, difficulties can arise using any of these stopping criteria, For example, there are sequences {p,}2. with the property that the differences p, — p»_1 converge to zero while the sequence itself diverges. (See Exercise 15.) Itis also possible for f(p,) to be close to zero while py differs significantly from p. (See Exercise 14.) Without additional knowledge about f or p, Inequality (2.2) is the best stopping criterion to apply because it comes closest to testing relative error. When using a computer to generate approximations. it is good practice to set an upper bound on the number of iterations. This will eliminate the possibility of entering an infinite loop, a situation that can arise when the sequence diverges (and also when the program is incorrectly coded). This was done in Step 2 of Algorithm 2.1 where the bound No was set and the procedure terminated if i > No. Note that to start the Bisection Algorithm, an interval (a, 6] must be found with f(a) - f(b) <0. At each step the length of the interval known to contain a zero of f is reduced by a factor of 2; hence it is advantageous to choose the initial interval {a, b) as small as possible, For example, if f(x) = 2x? — x? + x — 1, we have both f(-4)- FA) <0 and FO): f(D <0, so the Bisection Algorithm could be used on either of the intervals [—4, 4] or (0, 1]. Start- ing the Bisection Algorithm on [0, 1] instead of [~4, 4] will reduce by 3 the number of iterations required to achieve a specified accuracy.=XAMPLE 1 Table 2.1 2.1. The Bisection Method 51 The following example illustrates the Bisection Algorithm. The iteration in this exam- ple is terminated when the relative error is less than 0,0001; that is, when [P= Pal ig-4 \pl ‘The equation f(x) = x3 + 4x? — 10 = 0 has a root in [1,2] since f(1) = —5 and f(2) = 14. The Bisection Algorithm gives the values in Table 2.1. n a b, Pn S(Pn) 1 10 20 5 2375 2 10 1s 12s 1.79687 3 1.25 1s 1.375 0.16211 4 1.25 1375 13125 = 0.84839 s 13125 1375 1.34375 =0.35098 6 1.34375 1375 1.359375, ~0.09641 7 1.359375 1375 13671875 0.03236 8 1.359375 13671875 136328125 0.03215 9 1,36328125 13671875, 1,365234375 0.000072 10 1,36328125 1,365234375 1,364257813 0.01605 u 1.364257813 1,365234375 1364746004 =0.00799 12 1.364746094 1,365234375 1,364990235 0.00396 B 1.364990235 1.365234375 1365112305 0.00194 After 13 iterations, p13 = 1.365112305 approximates the root p with an error Ip — pisl < [bts — aya] = [1.365234375 — 1.365112305| = 0.000122070 Since Javai < |p|, Ip=pisl — Ipl fay so the approximation is correct to at least four significant digits. The correct value of p, to nine decimal places, is p = 1.365230013. Note that pe is closer to p than is the final approximation p;3. You might suspect this is true since | f(ps)| < |f(p13)}, but we cannot be sure of this unless the true answer is known, . The Bisection method, though conceptually clear, has significant drawbacks. It is slow to converge (that is, N may become quite large before |p ~ py| is sufficiently small), and a good intermediate approximation can be inadvertently discarded. However, the method has the important property that it always converges to a solution, and for that reason it is often used as a starter for the more efficient methods we will present later in this chapter.52 CHAPTER 2 + Solutions of Equations in One Vartable Theorem 2.1 Suppose that f ¢ C[a, b] and f(a)- f(b) < 0: The Bisection method generates a sequence {Pn}$2.; approximating a zero p of f with Since Its important to realize that Theorem 2.1 gives only a bound for approximation error and that this bound may be quite conservative. For example, this bound applied to the problem in Example 1 ensures only that 2-1 |p ~ pol = =2x 10%, but the actual error is much smaller: Ip — pol = |1.365230013 ~ 1.365234375| = 4.4 x 1076. EXAMPLE 2 ‘To determine the number of iterations necessary to solve f(x) = x? + 4x? — 10 = 0 with accuracy 10~ using a; = | and b; = 2 requires finding an integer N that satisfies *< 107. Ipw ~ pl <2-"(b—a) ‘To determine N we will use logarithms. Although logarithms to any base would suf- fice, we will use base-10 logarithms since the tolerance is given as a power of 10. Since 2-" < 10-3 implies that logyg2~™ < logy 10~? = —3, we have =Nlogip2<—3 and N> 9.96. Togio2 Hence, ten iterations will ensure an approximation accurate to within 10-3. Table 2.1 on page 51 shows that the value of py = 1.365234375 is accurate to within 10~*. Again, it2.1 The Bisection Method 53 is important to keep in mind that the error analysis gives only a bound for the number of iterations, and in many cases this bound is much larger than the actual number required. . The bound for the number of iterations for the Bisection method assumes that the calculations are performed using infinite-digit arithmetic. When implementing the method on a computer, consideration must be given to the effects of roundoff error. For example, the computation of the midpoint of the interval [4,, b,] should be found from the equation bn = Gn instead of from the algebraically equivalent equation ay thy The first equation adds a small correction, (b, — aq)/2, to the known value a,. When bq — ay is near the maximum precision of the machine this correction might be in error, but the error would not significantly affect the computed value of p,. However, when by — dy is near the maximum precision of the machine, it is possible for (ay + b,)/2 to return a midpoint that is not even in the interval (ay, b,]- Asa final remark, to determine which subinterval of [¢,, by] contains a root of f, itis better to make use of the signum function, which is defined as -1, ifx <0, sen) = 40, ifx 1, ifx>0. ‘The test sgn (f(@n)) sgn (f(Pn)) <0 — insteadof —f (an) f (Pn) < 0 gives the same result but avoids the possibility of overflow or underflow in the multiplica- tion of f (aq) and f (pn). | SSS SSS EXERCISE SET 2.1 1. Use the Bisection method to find ps for f(x) = J¥ — cos x on (0, 1) 2. Let f(x) = 3(x + 1) — 4)(x — 1). Use the Bisection method on the following intervals to find ps a [-2,15] be [-1.25,25] 3. Use the Bisection method to find solutions accurate to within 10"? for x? — 7x4 14x ~6 =0 on each interval. a (0,1) Bb (1,32) ce 3.2.4)54 CHAPTER 2 = Solutions of Equationsin One Variable 4 9%. 10. we 2 B. 14, 18. 16. a7. Use the Bisection method to find solutions accurate to within 10°? for x* — 2x? — 4x7 + 4x + 4 = Oon each interval. a [-2,-1] 10,2) © 23) a (-1,0) Use the Bisection method to find a solution accurate to within 10"? for x = tan.x on [4, 4.5]. Use the Bisection method to find a solution accurate to within 10-? for 2-+cos(e* —2)~e on 0.5, 1.5}. Use the Bisection method to find solutions accurate to within 10° for the following problems. a x-2%=0 for0 1 but that |p — ql < 10°? requires that n > 1000. Let (p,} be the sequence defined by p, = Yj. ¢- Show that (p,)} diverges even though Timy-sso(Px ~ Pr-1) =0. ‘The function defined by f(x) = sinsrx has zeros at every integer. Show that when —1 2 @ 1, if atb=2 A trough of length Z has a cross section in the shape of a semicircle with radius r (See the accompanying figure.) When filled with water to within a distance h of the top, the volume V of water is V=L[0.Smr? —r? aresin(h/r) — her? — 2)" =~:2.2 Fixed-Point iteration 55 Suppose Z = 10 ft,r = 1 ft, and ¥ = 12.4 1°. Find the depth of water in the tough to within 0.01 ft 18. A particle starts at rest on a smooth inclined plane whose angle @ is changing at a constant rate 49 Fae<0 ‘Atte end of seconds, the position ofthe object i given by xoe-35 ( - snes) 2 Suppose the particle has moved 1.7 ft in 1 s. Find, to within 10°, the rate « at which @ changes. Assume that g = 32.17 fus?. 2 2.2. Fixed-Point Iteration EXAMPLE 1 ‘A number p is a fixed point for a given function g if g(p) = p. In this section we consider the problem of finding solutions to fixed-point problems and the connection between the fixed-point problems and the root-finding problems we wish to solve. Root-finding problems and fixed-point problems are equivalent classes in the follow- ing sense: Given a root-finding problem f(p) = 0, we can define functions g with a fixed point at p in a number of ways, for example, as g(x) = x — f(x) or as g(x) = x +3f (x). Conversely, if the function g has a fixed point at p, then the function defined by f(x) x — g(x) has a zero at p. Although the problems we wish to solve are in the root-finding form, the fixed-point form is easier to analyze, and certain fixed-point choices lead to very powerful root-finding techniques. We first need to become comfortable with this new type of problem and to decide when a function has a fixed point and how the fixed points can be approximated to within a specified accuracy. ‘The function g(x) =x? — 2, for -2 < x < 3, has fixed points at x = —1 and x = 2 since a(-I)=(-1?-2=-1 and g(2)=2?-2=2. ‘This can be seen in Figure 2.2. .56 CHAPTER 2 = Solutions of Equations in One Variable Figure 22 ‘The following theorem gives sufficient conditions for the existence and uniqueness of a fixed point. Theorem 2.2 a. If g € C[a,b] and g(x) € [a,b] for all x € [a, 6), then g has a fixed point in (a,b). b. If, in addition, g’ (x) exists on (a, b) and a positive constant k < 1 exists with Is'@)| sk, forall x € (a,b), then the fixed point in {a, 5] is unique. (See Figure 2.3.) .EXAMPLE 2 2.2. Fixed-Point iteration 57 Proof a If g(a) = a or g(b) = b, then g has a fixed point at an endpoint. If not, then (a) > a and g(b) < b, The function h(x) = g(x) — x is continuous on [a, b], with h(a) ‘The Intermediate Value Theorem implies that there exists p € (a,b) for which ‘h(p) = 0. This number p is a fixed point for g since (a)—a>0 and h(b) = g(b)—b <0. O=h(p) = g(p) ~ p_ implies that g(p) = p. ‘Suppose, in addition, that |g’(x)| < k < 1 and that p and q are both fixed points in (a, b]. If p # q, then the Mean Value Theorem implies that a number & exists between p and q, and hence in (a, 6], with EP 2@) _ 9) Thus, Ip ~ 41 = Ie(P) — g@)l = Is’ @)llp — 41 Skip — 41 < |p al, which is a contradiction. This contradiction must come from the only supposition, P #4q.Hence, p = q and the fixed point in [a, 6] is unique. wae Let g(x) = (2? — 1)/3 on [-1, 1. The Extreme Value Theorem implies that the absolute minimum of g occurs at x = 0 and g(0) = —4. Similarly, the absolute maximum of g occurs at x = +1 and has the value g(:1) = 0. Moreover, ¢ is continuous and for all x € (=I, 1) So g satisfies all the hypotheses of Theorem 2.2 and has a unique fixed point in (-1, 1, In this example, the unique fixed point p in the interval (—1, 1} can be deter- mined algebraically. If P=s8(p) , then p? which, by the quadratic formula, implies that P 30 - V1). Note that g also has a unique fixed point p = 4(3 + V3) for the interval (3, 4]. However, ¢(4) = Sand g’(4) = § > 1, so g does not satisfy the hypotheses of Theorem 2.2 on [3, 4]. Hence, the hypotheses of Theorem 2.2 are sufficient to guarantee a unique fixed point but are not necessary. (See Figure 2.4.)58 CHAPTER 2 = Solutions of Equations in One Variable Figure 2.4 b. Let g(x) = 37%. Since '(x) = ing on [0, 1]. So 3-* In3 < Oon (0, 1], the function g is decreas- a= ; Sa(x)s1=8(0), for O 1. If the sequence converges to p and g is continuous, then P= lim, pe = im, g(Pra) = 8 (im, Pri) = 800), and a solution to x = g(x) is obtained. This technique is called fixed-point iteration, or functional iteration. The procedure is detailed in Algorithm 2.2 and illustrated in Figure 2.6. Figure 2.6 Pa= stp) (PoP) ps= a(n) emp) Pim apo) Pi= ato) (rw) Pi Ps Ps Po x mM Pe * @ © perms Fixed-Point Iteration pd To find a solution to p = g(p) given an initial approximation po: INPUT initial approximation po; tolerance TOL; maximum number of iterations No OUTPUT approximate solution p or message of failure. Step 1 Seti =1. Step 2 While i < No do Steps 3-6. Step 3 Set p= (po). (Compute pi.) Step 4 If |p — po| < TOL then OUTPUT (p); (The procedure was successful.)60 EXAMPLE 3 CHAPTER 2 + Solutions of Equations in One Variable STOP. Step 5 Seti +1 Step 6 Set py = p. (Update po.) Step 7 OUTPUT (‘The method failed after No iterations, Ny =’, No); (The procedure was unsuccessful.) STOP. . ‘The following example illustrates functional iteration, ‘The equation x3 +4x? — 10 = O has a unique root in [1, 2]. There are many ways to change the equation to the fixed-point form x = g(x) using simple algebraic manipulation. For example, to obtain the function g described in part (c), we can manipulate the equation x? + 4x? — 10 = 0as follows: 3 47=10-2°, so v= lao-2), and x +300 =2)2, To obtain a positive solution, g3(x) is chosen. It is not important to derive the functions shown here, but you should verify that the fixed point of each is actually a solution to the original equation, x? + 4x? — 10 = 0. —47 +10 a xa gi(t)ax— » sae) =(!-«) x= a0) = 300 = 8)2 10 \'? a x= gx) = vane =(_") reper teen 10 ES BOS 3x? + Be With py = 1.5, Table 2.2 lists the results of the fixed-point iteration for all five choices ofg. ‘The actual root is 1.365230013, as was noted in Example 1 of Section 2.1. Comparing the results to the Bisection Algorithm given in that example, it can be seen that excellent results have been obtained for choices (c), (d), and (e), since the Bisection method requires, 27 iterations for this accuracy. Itis interesting to note that choice (a) was divergent and that (b) became undefined because it involved the square root of a negative number. . Even though the various functions in Example 3 are fixed-point problems for the same root-finding problem, they differ vastly as techniques for approximating the solution toTable 22 Theorem 2.3 2.2. Fixed-Point iteration a1 n @ ®) © @ © o 1s 15 1s 1S Ls 1 0.875 0.8165 1,286953768 —‘1.348399725—1.373333333 2 6732 2.9969 1,402540804 ——1,367376372 ——_‘1.365262015 3 469.7 (-8.65)" 1.345458374 ——_1.364957015 1,365230014 4 1.03 x 108 1.375170253‘1.365264748——_‘1.365230013 5 1,360094193, 1,365225594 6 1,367846968 ——_‘1.365230576 7 1.363887004 ——_—1.365229942 8 1.365916734 ——_‘1.365230022 9 1,364878217—_1.365230012 10 1.365410062—_1.365230014 15 1,365223680 —_1.365230013 20 1,365230236 25 1.365230006 30 1.365230013 the root-finding problem. Their purpose is to illustrate the true question that needs to be answered: How can we find a fixed-point problem that produces a sequence that reliably and rapidly converges to a solution to a given root-finding problem? ‘The following theorem and its corollary give us some clues concerning the paths we should pursue and, perhaps more importantly, some we should reject. (Fixed-Point Theorem) Let g € Cla, b] be such that g(x) € [a, 6), for all x in [a, 6]. Suppose, in addition, that g” exists on (a, b) and that a constant 0 < k < 1 exists with Is'@)| 0, and p, € (a, b] for all n. Using the fact that |g'(x)| < k and the Mean Value Theorem, we have, for each n, Ipn — pl = 1¢(Pn—1) — 8(P)! = Ie'En)IPa—1 — Pl < KlPa—t ~ Phe where & € (a, 5). Applying this inequality inductively gives [Pa — PLS klpe-1 — pl SP lpa—2 — PLS +++ SR"Ipo ~ pl. (24)62 Corollary 2.4 CHAPTER 2 * Solutions of Equations in One Variable Since 0 < k < 1, we have litt... k" = Oand Jim |e — pl S Jim k"Ip0 ~ pl = 0. Hence, {Pa }puo converges to p. If g satisfies the hypotheses of Theorem 2.3, then bunds for the error involved in using py to approximate p are given by lpn — p| =" max{p9 — a, b — po} = pol, forall n>1 . Proof Since p € a, b], the first bound follows from Inequality (2.4) IPa ~ Pl = k"|po — pl = k* max{po — a, b — po}. For n > 1, the procedure used in the proof of Theorem 2.3 implies that 13(Pn) ~ 8(Pn-) S klPn — Prt) S++ Sk" |ps — Pol IPati — Pal Thus, form >n > 1, Pal Wm ~ Pal = Pm — Prem + Pent — °° + Past SIP m — Pm=1l + Pmat = Pm=al +++ Pasi — Pal Ipi — pol +R"*lpi — pol +--+ "lpi — Pol se =K'lpy— poll + kth +e Rm By Theorem 2.3, lino Pm = P, SO mone ‘o (p — pal = tim, |Pm — Pal < lim, k"Ip: ~ pol Dk 1 for all x in {1,2}. Although Theorem 2.3 does not guarantee that the method must fail for this choice of g, there is no reason to expect convergence. b. With go(x) = [(10/x) —4x}"/?, we can see that go does not map (1, 2] into (1, 2], and the sequence (p,)2%» is not defined when po = 1.5. Moreover, there is no interval containing p © 1.365 such that Ign) <1, since |gp(p)| © 3.4. There is no reason to expect that this method will converge. c. For the function g3(x) = (10 = x3)", 8h) = 3700 =)? <0 on[l,2I, 80 g3 is strictly decreasing on [1, 2}. However, |g;(2)| * 2.12, so the condition igs(x)| < k < 1 fails on [1,2]. A closer examination of the sequence {p,}729 starting with po = 1.5 shows that it suffices to consider the interval [1, 1.5] instead of [1, 2]. On this interval it is still true that g4(x) < 0 and gs is strictly decreasing, but, additionally, 1 < 1.28 © ga(1.5) < gx(x) < ga(1) = LS, forall x € [1, 1-5]. This shows that g3 maps the interval [1, 1.5] into itself. Since it is also true that |g4(x)| < |g4(1.5)| © 0.66 on this interval, Theorem 2.3 confirms the convergence of which we were already aware. 10/(4 + x)", we have | 5 {.__5 VI04+ Al ~ Y10(5)32 ‘The bound on the magnitude of g{(x) is much smaller than the bound (found in (c)) on the magnitude of g4(x), which explains the more rapid convergence using Re. <0.15, forall x € [1,2] Ieie)] The sequence defined by &) xi+4x7-10 Bs 3x? + Be ‘converges much more rapidly than our other choices. In the next sections we will see where this choice came from and why it is so effective. s et EXERCISE SET 22 Use algebraic manipulation to show that each of the following functions has a fixed point at p precisely when f(p) = 0, where f(x) =x! + 2x? ~ x — 3. “ ) ge) = (B+4~24)"" b. a= (243CHAPTER 2 = Solutions of Equationsin One Variable 3. 4 10. va 2 eg 3x4 420743 ) @ awaze a. Perform four iterations, if possible, on each of the functions g defined in Exercise 1. Let Po = Vand pays = g(r). forn =0,1,2,3. Which function do you think gives the best approximation to the solution? ‘The following four methods are proposed to compute 21", Rank them in order, based on their apparent speed of convergence, assuming py = 1. 20py-1 + 21/Pi a py et Be P= Pai — fy 21 3P a1 ena) ‘The following four methods are proposed to compute 7". Rank them in order, based on their apparent speed of convergence, assuming po = 1. TH 4 Ps © Pa = Pra — wre (t# © Pa = Pat Use a fixed-point iteration method to determine a solution accurate to within 10°? for x* — 3x? 3 = Oon[1, 2]. Use pp=1. Use a fixed-point iteration method to determine a solution accurate to within 10? for x? — x — = 0on[1, 2). Use po =1. Use Theorem 2.2 to show that g(x) = a + 0.5sin(x/2) has a unique fixed point on (0, 2] Use fixed-point iteration to find an approximation to the fixed point that is accurate to within 10-2. Use Corollary 2.4 to estimate the number of iterations required to achieve 10°? accuracy, and compare this theoretical estimate to the number actually needed, Use Theorem 2.2 to show that g(x) = 2* has a unique fixed point on {}, 1]. Use fixed-point iteration to find an approximation to the fixed point accurate to within 10. Use Corollary 2.41to estimate the number of iterations required to achieve 10~ accuracy, and compare this theoretical estimate to the number actually needed. Use a fixed-point iteration method to find an approximation to V/3 that is accurate to within 10-. Compare your result and the number of iterations required with the answer obtained in Exercise 10 of Section 2.1 ‘Use a fixed-point iteration method to find an approximation to -/25 that is accurate to within 10-+. Compare your result and the number of iterations required with the answer obtained in Exercise 11 of Section 2.1. For each of the following equations, determine an interval [a, 6] on which fixed-point iteration will converge. Estimate the number of iterations necessary to obtain approximations accurate to within 10-8, and perform the calculations. 2 bo x=542 © a@ox=5* e £ x= 0,5(inx +005) For each of the following equations, determine a function g and an interval [a,b] on which fixed-point iteration will converge to a positive solution of the equation. a 3x? et =0 be x—cosx=0 Find the solutions to within 10%22 13. 14, 15, 16. 7. 18, 1. 21. Fixed-Point iteration 6 Find all the zeros of f(x) = x? + 10cosx by using the fixed-point iteration method for an appropriate iteration function g. Find the zeros accurate to within 10-*. Use a fixed-point iteration method to determine a solution accurate to within 10~! for x = tanx, for x in 4, 5) Use a fixed-point iteration method to determine a solution accurate to within 10-? for 2sinxx +x = On [1,2]. Use po =1. Let A be a given positive constant and g(x) = 2x ~ Ax* Show that if fixed-point iteration converges to a nonzero limit, then the limit is p = 1/4, 50 the inverse of a number can be found using only multiplications and subtractions. Find an interval aboot 1/A for which fixed-point iteration converges, provided po is in that interval Find a function g defined on (0, 1] that satisfies none of the hypotheses of Theorem 2.2 but stil has a unique fixed point on (0, 1]. ‘&, Show that Theorem 2.2 is true ifthe inequality |g'(x)| < & is replaced by g'(x) < k, for allx € (a, 6). [Hint: Only uniqueness is in question.) Show that Theorem 2.3 may not hold if inequality jg’(x)| < k is replaced by g'(x) < k (dint: Show that g(x) = 1 ~ x2, for x in (0, 1], provides a counterexample.] &. Use Theorem 2.3 to show that the sequence defined by 1 1 me per to, forme, converges to /2 whenever xp > 2. b. Use the fact that 0 < (xp ~ 2)? whenever 1p 4 V2 to show that if 0 < xp < V3, then x > v2, ¢. Use the results of parts (a) and (b) to show that the sequence in (a) converges to 72 whenever x > 0 ‘8. Show that if Ais any positive number, then the sequence defined by for n> 1, Pe converges to /A whenever x > 0. b, What happens if xp < 0? Replace the assumption in Theorem 23 that “a positive number k < 1 exists with |g’(x)| < &" with “g satisfies « Lipschitz condition on the interval [a, b) with Lipschitz constant L < 1.” (See Exercise 25, Section 1.1.) Show that the conclusions of this theorem are still valid ‘Suppose that g is continuously differentiable on some interval (c, d) that contains the fixed point p of g. Show that if |p'(p)| < 1, then there exists a8 > O such that if |pp — p| < 8, then the fixed-point iteration converges. ‘An object falling vertically through the air is subjected to viscous resistance as well as to the force of gravity. Assume that an object with mass m is dropped from a height sy and that the height of the object after ¢ seconds is where g = 32.17 fus? and k represents the coefficient of air resistance in Ib-s/ft. Suppose 50 = 300 ft, m = 0.25 Ib, and k = 0.1 Ib-sft. Find, to within 0.01 s, the time it takes this ‘quarter-pounder to hit the ground66 CHAPTER 2 = Solutions of Equations in One Variable 24, Let g € C'la,b] and p be in (a, b) with g(p) = p and |g'(p)| > 1. Show that there exists a 45> Osuch that if < ipp — p| = 8, then Ipo ~ pl < |p ~ p|- Thus, no matter how close the initial approximation py isto p, the next iterate p, is farther away, so the fixed-point iteration does not converge if po # p. 2.3 Newton's Method ‘Newton's (or the Newion-Raphson) method is one of the most powerful and well-known numerical methods for solving a root-finding problem. There are many ways of introducing Newton's method. If we only want an algorithm, we can consider the technique graphically, asis often done in calculus. Another possibility is to derive Newton's method as a technique to obtain faster convergence than offered by other types of functional iteration, as is done in Section 2.4. A third means of introducing Newton's method, which is discussed next, is based on Taylor polynomials ‘Suppose that f ¢ C?[a, b]. Let ¥ € [a, b] be an approximation to p such that f’(x) # 0 and jp ~ | is “small.” Consider the first Taylor polynomial for f (x) expanded about X, & a fQ) = {M+@-D/O+ FEO), where §(x) lies between x and X. Since f(p) = 0, this equation with x = p gives o= I@+@-n/@+2o™ B® me, Newton's method is derived by assuming that since |» — ¥| is small, the term involving (p — ¥) is much smaller, so O= f@ + (p—*S'R)- Solving for p gives wz-fQ p 7@ This sets the stage for Newton's method, which starts with an initial approximation po and ‘generates the sequence {p,}32, by forn > 1. (2.5) Figure 2.7 illustrates how the approximations are obtained using successive tangents. (Also see Exercise 11.) Starting with the initial approximation po, the approximation p; is the x-intercept of the tangent line to the graph of f at (po, f (po)). The approximation py is the x-intercept of the tangent line to the graph of f at (p1, f())) and so on. Algorithm 2.3 follows this procedure.2.3. Newton's Method 67 Figure 2.7 y Srey — 9 =f) (Prfey) (o,f) Newton's To find a solution to f(x) = 0 given an initial approximation pp: INPUT initial approximation po; tolerance TOL; maximum number of iterations No, OUTPUT approximate solution p or message of failure. Step1 Seti =1 Step 2. While i < No do Steps 3-6. Step 3 Set p = po — f(po)/f'(po). (Compute p;.) Step 4 If |p — pol < TOL then OUTPUT (p); (The procedure was successful.) STOP. Step 5 Seti =i+1 Step6 Set po =p. (Update po.) Step 7 OUTPUT (‘The method failed after No iterations, No =", No): (The procedure was unsuccessful) STOP. . ‘The stopping-technique inequalities given with the Bisection method are applicable to Newton's method. That is, select a tolerance ¢ > 0, and construct p;,... py until Iw pwil 1. (2.9) 8 (Pa Suppose we would like to approximate a fixed point of g(x) = cos.x. The graph in Figure 2.8 implies that a single fixed-point p lies in (0, 7/2]. /4. The best we could Table 2.3 shows the results of fixed-point iteration with pp = conclude from these results is that p * 0.74. ‘To approach this problem differently, define f(x) = cosx — x and apply Newton’s method. Since f(x) = —sinx — 1, the sequence is generated by cos forn > 1. Prot With po = 1/4, the approximations in Table 2.4 are generated. An excellent approximation is obtained with n = 3. We would expect this result to be accurate to the places listed because of the agreement of p3 and ps .Theorem 2.5 2.3. Newton's Method 69 Table 23 Table 2.4 ” Ps ” Pn 0 0.7853981635 0 0.7853981635 1 0.7071067810 1 0,7395361337 2 0.7602445972 2 0.7390851781 3 0.7246674808 3 0.7390851332 4 0.7487198858 4 0.7390851332 5 0.7325608446 6 0.7434642113 7 0.7361282565 The Taylor series derivation of Newton’s method at the beginning of the section points ut the importance of an accurate initial approximation. The crucial assumption is that the term involving (p — =)? is, by comparison with |p — ¥|, so small that it can be deleted. This will clearly be false unless X is a good approximation to p. If po is not sufficiently close to the actual root, there is little reason to suspect that Newton's method will converge to the root. However, in some instances, even poor initial approximations will produce convergence. (Exercises 12 and 16 illustrate some of these possibilities.) The following convergence theorem for Newton’s method illustrates the theoretical importance of the choice of po. Let f € C2{a,b). If p € (a, b] is such that f(p) = 0 and f’(p) # 0, then there exists a & > O such that Newton's method generates a sequence {p,}%2., converging to p for any initial approximation po € [p — 5, p +5]. . Proof The proof is based on analyzing Newton's method as the functional iteration scheme py = g(Pn-1), for n > 1, with f@) fray Let k be in (0, 1). We first find an interval [p — 6, p +6] that g maps into itself and for which |g'(x)| < k, for all x € (p — 5, p +8). Since f’ is continuous and f'(p) # 0, part (a) of Exercise 27 in Section 1.1 implies that there exists a 6; > 0, such that /’(x) # 0 for x € [p ~ 51, p + 41] S [a,b]. Thus, & is defined and continuous on [p — 51, p + 81]. Also, 8) = ge LOLO=fOF@) _ fos"@ ror FOr for x € [p — 81, p +61], and, since f € C*[a, b], we have g € C'[p — 3), p +41]. By assumption, f(p) = 0, so ep) = LOL) ePTFECHAPTER 2 * Solutions of Equations in One Variable Since g' is continuous and 0 < k < 1, part (b) of Exercise 27 in Section 1.1 implies that there exists a 5, with O <4 <5,, and Ie’) sk, forall x €(p—3, p +4]. Itremains to show that g maps [p—6, p+8] into [p~8, p+]. Ifx € [p—8, p+], the ‘Mean Value Theorem implies that for some number & between x and p, |g(x) — g(p)| = Ig'E)Ilx ~ pl. So Ig) ~ pl = lax) — Cp) = Ia'(@ Dla — pls klx — pl < lx — pl. Since x ¢ [p ~ 4, p + 4], it follows that |x — p| < 6 and that |g(x) — p| < 6. Hence, g maps [p — 8, p + 4] into [p — 6, p + 4]. All the hypotheses of the Fixed-Point Theorem are now satisfied, so the sequence (pager defined by Ce) n= m1) = Pat — , forn>1, Pa=8Pr-t) = Prat Feary forme converges to p for any po € [p 8, p +8). wae ‘Theorem 2.5 states that, under reasonable assumptions, Newton's method converges provided a sufficiently accurate initial approximation is chosen. It also implies that the constant k that bounds the derivative of g, and, consequently, indicates the speed of con- vergence of the method, decreases to 0 as the procedure continues. This result is important for the theory of Newton's method, but itis seldom applied in practice since it does not tell tus how to determine 3. In a practical application, an initial approximation is selected, and successive approximations are generated by Newton's method. These will generally either converge quickly to the root, or it will be clear that convergence is unlikely. ‘Newton's method is an extremely powerful technique, but it has a major weakness: the need to know the value of the derivative of f at each approximation. Frequently, f(x) is far more difficult and needs more arithmetic operations to calculate than f(x). To circumvent the problem of the derivative evaluation in Newton's method, we intro- duce a slight variation. By definition, fra) = tim L~ Led) Pet = Prot Letting x = pn-2, we have f@n-2) — F(a) _ fn-1) ~ Fn. “om ® Fmd Pn-2— Pn=1 Pr-t — Pr-2 Using this approximation for f’(p,-1) in Newton's formula gives SF (Pn-1)(Pr—1 = Pn—2) n= Pr—1 . (2.10) Pa Ps FD) = Fn-2) 19) This technique is called the Secant method and is presented in Algorithm 2.4. (See Figure 2.9.) Starting with the two initial approximations pp and p1, the approximation p2 is the x-intercept of the line joining (po, /(po)) and (p1, f(p1)). The approximation p3 is the x-intercept of the line joining (p1, f(pi)) and (p2, f(p2)), and so on.2.3. Newton's Method 71 Figure 2.9 pend Secant To find a solution to f(x) O given initial approximations po and p, INPUT initial approximations po, p1; tolerance TOL; maximum number of iterations No. OUTPUT approximate solution p or message of failure. Step 1 Seti =2; qo = f (Po): a = f(pv). Step 2 While i < No do Steps 3-6. Step3 Set p = pr ~9i(Pi ~ Po)/Gi — qo). (Compute pi.) Step4 Ifip — pil < TOL then OUTPUT (p): (The procedure was successful) STOP. Step5 Seti=i+1 Step6 Set po = pr; (Update po, gor P14.) w= Hs PL=Ps a = f(p)- Step 7 OUTPUT (‘The method failed after No iterations, No =", No); (The procedure was unsuccessful.) STOP. . The next example involves a problem considered in Example 1, where we used New- ton’s method with po = 1/4.72 EXAMPLE 2 Table 25 CHAPTER 2 © Solutions of Equations in One Variable Use the Secant method to find a solution to x = cos x. In Example 1 we compared func- tional iteration and Newton's method with the initial approximation po = 1/4. Here we need two initial approximations. Table 2.5 lists the calculations with py = 0.5, p1 = 1/4, and the formula , Pa = Pri Tey from Algorithm 2.4. . 0s 07853981635 0.7363841388 0.7390581392 0.7390851493 0.7390851332 waunee By comparing the results here with those in Example 1, we see that ps is accurate to the tenth decimal place, The convergence of the Secant method is much faster than functional iteration but slightly slower than Newton's method, which obtained this degree of accuracy with p3. This is generally true. (See Exercise 12 of Section 2.4.) Newton's method or the Secant method is often used to refine an answer obtained by another technique, such as the Bisection method, since these methods require a good first approximation but generally give rapid convergence. Each successive pair of approximations in the Bisection method brackets a root p of the equation; that is, for each positive integer n, a root lies between a, and by. This implies that, for each n, the Bisection method iterations satisfy \Pn = PL < 5a bal, which provides an easily calculated error bound for the approximations. Root bracketing is not guaranteed for either Newton’s method or the Secant method. Table 2.4 contains results from Newton's method applied to f(x) = cos.x — x, where an approximate root ‘was found to be 0.7390851332. Notice that this root is not bracketed by either po, Pi OF Pi, 2. The Secant method approximations for this problem are given in Table 2.5. The initial approximations po and p; bracket the root, but the pair of approximations ps and p, fail t0 do so. ‘The method of False Position (also called Regula Falsi ) generates approximations in the same manner as the Secant method, but it includes a test to ensure that the root is brack- ted between successive iterations. Although it is not a method we generally recommend, it illustrates how bracketing can be incorporated. First choose initial approximations pp and p; with f (po) f(p1) < 0. The approxima- tion p2 is chosen in the same manner as in the Secant method, as the x-intercept of the line joining (po, f(po)) and (p1, f (p1)). To decide which secant line to use to compute p3, weFigure 2.10 2.3. Newton's Method 73 check f(p2)- f(p1). If this value is negative, then p; and p2 bracket a root, and we choose 3 a8 the x-intercept of the line joining (pi, f(p1)) and (p2, f(p2)). If not, we choose ps as the x-intercept of the line joining (po, f(po)) and (p2, f(p2)), and then interchange the indices on po and p;. In a similar manner, once ps is found, the sign of f(ps) - f(p2) determines whether we use p» and p3 or p3 and p, to compute pz. In the latter case a rela- beling of pz and p; is performed. The relabeling ensures that the root is bracketed between successive iterations. The process is described in Algorithm 2.5, and Figure 2.10 shows how the iterations can differ from those of the Secant method. In this illustration, the first three approximations are the same, but the fourth approximations differ. ‘Secant method Method of False Position » y=f@) 25 Method of False Position To find a solution to f(x) = 0 given the continuous function f on the interval [po, pi] where f (po) and f (pi) have opposite signs: INPUT initial approximations po, pi; tolerance TOL; maximum number of iterations No, OUTPUT approximate solution p or message of failure, Step 1 Seti =2; qo = f(D): n= f(r). Step2 While i < No do Steps 3-7. Step 3 Set p= pi —41(P1 — Po)/(qi — 90). (Compute p;-) Step 4 If |p — pi| < TOL then OUTPUT (p); (The procedure was successful.) STOP.74 CHAPTER 2 + Solutions of Equations in One Variable Step 5 Seti itl: F(). Step 6 fq -q, < Othen set po Step 7 Set py) = pi n=4 Step 8 OUTPUT (‘Method failed after No iterations, No =", No); (The procedure unsuccessful.) STOP. . EXAMPLE 3 Table 2.6 shows the results of the method of False Position applied to f(x) = cosx — x with the same initial approximations we used for the Secant method in Example 2. Notice that the approximations agree through p and that the method of False Position requires an additional iteration to obtain the same accuracy as the Secant method. . Table 2.6 0s 07853981635 0.7363841388 0.7390581392 0.7390848638 0.7390851305 0.7390851332 The added insurance of the method of False Position commonly requires more calcula- tion than the Secant method, just as the simplification that the Secant method provides over Newton's method usually comes at the expense of additional iterations. Further examples of the positive and negative features of these methods can be seen by working Exercises 13 and 14. SS EXERCISE SET 23 1 Let fe 2 Let f(x) used? 3. Let f(x) = x? ~ 6 With py = 3 and py = &. Use the Secant method. 1b. _ Use the method of False Position. Which of (a) or (b) is closer to 6? 4. Let f(x) = x — cos. With py = ~1 and p, = 0, find ps a. Use the Secant method. b. Use the method of False Position. — 6 and pp = 1. Use Newton’s method to find p2. — cosx and po = —1. Use Newton's method to find p2. Could py = 0 be find ps23 10. ML. 2. 1B. 14, Newton's Method 75 Use Newton's method to find solutions accurate to within 10~* forthe following problems. a P2550, [1,4] boo e32-1=0, (-3,-2) & x= cosx=0, (0,7/2] dx -08-02sinx=0, (0.2/2) Use Newton's method to find solutions accurate to within 10-S for the following problems, a ef H2*+2cosx-6=0 for I, let py be the x-intercept of the line tangent to F at (Pros f(Px-1))- Derive the formula describing this method. Use Newton's method to solve the equation 1 x = xsinx — 5 cos2x, wit $ sinx ~ 5 cos th po = 5 Iterate using Newton's method until an accuracy of 10-$ is obtained. Explain why the result seems unusual for Newton's method. Also, solve the equation with po = Sar and py = 10%. ‘The fourth-degree polynomial f(x) = 230x* + 18x? + 9x? — 221-9 thas two real zeros, one in {—1, 0] and the other in [0, 1]. Attempt to approximate these zeros to within 10 using the 8, Method of False Position b. Secant method Newton's method Use the endpoints of each interval as the initial approximations in (a) and (b) and the midpoints a the initial approximation in (c). ‘The function (x) = tan sex ~ 6 has a zero at (1/r) arctan6 ~ 0.447431543. Let po = O and Pi = 0.48, and use ten iterations of each of the following methods to approximate this root, ‘Which method is most successful and why? a. Bisection method b. Method of False Position © Secant methodCHAPTER 2 = Solutions of Equations in One Variable 15. 16. 17. 18. 19, 2. 2. ‘The iteration equation for the Secant method can be written in the simpler form paw fhe L(Pn-2)Pa-t FPn-i) = FPr-ad Explain why, in general, this iteration equation is likely to be less accurate than the one given in Algorithm 2.4. ‘The equation x? — 10cosx = 0 has two solutions, +1.3793646, Use Newton’s method to approximate the solutions to within 10~* with the following values of po. ‘Po = 100 bpp = 50 ce po=-25 dad. po = 25 e& po = 50 f. po = 100 ‘Use Maple to determine how many iterations of Newton's method with py = 1/4 are needed to find a root of f (x) = cos.x ~ x to within 10“, Repeat Exercise 17 with po = 4, py = 4, and the Secant method, ‘The function described by f(x) = In(x? + 1) ~ e* cos x has an infinite number of zeros. a. Determine, within 10-°, the only negative zero. b. Determine, within 10-6, the four smallest positive zeros. Determine a reasonable initial approximation to find the nth smallest positive zero of f. [Hint: Sketch an approximate graph of f.] d. Use part (c) to determine, within 10~*, the 25th smallest positive zero of f Find an approximation for A, accurate to within 10~, for the population equation 435,000 1,564,000 = 1,000,000e* + We = 1), discussed in the introduction to this chapter. Use this value to predict the population at the end of the second year, assuming that the immigration rate during this year remains at 435,000 individuals per year. ‘The sum of two numbers is 20. If each number is added to its square root, the product of the two sums is 155.55, Determine the two numbers to within 10 ‘The accumulated value of a savings account based on regular periodic payments can be deter- mined from the annuity due equation, A= FU +i)" 1) In this equation, A is the amount in the account, P is the amount regularly deposited, and i isthe rate of interest per period for the n deposit periods. An engineer would like to have a savings account valued at $750,000 upon retirement in 20 years and can afford to put $1500 per month toward this goal. What is the minimal interest rate at which this amount can be invested, assuming that the interest is compounded monthly? Problems involving the amount of money required to pay off a mortgage over a fixed period. of time involve the formula 1-045"), known as an ordinary annuity equation. In this equation, A is the amount of the mortgage, P iis the amount of each payment, and i is the interest rate per period for the n payment periods. Suppose that a 30-year home mortgage in the amount of $135,000 is needed and that the borrower can afford house payments of at most $1000 pet month. What is the maximal interest rate the borrower can afford to pay?23 mw 28, 27. 29. ‘Newton's Method 7 ‘A drug administered to a patient produces a concentration in the blood stream given by c(t) = Ate~"? milligrams per milliliter, t hours after A units have been injected. The maximum safe concentration is 1 mg/ml. ‘a, What amount should be injected to reach this maximum safe concentration, and when does this maximum occur? b. An additional amount of this drug is to be administered to the patient after the concen- tration falls to 0.25 mg/ml. Determine, to the nearest minute, when this second injection should be given. ©. Assume that the concentration from consecutive injections is additive and that 75% of the amount originally injected is administered in the second injection. When is it time for the third injection? Let fa) = 1-7 ‘8, Use the Maple commands solve and fs01ve to try to find all roots of f. b. Plot f(x) to find initial approximations to roots of f. ¢. Use Newton's method to find rdots of f to within 10, 4. Find the exact solutions of f(x) = 0 algebraically Repeat Exercise 25 using f(x) = 2° — 3. 7*+1 ‘The logistic population growth model is described by an equation of the form PL P= where P,,¢, and k > 0 are constants, and P(t) is the population at time t. P, represents the limiting value of the population since lim,.,. P(t) = Pz. Use the census data for the years 1950, 1960, and 1970 listed in the table on page 104 to determine the constants P;,.c, and k for a logistic growth model. Use the logistic model to predict the population of the United States in 1980 and in 2010, assuming t = 0 at 1950. Compare the 1980 prediction to the actual value. ‘The Gompertz population growth model is described by Pw = Pe where Pc, and k > Oare constants, and P(t) is the population at time 1. Repeat Exercise 27 using the Gompertz growth model in place of the logistic model. Player A will shut out (win by a score of 21-0) player B in a game of racquetball with proba- bility a rot? ( 25) . 2 \imprF where p denotes the probability A will win any specific rally (independent ofthe server. (See {Keller, J}, p. 267.) Determine, to within 10-*, the minimal value of p that will ensure that A will shut out B in at least half the matches they play. In the design of all-terrain vehicles, it is necessary to consider the failure of the vehicle when attempting to negotiate two types of obstacles. One type of failure is called hang-up failure ‘and occurs when the vehicle attempts to cross an obstacle that causes the bottom of the vehicle to touch the ground. The other type of failure is called nose-n failure and occurs when the vehicle descends into a ditch and its nose touches the ground. ‘The accompanying figure, adapted from [Bek], shows the components associated with the nose-in failure ofa vehicle. Ia tht reference itis shown that the maximum angle cr thatCHAPTER 2 + Solutions of Equations in One Variable ccan be negotiated by a vehicle when f is the maximum angle at which hang-up failure does ‘not occur satisfies the equation Asina cosa + B sina ~C cosa ~ E sina =0, where A=lsing,, B= lcosB;, C= (k+05D)sinf; -05Dtanp, and E = (h+0.5D)cos 6; — 05D. a, It is stated that when I = 89 in., A= 49 in., D = 55 in., and fy = 11.5°, angle a is approximately 33°. Verify this result . Find a forthe situation when I, fh, and fi, are the same as in part (a) but D = 30 in. 2.4 Error Analysis for Iterative Methods Definition 2.6 In this section we investigate the order of convergence of functional iteration schemes and, as a means of obtaining rapid convergence, rediscover Newton's method. We also consider ways of accelerating the convergence of Newton’s method in special circumstances. First, however, we need a procedure for measuring how rapidly a sequence converges. Suppose {pa}%2o is a sequence that converges to p, with p, # p for all n. If positive constants A and a exist with east = pl _ 28% 1p — Die then {pn}22 converges to p of order a, with asymptotic error constant 2. . An iterative technique of the form p, = g(Pn-t) is said to be of order a if the sequence (pn}$2o converges to the solution p = g(p) of order a. In general, a sequence with a high order of convergence converges more rapidly than a sequence with a lower order. The asymptotic constant affects the speed of convergence but is not as important as the order. Two cases of order are given special attention.EXAMPLE 1 Table 2.7 2.4 Error Analysis for herative Methods 79 @ Ifa = 1, the sequence is linearly convergent. (ii) Ifa = 2, the sequence is quadratically convergent. ‘The next example compares a linearly convergent sequence to one that is quadratically convergent. It shows why we try to find methods that produce higher-order convergent sequences. ‘Suppose that {pp )}®2.o is linearly convergent to 0 with tim Patt! _ 9.5 no 1Pnl and that (f,}229 is quadratically convergent to 0 with the same asymptotic error constant, im, : ae =05. For simplicity, suppose that Pett! 9.5 and [Pal For the linearly convergent scheme, this means that [Pa ~ Ol = [Pal © 0.5|Pa—tl © (0.5)"|pa-al © + © (0.5)" [pol whereas the quadratically convergent procedure has Wn — 01 =| Pal © 0.5111? © (0.5)10.51Bn-2)°F = 0.5)? [Pe % (0.5)°[.5)|Pn-sl°I* = (0.5)"|Pn-sl° we 0.5)" Bol” Table 2.7 illustrates the relative speed of convergence of the sequences to 0 when | pol = pol Linear Convergence Quadratic Convergence Sequence {Palio Sequence (F4}o n 0.5)" (0.57! 1 5,000 x 10°! 2 1.2500 x 10°! 3 a 7.8125 x 10-3 4 6.2500 x 10°? 3.0518 x 10-5 5 3.1250 x 10°? 4.6566 x 10°'!° 6 1.5625 x 107 1.0842 x 10° 7 7.8125 x 10-9 5.8775 x 10-* ‘The quadratically convergent sequence is within 10~** of 0 by the seventh term. At least 126 terms are needed to ensure this accuracy for the linearly convergent sequence.Theorem 2.7 Theorem 2.8 CHAPTER 2 = Solutions of Equations in One Variable Quadratically convergent sequences generally converge much more quickly than those that converge only linearly, but many techniques that generate convergent sequences do so only linearly. Let g € Cla, b] be such that g(x) € [2, 6), for all x € [a, b]. Suppose, in addition, that g" is continuous on (a, b) and a positive constant k < 1 exists with Ie) sk, forall x € (a,b). If g'(p) # 0, then for any number pp in (a, b}, the sequence Pa=8(Pr-1), forn> 1, converges only linearly to the unique fixed point p in (a, 6). . Proof We know from the Fixed-Point Theorem 2.3 in Section 2.2 that the sequence con- verges to p. Since g’ exists on [a, b], we can apply the Mean Value Theorem to g to show that for any n, Pati — P= 8(Pn) ~ 8(P) = 8'(En)(Pa — P)s where & is between p, and p. Since (pn}2.o converges to p, we also have {8,]22o con- verging to p. Since g’ is continuous on [a, 5}, we have im &/(G) = &'(p). Thus, +1—P ‘ , fim Patt = Pl _ yoy = and Tim [Pet1— Pl 8'Gn) = 8'(p) ig y= le Jim 2 we ppp Hence, if g’(p) # 0, fixed-point iteration exhibits linear convergence with asymptotic error constant |g’(p)|- eee ‘Theorem 2.7 implies that higher-order convergence for fixed-point methods can oc- cur only when g/(p) = 0. The next result describes additional conditions that ensure the quadratic convergence we seek. Let p bea solution of the equation x = g(x). Suppose that g'(p) = 0 and g” is continuous and strictly bounded by M on an open interval J containing p. Then there exists a5 > 0 such that, for po € [p — 6, p +6], the sequence defined by py, = g(Pn-1), when n > 1, converges at least quadratically to p. Moreover, for sufficiently large values of n, M past — Pl <1Pa~ pr. . Proof Choose k in (0, 1) and 6 > 0 such that on the interval [p — 8, p + 8], contained in I, we have |g/(x)| < k and g" continuous. Since |g'(x)| < < 1, the argument used in the proof of Theorem 2.5 in Section 2.3 shows that the terms of the sequence {Pn)22o are contained in (p — 8, p +8]. Expanding g(x) in a linear Taylor polynomial for2.4 Error Analysis for erative Methods 31 x € [p 76, p +8) gives 802) = 8(p) + 8D) ~ p) + fO. -p, where lies between x and p. The hypotheses g(p) = p and g'(p) = 0 imply that sea pte Be py. In particular, when x = Py, Poss = 800) = p+ £8, — py, with § between p, and p. Thus, pret ~ p= £22, ~ py. Since |g’(x)| < k < 1 on [p ~ 5, p +8] and g maps [p — 4, p + 8] into itself, it follows from the Fixed-Point Theorem that (p_}%2. converges to p. But §, is between p and p, for each n, $0 {§q}%25 also converges to p, and iy [Pasi ~ Dl _ le") noo [Pa — Pl? 2° This result implies that the sequence (p,}22o is quadratically convergent if g’(p) # 0 and of higher-order convergence if g”"(p) = 0. Since g" is continuous and strictly bounded by M on the interval {p — 6, p + 5], this also implies that, for sufficiently large values of n, M IPnti— pi < lpn PP eee ‘Theorems 2.7 and 2.8 tell us that our search for quadratically convergent fixed-point methods should point in the direction of functions whose derivatives are zero at the fixed point. The easiest way to construct a fixed-point problem associated with a root-finding prob- Jem f(x) = Ois to subtract a multiple of f(x) from x. So let us consider Pn=8(Pr1), forn> 1, for g in the form a(x) =x — OF), where ¢@ is a differentiable function that will be chosen later. For the iterative procedure derived from g to be quadratically convergent, we need to have g'(p) = 0 when f(p) = 0. Since 8) =1- FOS) — f'O@),82 Definition 2.9 Theorem 2.10 Theorem 2.11 CHAPTER 2 + Solutions of Equations in One Variable we have 8'(p) =1-6'(p)f(p) — f'(p)b(p) = 1 — b'(p) 0 F'(p)9(p) = and g’(p) = 0 if and only if $(p) = 1/f"(p). If we let (x) = 1/f’(x), then we will ensure that 6(p) = 1/f"(p) and produce the quadratically convergent procedure =F (P)e(). Pn = 8(Pn-t) = Pat F'n) This, of course, is simply Newton's method. In the preceding discussion, the restriction was made that f’(p) # 0, where p is the solution to f(x) = 0. From the definition of Newton's method, it is clear that difficulties might occur if f"(p,) goes to zero simultaneously with f(p,). In particular, Newton's method and the Secant method will generally give problems if f'(p) = 0 when f(p) To examine these difficulties in more detail, we make the following definition. A solution p of f(x) is a zero of multiplicity m of f if for x # p, we can write F(x) = (x = p)"q(x), where lim,» q(x) #0. . In essence, g(x) represents that portion of f(x) that does not contribute to the zero of ‘f. The following result gives a means to easily identify simple zeros of a function, those that have multiplicity one. Jf € Ca, by has a simple zero at p in (a, b) if and only if f(p)=0, but f'(p) #0. = Proof If f has a simple zero at p, then f(p) = 0 and f(x) = (x — p)q(x), where lim,,p q(x) # 0. Since f € C'fa, b}, FD) = fim fC) = Hila + ~ pa") = im g(a) # 0. Conversely, if f(p) = 0, but f’(p) # 0, expand f in a zeroth Taylor polynomial about p. Then F(x) = f(p) + FEC = p) = - P)F'ER)), where (x) is between x and p. Since f € C'{a, b}, fim £6) =f" (im 00) =f) 40. Letting g = f’ o€ gives f(x) = (a — p)q(x), where lim,.,pq(x) # 0. Thus, f has a simple zero at p. wae The following generalization of Theorem 2.10 is considered in Exercise 10. The function f € C™[a, 6] has a zero of multiplicity m at p in (a, 6) if and only if O= fp) = fp) = fp) = = FO PCD), but f(y) #0. .EXAMPLE 2 Table 2.8 Figure 2.11 2.4 Error Analysis for iterative Methods 83 The result in Theorem 2.10 implies that an interval about p exists where Newton's method converges quadratically to p for any initial approximation pp = p, provided that p is a simple zero. The following example shows that quadratic convergence may not occur if the zero is not simple. Consider f(x) = e* — x — 1. Since (0) =e? — 0-1 =O and f'(0) =e” — 1 =0, but £0) =e? = 1, f has a zero of multiplicity two at p = 0. In fact, f (x) can be expressed in the form where, by L’Hépital’s cule, lim =o The terms generated by Newton’s method applied to f with pp = 1 are shown in Table 2.8. The sequence is clearly converging to 0, but not quadratically. The graph of f is shown in Figure 2.11 . 2 Pn n Pr o 10 9 2.7750 x 107 1 058198 101.3881 x 107 2 031906 11 6.9411 x 10° 3 0.16800 2 4 0.08635 1B 5 0.04380 14 8.8041 x 10-5 6 0.02206 1S 4.2610 x 10° 7 0.01107 16 1.9142 x 10-6 8 0.005545EXAMPLE 3 Table 2.9 CHAPTER 2 = Solutions of Equations in One Variable One method of handling the problem of multiple roots is to define _ £@) HO= FG) If p is azero of f of multiplicity m and f(x) = (x — p)"q(x), then . = pa) HO) = Tea pig) + PTE) a(x) =O PngGye Pe) also has a zero at p. However, 9(p) #0, s0 gp) mq(p) + (p— p)a'(p) and p is a simple zero of .. Newton’s method can then be applied to 11 to give HO) LG)/F) _ HG) (FOF VOU" ORF OF #0, gx) =x~ or SOS) FOR- fara en If g has the required continuity conditions, functional iteration applied to g will be quadratically convergent regardless of the multiplicity of the zero of f. Theoretically, the only drawback to this method is the additional calculation of f”(x) and the more laborious. procedure of calculating the iterates. In practice, however, multiple roots can cause seri- ‘ous roundoff problems since the denominator of (2.11) consists of the difference of two numbers that are both close to 0. g(x) =x— Table 2.9 lists the approximations to the double zero at x = Oof f(x) =e" — x — 1 using Pn = 8(Pn-1), for n > 1, where g is given by (2.11). The results were recorded using a calculator with ten digits of precision. The initial approximation of pp = 1 was chosen so that the entries can be compared with those in Table 2.8. What Table 2.9 does not show is that no improvement to the zero approximation —2.8085217 x 107 occurs in subse- quent computations using this calculator since both the numerator and the denominator approach 0. . Pa =2,3421061 x 10 8.458278 x 10-> —1.1889524 x 10-% —6.8638230 x 10-6 8085217 x 10°?EXAMPLE 4 Table 2.10 2.4 Error Analysis for iterative Methods 85 In Example 3 of Section 2.2 we solved f(x) = x3 + 4x? — 10 = 0 for the zero p = 1.36523001. To compare convergence for a zero of multiplicity one by Newton's method and the modified Newton's method listed in Eq, (2.11), let Phaa +403) — 10 Pa = Prot ~ Pig E+ _ from Newton’s method and, from p, 8(Pn-1), Where g is given by Eq. (2.11), rm _ (Pans + 473-1 — 10) 3p3_1 + BPn1) Pn © PA GPE T+ 8pm)? — (Dana +4924 ~ 10K6Pna +8) With po = 1.5, the first three iterates for (i) and (ii) are shown in Table 2.10. The results illustrate the rapid convergence of both methods in the case of a simple zero. @ pr —-(1.373333331.35689898 p ‘136526201 —_—1.36519585 ps___136523001__ 136523001 EXERCISE SET 24 1. Use Newton's method to find solutions accurate to within 10~* to the following problems. a xta2ee* +e =0, forO =0, for—-1 1. Construct a sequence that converges to 0 of order 3. ‘Suppose a > 1. Construct a sequence that converges to 0 zero of order a. Suppose p is a zero of multiplicity m of f, where f” is continuous on an open interval containing p. Show thatthe following fixed-point method has g'(p) = 0: mf) FR) ‘Show that the Bisection Algorithm 2.1 gives a sequence with an error bound that converges linearly 100. ‘Suppose that /' has m continuous derivatives. Modify the proof of Theorem 2.10 to show that {bas a zero of multiplicity m at p if and only if O= fp) = fp) == FO Mp), but Fp) #0. ‘The iterative method to solve f(x) = 0, given by the fixed-point method g(x) = SF (Pra) f"(Pa-s) [ fled YP Fon) Fp) [FESS] ree bas has g/(p) = g/(p) = 0. This will generally yield cobic (a = 3) convergence, Expand the analysis of Example to compare quadratic and ubic convergence It can be shown (see, for example, [DaB, pp. 228-229]) that if (p,]329 are convergent Se- cant method approximations to p, the solution to f(x) = 0, then a constant C exists with Tess pI%€ Ip, pipes Por sficiently large vales of m. Assume (,) converges tery of order and show that = (1+ V/5)/2. (Note: This implies tha the order of conver gence of the Secant method is approximately 1.62). at) + where Pa = 8(Pa-t Pri ES 2.5 Accelerating Convergence Itis rare to have the luxury of quadratic convergence. We now consider a technique called Aitken’s A? method that can be used to accelerate the convergence of a sequence that is linearly convergent, regardless of its origin or application. Suppose (Pp), is a linearly convergent sequence with limit p. To motivate the con- struction of a sequence {fn}229 that converges more rapidly to p than does {Pp}qap, let us first assume that the signs of p,, — Pp. Pn+i — P. and pn42— p agree and that n is sufficiently large that Pri P . Pad =P Pa-P Past —P Then (Pasa — PY? (Pns2 — PYPn = Ps 50 Phas — 2PntiP + P? © Pas2Pn— (Pn + Dns)? + P*EXAMPLE 1 Table 2.11 Definition 2.12 25. Accelerating Convergence 87 and (Pasa + Pn — 2Pnei)P © Pns2Pn ~ Pras Solving for p gives pw —PataPa a Pes Pst 2Pnsi + Pr Adding and subtracting the terms p? and 2p, py+1 in the numerator and grouping terms appropriately gives 42 ~ 2Pn Pat ~ 2PaPnst ~ Pa Pr Pata — 2Prei + Pa (PR PnPat2 + 2Pn Patt) — (P2 — 2PaPnti + P241) Puta — 2Pavi + Pr _ Wns = Pn)? Pn42— 2Pntt + Pn in — PnP. = Po Aitken’s A? method is based on the assumption that the sequence {,}229, defined by 5 (Past = Pn? py oP (2.12) Pe = Pe Fa Was + Pn converges more rapidly to p than does the original sequence (p.}%2- The sequence (pq}%2,,, where Py, = cos(1/n), converges linearly to p = 1. The first few terms of the sequences (p,}%2, and {P,)%=, are given in Table 2.11. It certainly appears that (f,)S2, converges more rapidly to p = 1 than does (p,}22. . " Pr bn 1 0.54030 0.96178 2 087758 (0.98213 3 0.94496 0.98979 4 0.96891 0.99342 5 0.98007 0.99541 6 098614 7098981 ‘The A notation associated with this technique has its origin in the following definition. For a given sequence {p,}%o, the forward difference Ap, is defined by APn = Pnti— Pn» forn > 0.Theorem 2.13 CHAPTER 2 = Solutions of Equations in One Variable Higher powers, A* p,, are defined recursively by A*p_ = A(A'"'p,), fork 2 2. . The definition implies that 4? py = A(Pntt — Pn) = APnit — Pn = (Pns2 ~ Prt) — (Past ~ Pr)- So 4 Pn = Pri2 ~ 2Pati + Per and the formula for f, given in Eq. (2.12) can be written as ( 2°Pn 2 for n > 0. (2.13) B=Pn ‘To this point in our discussion of Aitken’s A? method, we have stated that the sequence {n}2g, converges to p more rapidly than does the original sequence { p,}%2.o, but we have not said what is meant by the term “more rapid” convergence. Theorem 2:13 explains and justifies this terminology. The proof of this theorem is considered in Exercise 14. ‘Suppose that (py}22 is a sequence that converges linearly to the limit p and that for all sufficiently large values of n we have (p, — p)(Pa+1 — P) > 0. Then the sequence {Bn}°25 converges to p faster than {p,}22 in the sense that By applying a modification of Aitken’s A? method to a linearly convergent sequence obtained from fixed-point iteration, we can accelerate the convergence to quadratic. This procedure is known as Steffensen’s method and differs slightly from applying Aitken’s A? method directly to the linearly convergent fixed-point iteration sequence. Aitken’s A? ‘method constructs the terms in order: Po, Pi=s(po), pr= spi. o= 1A*}(po). Ps=e(P2), Br = (A7K(PVs--- + where {A?) indicates that Eq. (2.13) is used. Steffensen’s method constructs the same first four terms, po, Pi, P2, and fo. However, at this step it assumes that fo is a better approx- imation to p than is p2 and applies fixed-point iteration to Ap instead of p2. Using this notation the sequence generated is PP, PO =8P), PP = 8, PE? =(7P), PI” = 8(P)), Every third term is generated by Eq. (2.13); the others use fixed-point iteration on the previous term. The process is described in Algorithm 2.6.EXAMPLE 2 Table 2.12 2.5 Accelerating Convergence 89 Steffensen’s To find a solution to p = g(p) given an initial approximation po: INPUT initial approximation po; tolerance TOL; maximum number of iterations No. OUTPUT approximate solution p or message of failure. Step1 Seti =1 Step 2 While i < No do Steps 3-6. Step 3 Set rp, = g(po); (Compute pi.) P2 = 8(p1)i (Compute p~?.) P= Po~(Pi— Po)? /(p2—2p1 + po). (Compute p\?) Step 4 If |p — pol < TOL then OUTPUT (p); (Procedure completed successfully.) STOP. Step 5 Seti=i+1. Step 6 Set py = p. (Update pp.) Step 7 OUTPUT (‘Method failed after Np iterations, Nj (Procedure completed unsuccessfully.) STOP. . + No)s Note that A?p, may be 0, which would introduce a 0 in the denominator of the next ccurs, we terminate the sequence and select pS"~" as the approximate To solve x3 +4x?— 10 = 0 using Steffensen’s method, let x3 -+ 4x? = 10, divide by x +4, and solve for x. This procedure produces the fixed-point method 10_\'? x09 = (2) : used in Example 3(d) of Section 2.2. Steffensen’s procedure with po = 1.5 gives the values in Table 2.12. The iterate p(? = 1.365230013 is accurate to the ninth decimal place. In this example, Steffensen’s method ‘gave about the same accuracy as Newton's method (see Example 4 in Section 24). k Pa pe pe 0 15 1348399725 __1,367376372 1 1,365265224 1,365225534_1.365230583, 2 136523001390 CHAPTER 2 © Solutions of Equations in One Variable From Example 2, it appears that Steffensen's method gives quadratic convergence without evaluating a derivative, and Theorem 2.14 verifies that this is the case, The proof of this theorem can be found in (He2, pp. 90-92] or (IK, pp. 103-107} Theorem 2.14 Suppose that x = g(x) has the solution p with g/(p) # 1. If there exists a 8 > 0 such that g € C?[p — 4, p + 4], then Steffensen’s method gives quadratic convergence for any poe (p85, +5) ES EXERCISE SET 25 1 9. 10. uu. ‘The following sequences are linearly convergent. Generate the first five terms of the sequence (Bs) using Aitken’s A? method. a po =0.5, py =(2— eh + p2,)/3, nZI be p= 0.75, Py = (1/3), BT Po =05, Pe nel d= 05, pp =C0SPe1, NZI Consider the function f(x) = e + 3(In2)%e™ — (In 8)e** — (In2)°, Use Newton's method with po = 0 to approximate a zero of f. Generate terms until [Pn 1 ~ Pal < 0.0002. Construct the sequence (f,}. 1s the convergence improved? Let g(x) = cos(x — 1) and p{” = 2. Use Steffensen’s method to find p}”. Let g(x) = 1-4 (sin)? and pl = 1. Use Steffensen’s method to find p( and Steffensen’s method is applied to a function g(x) using pf = 1 and pi? = 310 obtain pi? = 0.75, What is p?? Steffensen’s method is applied to a function g(x) using pi = 1 and p = V2 to obtain 1 = 2.7802. What is p!°? Use Steffensen’s method to find, to an accuracy of 10°4, the root of x? — in (1, 2], and compare this to the results of Exercise 6 of Section 2.2. Use Steffensen’s method to find, to an accuracy of 10~*, the root of x ~ 2~* = 0 that lies in [0, 1], and compare this to the results of Exercise 8 of Section 2.2. ‘Use Steffensen’s method with po = 2 to compute an approximation to v/3 accurate to within 10"*, Compare this result with those obtained in Exercise 9 of Section 2.2 and Exercise 10 of Section 2.1 Use Steffensen’s method to approximate the solutions of the following equations to within 10° a. x= (2—e* +39)/3, where g is the function in Exercise 11(a) of Section 2.2. b. x =0.5¢sinx +cosx), where g is the function in Exercise 11(f) of Section 2.2. ¢. 3x? —e* = 0, where g is the function in Exercise 12(a) of Section 2.2 4. x —cosx =0, where g is the function in Exercise 12(b) of Section 2.2 ‘The following sequences converge to 0. Use Aitken’s A? method to generate {fx} until (Pe! <= 5x 107 0 that lies a b2.6. Zeros of Polynomials and Miller's Method 1 12. A sequence {p,) is said to be superlinearly convergent to p if a. Show that if py —» p of order afore > 1, then (pa) is superlinearly convergent to p. 1b. Show that py = 2+ is superlinearly convergent to 0 but does not converge to 0 of order a for any a > 1 13, Suppose that (p,} is superlinearly convergent to p. Show that 14, Prove Theorem 2.13. (Hint: Let 5, = (Pest — P)/(Pa— P)~ 2, and show that lima ‘Then express (Pri — P)/(Pa ~ P) in terms of 8y, By1, and 2.) 15, Let P,(x) be the nth Taylor polynomial for f(x) = e* expanded about x» = 0. a. For fixed x, show that p, = P, (x) satisfies the hypotheses of Theorem 2.13. Db. Let x = 1, and use Aitken’s A? method to generate the sequence jip,... , Bs ©. Does Aitken’s method accelerate convergence in ths situation? NEE al 2.6 Zeros of Polynomials and Miiller’s Method Theorem 2.15 Corollary 2.16 A polynomial of degree n has the form P(x) = gx" + px") Hoe bax + do, where the a,’s, called the coefficients of P, are constants and ay # 0. The zero function, P(x) = 0 for all values of x, is considered a polynomial but is assigned no degree. (Fundamental Theorem of Algebra) If P(x) is a polynomial of degree n > 1 with real or complex coefficients, then P(x) = 0 has at least one (possibly complex) root. . Although Theorem 2.15 is basic to any study of elementary functions, the usual proof requires techniques from the study of complex-function theory. The reader is referred 10 {SaS, p. 155], for the culmination of a systematic development of the topics needed to prove Theorem 2.15. ‘An important consequence of Theorem 2.15 is the following corollary. If P(x) is a polynomial of degree n > 1 with real or complex coefficients, then there exist unique constants 2x1, x3, .... Xe» possibly complex, and unique positive integers my, m2, ++ tty, Such that S01) mj =n and P(x) = a(x — 1) OE 392) .92 Corollary 2.17 Theorem 2.18 EXAMPLE 1 CHAPTER 2 = Solutions of Equations in One Varlable Corollary 2.16 states that the collection of zeros of a polynomial is unique and that, if each zero x; is counted as many times as its multiplicity m,, a polynomial of degree n has exactly m zeros. The following corollary of the Fundamental Theorem of Algebra is used often in this section and in later chapters. Let P(x) and Q(x) be polynomials of degree at most n. If x1, x2...» x4, with k > n, are distinct numbers with P(x;) = Q(xi) fori = 1,2,... ,k, then P(x) = Q(x) forall values of x. . To use Newton's method to locate approximate zeros of a polynomial P(x), we need to evaluate P(x) and P'(x) at specified values. Since P(x) and P’(x) are both polynomi- als, computational efficiency requires that the evaluation of these functions be done in the nested manner discussed in Section 1.2. Homer’s method incorporates this nesting tech- nique, and, as a consequence, requires only n multiplications and n additions to evaluate an arbitrary nth-degree polynomial (Horner's Method) Let P(x) = gx" + agaist bax + ap, If b, =a, and bp = apt besixo, fork =n—1n—2,...,1,0, then bo = P(xo). Moreover, if Q(x) = bpx"} + by nx"? + oo + bax +b, then P(x) = (x ~ x9) O(a) + bo. . Proof By the definition of Q(x), (x = xo) Q(x) + bo = (% — x0) (bux +--+ bax +1) +0 = (bax" + By ax" too + bax? + bya) = (bpxox"@! + +++ + baxox + bix0) + bo = Bax" + Baa — baxa)a™! +--+ + (bi — boxo)x + (bo ~ bi20). By the hypothesis, by = dy and by — bu+1X0 = ax, $0 (x = x0) OG) + by = P(X) and by = Pao) see Use Homer’s method to evaluate P(x) = 2x4 — 3x? 4 3x — 4 at x9 = -2. When we use hand calculation in Homer's method, we first construct a table, which suggests the syntheric division name often applied to the technique. For this problem, the table appears as follows:2.6 Zeros of Polynomials and Miller's Method 93 Coefficient Coefficient Coefficient + Coefficient Constant of x4 of x3 of x? ofx term a =2 a,=0 a =-3 a -4 baxo bs. 8 b2x0 by = b= b bt So, P(x) = (e +:2)(2x? — 4x? + 5x —7) +10. . An additional advantage of using the Horner (or synthetic-division) procedure is that, since P(x) = (x — x9) Q@) + bo, where Q(z) = yx! bytx Pp tbat + diy differentiating with respect to x gives Pix) = Q(x) + — x) O"(X)_ and P'(40) = QC). (2.14) ‘When the Newton-Raphson method is being used to find an approximate zero of a polyno- mial, P(x) and P'(x) can be evaluated in the same manner. EXAMPLE 2 Findan approximation to one of the zeros of P(x) = 2x4 ~ 3x? 4 3x4, using Newton's method and synthetic division to evaluate P(x,) and P’(x,) for each iterate ne With xo = —2 as an initial approximation, we obtained P(—2) in Example 1 by xo = -2 2 o -3 30-4 ~4 8-10 14 2 4 5-7 10 =P(-2). Using Theorem 2.18 and Eq, (2.14), Q(x) = 2x3 - 4x7 4+5x-7 and P'(-2) = Q(-2), so P’(—2) can be found by evaluating Q(—2) in a similar manner: x=-2]2 -4 5 7 4 16-42 2-8 2 -49 Q(-2) = P'(-2)94 CHAPTER 2 + Solutions of Equations in One Variable and Repeating the procedure to find x2, -1.796 | 2 0 -3 3 -4 -3.592 6.451 -6.197 5.742 =3.592 3.451 1742 = P(x) -3.592 12.902 2 7.184 16.353 —32.565 Om) P(x). So P(~1.796) = 1.742, P’(—1.796) = ~32.565, and = =1.796 - 2 x 1.2495 me 732565 ~~ Ina similar manner, x3 = —1.73897, and an actual zero to five decimal places is —1.73896, Note that the polynomial Q(x) depends on the approximation being used and changes from iterate to iterate. Algorithm 2.7 computes P (xo) and P’(xo) using Homer's method. prion Horner's 2.7 To evaluate the polynomial P(x) = yx" + appx"! $+ + ax + ag = (x — x9) (x) + bo and its derivative at xo: INPUT degree n; coefficients ao, a1,... . an Xo- OUTPUT y = P(x); z= P'(x0). Step 1 Set y= ay; (Compute b, for P.) Z=4q. (Compute b,- for Q.) Step2 For j =n—1,n—2,...,1 set y = xy taj; (Compute b; for P.) xoz+y. (Compute bj for Q.) z Step 3 Set y = xoy +9. (Compute bo for P.) Step 4 OUTPUT (y, 2); STOP. . If the Nth iterate, xy, in Newton's method is an approximate zero for P, then PQ) = & = xy) OC) + bo = (& — rw) OH) + Pw) © (@ — xv) OQ),Theorem 2.19 2.6 Zeros of Polynomials and Milller’s Method 95 sox ~ xy is an approximate factor of P(x). Letting #1 = xy be the approximate zero of P and Q(x) = Q(x) be the approximate factor gives P(x) © (@& — 1) Qi). ‘We can find a second approximate zero of P by applying Newton's method to Q(x). If P(x) is an nth-degree polynomial with n real zeros, this procedure applied repeatedly will eventually result in (n — 2) approximate zeros of P and an approximate quadratic factor Qn-2(x). At this stage, Q,2(x) = O.can be solved by the quadratic formula to find the last two approximate zeros of P. Although this method can be used to find all the approximate zeros, it depends on repeated use of approximations and can lead to inaccurate results. ‘The procedure just described is called deflation. The accuracy difficulty with deflation is due to the fact that, when we obtain the approximate zeros of P(x), Newton’s method is, used on the reduced polynomial Q,(x), that is, the polynomial having the property that P(x) © (x — By)(a — a) +++ (= F4) On (2). An approximate zero £41 of Qx will generally not approximate a root of P(x) = 0 as well as it does a root of the reduced equation Qx(x) = 0, and inaccuracy increases as k increases. One way to eliminate this difficulty is to use the reduced equations to find approximations £2, £5, ...., % to the zeros of P, and then improve these approximations by applying Newton's method to the original polynomial P(x) ‘A problem with applying Newton’s method to polynomials concerns the possibility of the polynomial having complex roots when all the coefficients are real numbers. If the ini- tial approximation using Newton’s method is a real number, all subsequent approximations will also be real numbers. One way to overcome this difficulty is to begin with a complex initial approximation and do all the computations using complex arithmetic, An alternative approach has its basis in the following theorem, If z = a + bi is a complex zero of multiplicity m of the polynomial P(x) with real coefficients, then Z = a — bi is also a zero of multiplicity m of the polynomial P(x), and (x? — 2ax +a? + b?)" isa factor of P(x). . A synthetic division involving quadratic polynomials can be devised to approximately factor the polynomial so that one term will be a quadratic polynomial whose complex roots are approximations to the roots of the original polynomial. This technique was described in some detail in our second edition [BFR]. Instead of proceeding along these lines, we will now consider a method first presented by D. E. Milller [Mu]. This technique can be used for any root-finding problema, but it is particularly useful for approximating the roots, of polynomials. Miller's method is an extension of the Secant method. The Secant method begins with two initial approximations x9 and x; and determines the next approximation x as the intersection of the x-axis with the line through (x9, f(xo)) and (x1, f(x1)). (See Figure 2.12(a).) Miller's method uses three initial approximations, x9, x1, and x2, and determines the next approximation x3 by considering the intersection of the x-axis with the parabola through (x0, f(o))s Crs FC), and (xa, f(2)). (See Figure 2.12(b).)96 CHAPTER 2 = Solutions of Equations in One Variable Figure 212 y y % 4 Pt mo HAE f f (@) (b) ‘The derivation of Miller's method begins by considering the quadratic polynomial P(x) = ae — m2) +b —m) + that passes through (xo, f(xo)), (x1, f (#1), and (x2, f (x2). The constants a, b, and c can be determined from the conditions £0) = a(xo — 2)? + b(xo — a2) te, (15) F(@1) = aay ~ 22) + B(x) — 2) +e, (2.16) and f@_)=a-P+b-04+c5c (2.17) tobe c= fla), (2.18) p= 2) Uf Ca) = fa) = C1 = 271 (0) = fea) 2.19) (Go — 2)(a1 = 22) (0 — *1) and a LF (x0) — f@2)) — Go — x21 f 1) — f2)] (Xo ~ 2)(a1 — 22)(%0 — 11) a To determine x3, a zero of P, we apply the quadratic formula to P(x) = 0, However, because of roundoff error problems caused by the subtraction of nearly equal numbers, we apply the formula in the manner prescribed in Example 5 of Section 1.2: —_ se b+ Ve Fac Bons2.8 2.6 Zeros of Polynomials and Miller's Method 97 ‘This formula gives two possibilities for x3, depending on the sign preceding the radical term. In Miiller’s method, the sign is chosen to agree with the sign of b. Chosen in this manner, the denominator will be the largest in magnitude and will result in x3 being se- lected as the closest zero of P to x2. Thus, 26 y= ap ~ ee, b+ sgn(b)/B? — 4ac where a, b, and c are given in Bq. (2.15). Once x3 is determined, the procedure is reinitialized using x), x2, and x3 in place of Xo, X1, and x2 to determine the next approximation, xs. The method continues until a sat- isfactory conclusion is obtained. At each step, the method involves the radical VB? — 4ac, so the method gives approximate complex roots when b? — 4ac < 0, Algorithm 2.8 imple- ‘ments this procedure. Miller's To find a solution to f(x) = 0 given three approximations, xo, x1, and x9: INPUT xo, x1,.%23 tolerance TOL; maximum number of iterations No. OUTPUT approximate solution p or message of failure. Step 1 Set hy = x1 — x0; 15 (£@1) — Fx0))/has (FQ2) = fs))/ has (82 — 81)/(ha + ha); Step 2 While i < No do Steps 3-7. Step3 b= 5) + hd; D = (b ~4f(x2)d)"?, (Note: May require complex arithmetic.) Step 4 If |b — D| < |b+ Di thenset E =b+D else set E = b — D. ~2f (2) /Es ath Step 5 Set P Step 6 If |h| < TOL then OUTPUT (p); (The procedure was successful.) Step 7 (Prepare for next iteration.) 51 = (F(a) — fG0))/his98 CHAPTER 2 + Solutions of Equations in One Variable 82 = (f (2) ~ FQ) / has (82 — 61)/(ha + ha) i=i¢l Step 8 OUTPUT (‘Method failed after Np iterations, No =". (The procedure was unsuccessful.) STOP. . EXAMPLE 3 — Consider the polynomial f(x) = 16x* — 40x? + 5x? + 20x +6. Using Algorithm 2.8 with = 10° and different values of xo, x1, and x produces the results in Table 2.13 Table 2.13 a 05, x i F(a) 3 -0.595556+0.598352i —29.4007 ~ 3.898721 4 ~0.435450 + 0.1021011 1.33223 ~ 1.19309 5 -0,390631 + 0.141852 0.375057 ~ 0.670164 6 -0.357699 + 0.169926i 0.146746 ~ 0.00744629i 7 -0.356051 + 0.162856i =0.183868 x 10-? + 0.539780 x 10-7 8 0.356062 + 0.162758 0.286102 x 10-§ + 0.953674 x 10-* b %=05, m= 10, m=15 i fea 3 128785 — 1.37624 4 (1.23746 0.126941 5 1.24160 0.219440 x 10-7 6 (1.24168 0.257492 x 104 7 124168 0.257492 x 10+ xo=25, m=20, m= 225 i % FO) 3 196059 —0.611255 4 197056 0.748825 x 10-2 5 197044 0.295639 x 10-4 6 197044 —0.259639 x 10-4 We used Maple to generate part (c) in Table 2.13. To do this, we defined f(x) and the initial approximations by x-P164K" 4-404" 345472420446 >p0:=0.5; pl:=-0.5; p2:=0.0;2.6 Zeros of Polynomials and Muller's Method 99 We evaluated the polynomial at the initial values >£0:=f (pO); f1:=f(pi); £2:-£(p2); and computed ¢ = 6, b = 10, a = 9, and py = —0.5555555558 + 0.5983516452i using the Miller's method formulas: £2; ((p0=p2)~24 (f1-£2) - (p1=p2)"}2* (£0-£2) )/ ((pO-p2) * (p1-p2)+ (p0-p1)); ( (pi~p2)* (£0-£2) ~ (pO~p2) # (£12) )/ ((p0-p2)* (p1~p2)# (p0-p1)) ; >p3:=p2- (2c) /(b+(b/abs (b))#sqrt (b"2-4"atc)); The value p; was generated using complex arithmetic, as is the calculation >£3:=£(p3); which gives fy = —29.40070112 -- 3.898724738i. . The actual values for the roots of the equation are 1.241677, 1.970446, and 0.356062 +£0.162758i, which demonstrates the accuracy of the approximations from Miiller's method. . Example 3 illustrates that Muller's method can approximate the roots of polynomi- als with a variety of starting values. In fact, Miller's method generally converges to the root of a polynomial for any initial approximation choice, although problems can be con- structed for which convergence will not occur. For example, suppose that for some i we have f(x:) = f (x41) = f ti42) # 0. The quadratic equation then reduces to a nonzero constant function and never intersects the x-axis. This is not usually the case, however, and ‘general-purpose software packages using Miiller's method request only one initial approx- imation per root and will even supply this approximation as an option. ae SS EXERCISE SET 26 1, Find the approximations to within 10~* to all the real zeros of the following polynomials using, Newton's method. a f(x) be f(x) & f@) a. f(x) = x4 + 2x? - 2-3 fle) =x + 4.0012 +.4.002e + 1.101 fo f(x)ax8 ax $28 ast ted 2, Find approximations to within 10~§ to all the zeros of each of the following polynomials by first finding the real zeros using Newton’s method and then reducing to polynomials of lower degree to determine any complex zeros.100 CHAPTER 2 * Solutlons of Equations in One Vartable 3 10. uw a f(x) = x4 + Sx? - 9x? — 85x — 136 bfx) = xt — 22? - 12s? + 16x — 40 ce f@) sates 43x? 42042 @ f(x) = x5 + xt — 21x? — 10x? - 21x -5 efx) = 16x4 + 88x? + 1593? + 76x — 240 f f(yaxt— ax? 3x $5 B fedex 4 tar 44 he f(x) =x — 7x? + 14x -6 [Repeat Exercise 1 using Miller's method. Repeat Exercise 2 using Miller's method. ‘Use Newton's method to find, within 10, the zeros and critical points of the following func- tions. Use this information to sketch the graph of f. a fa) =x - 9? +12 bf) sa! 20 — 5x7 + 12x -5 £4) = 10x? — 8.32? +2.295x — 0.21141 = Ohas a root at x = 0.29. Use Newton's method ‘with an initial approximation x = 0.28 to attempt to find this root. Explain what happens. Use Maple to find the exact roots of the polynomial f(x) = x9 + 4x — 4. ‘Use Maple to find the exact roots of the polynomial f(x) = x? — 2x — 5. Use each of the following methods to find a solution in [0.1, 1] accurate to within 10~* for 600x4 — 550x? + 200x? — 20x - 1 =0. &.Bisection method b. Newton’s method . Secant method d. method of False Position Miller's method ‘Two ladders crisscross an alley of width W. Each ladder reaches from the base of one wall to some point on the opposite wall. The ladders cross at a height H above the pavement. Find W ‘given that the lengths of the ladders are x; = 20 ft and xz = 30/ft, and that H = 8 ft. x, -}—w— ‘A.can in the shape of a right circular cylinder is to be constructed to contain 1000 em?. The circular top and bottom of the can must have a radius of 0.25 cm more than the radius of the ‘can so that the excess can be used to form a seal with the side. The sheet of material being formed into the side of the can must also be 0.25 cm longer than the circumference of the can so that a seal can be formed. Find, to within 10~, the minimal amount of material needed to ‘construct the can,2.7. Survey of Methods and Software 101 12, In 1224, Leonardo of Pisa, better known as Fibonacci, answered a mathematical challenge of, ‘John of Palermo in the presence of Emperor Frederick II: find a root of the equation x° + 2x?-+ 10x = 20. He first showed that the equation had no rational roots and no Euclidean irrational root—that is, no root in any of the forms a + Vb, /@+ Vb, Via + Vb, ot y/ Ja Vb, where ‘a and 6 are rational numbers. He then approximated the only real root, probably using an algebraic technique of Omar Khayyam involving the intersection of a circle and a parabola. Hiis answer was given in the base-60 number system as 1+22( ‘How accurate was his approximation? Henne en ee 2.7 Survey of Methods and Software In this chapter we have considered the problem of solving the equation f(x) = 0, where {f isa given continuous function. All the methods begin with an initial approximation and {generate a sequence that converges to a root of the equation, if the method is successful. If [a, 6] is an interval on which f(a) and f(b) are of opposite sign, then the Bisection method and the method of False Position will converge. However, the convergence of these methods may be slow. Faster convergence is generally obtained using the Secant method or Newton's method. Good initial approximations are required for these methods, two for ‘the Secant method and one for Newton's method, so the Bisection or the False Position method can be used as starter methods for the Secant or Newton's method. Miller's method will give rapid convergence without a particularly good initial ap- proximation. It is not quite as efficient as Newton's method; its order of convergence near a root is approximately a = 1.84, compared to the quadratic, « = 2, order of New- ton’s method. However, it is better than the Secant method, whose order is approximately a = 1.62, and it has the added advantage of being able to approximate complex roots. Deflation is generally used with Muller's method once an approximate root of a poly- nomial has been determined. After an approximation to the root of the deflated equation has been determined, use either Miller's method or Newton's method in the original poly-102 CHAPTER 2 + Solutions of Equations in One Variable nomial with this root as the initial approximation. This procedure will ensure that the root being approximated is a solution to the true equation, not to the deflated equation. We recommended Miiller’s method for finding all the zeros of polynomials, real or complex. Miiller’s method can also be used for an arbitrary continuous function. Other high-order methods are available for determining the roots of polynomials. If this topic is of particular interest, we recommend that consideration be given to Laguerre’s method, which gives cubic convergence and also approximates complex roots (see [Ho, pp. 176-179] for a complete discussion), the Jenkins-Traub method (see [JT], and Brent’s method (see [Bre)). Another method of interest, Cauchy's method, is similar to Miller's method but avoids the failure problem of Miiller’s method when f(x;) = f(xi+1) = f (4:42), for some i. For an interesting discussion of this method, as well as more detail on Miiller's method, we recommend [YG, Sections 4.10, 4.11, and 5.4] Given a specified function f and a tolerance, an efficient program should produce an approximation to one or more solutions of f(x) = 0, each having an absolute or relative error within the tolerance, and the results should be generated in a reasonable amount of time. If the program cannot accomplish this task, it should at least give meaningful explanations of why success was not obtained and an indication of how to remedy the cause of failure, ‘The IMSL FORTRAN subroutine ZANLY uses Milller’s method with deflation to approximate a number of roots of f(x) = 0. The routine ZBREN, due to R. P. Brent, uses a combination of linear interpolation, an inverse quadratic interpolation similar to ‘Milller’s method, and the Bisection method. It requires specifying an interval [a, b) that contains a root. The IMSL C routine f_zeros.fen and FORTRAN routine ZREAL are based on a variation of Miller's method and approximate zeros of a real function f when only poor initial approximations are available. Routines for finding zeros of polynomials are the C routine f-zeros.poly and FORTRAN routine ZPORC, which uses the Jenkins-Traub method for finding zeros of a real polynomial; ZPLRC, which uses Laguerre’s method to find zeros of a real polynomial; and the C routine ¢.zeros.poly and FORTRAN routine ZPOCC, which use the Jenkins-Traub method to find zeros of a complex polynomial. ‘The NAG C subroutine cOSade and the NAG FORTRAN subroutines COSADF and COSAZE use a combination of the Bisection method, linear interpolation, and extrapolation. to approximate a real zero of f(x) = 0 in the interval [a, b]. The subroutine COSAGF is similar to COSADF but requires a single starting value instead of an interval and returns an interval containing a root on its own. The NAG FORTRAN subroutines COSAJF and COSAXF use a continuation method with a Secant iteration to approximate the real zero of a function. Also, NAG supplies subroutines CO2AGF and CO2AFF to approximate all zeros of a real polynomial or complex polynomial, respectively. Both subroutines use a modified Laguerre method to find the roots of a polynomial. The netlib FORTRAN subroutine fzero.f uses a combination of the Bisection and Se- cant method developed by T. J. Dekker to approximate a real zero of f(x) = 0 in the interval [a, b]. It requires specifying an interval [@, 6] that contains a root and returns an interval with a width that is within a specified tolerance. The FORTRAN subroutine sdzro.f uses a combination of the bisection method, interpolation, and extrapolation to find a real zero of f(x) = 0 in a given interval (a, b]. The routines rpzero and cpzero can be used to approximate all zeros of a real polynomial or complex polynomial, respectively. Both methods use Newton's method for systems, which will be considered in Chapter 10. All27. Survey of Methods and Software 103 routines are given in single and double precision. ‘These methods are available on the In- ternet from netlib at http://www.netlib.org/slatec/sre. Within MATLAB, the function ROOTS is used to compute all the roots, both real and complex, of a polynomial. For an arbitrary function, FZERO computes a root near a specified initial approximation to within a specified tolerance. Maple has the procedure f£s0lve to find roots of equations. For example, >fsolve(x-2 - x - 1, x); returns the numbers —.6180339887 and 1.618033989. You can also specify a particular variable and interval to search, For example, >fsolve(x°2 - x - 1,x,1..2); returns only the number 1.618033989. The command fsolve uses a variety of specialized techniques that depend on the particular form of the equation or system of equations. Notice that in spite of the diversity of methods, the professionally written packages are based primarily on the methods and principles discussed in this chapter. You should be able to use these packages by reading the manuals accompanying the packages to better understand the parameters and the specifications of the results that are obtained. There are three books that we consider to be classics on the solution of nonlinear equations, those by Traub [Tr], by Ostrowski [Os], and by Householder [Ho]. In addition, the book by Brent [Bre] served as the basis for many of the currently used root-finding methods.CHAPTER 3 Interpolation and Polynomial Approximation A\ coneu ott poptaton othe United ttesis taken every 10ers. The following table lists the population, in thousands of people, from 1940 to 1990. Year 1940 | 1980 1960 1970 | 1980 | 1990 Population 132,165 | 151,326 | 179,323 | 203,302 | 226,542 | 249,633 (in thousands) | | Pa) 2x 108 1940 1950 1960 1970 1980 1990 2000 ¢ | “earFigure 3.1 Theorem 3.1 105 In reviewing these data, we might ask whether they could be used to provide a reasonable estimate of the population, say, in 1965 or even in + the year 2010, Predictions of this type can be obtained by using a func- tion that fits the given data, This process is called interpolation and is the subject of this chapter. This population problem is considered through- out the chapter and in Exercises 24 of Section 3.1, 14 of Section 3.2, and 24 of Section One of the most useful and well-known classes of functions mapping the set of real numbers into itself is the class of algebraic polynomials, the set of functions of the form Pal) = gx" + aX" ob ayx + a9, where n is a nonnegative integer and do, ... ,dq are real constants. One reason for their importance is that they uniformly approximate continuous functions. Given any function, defined and continuous on a closed and bounded interval, there exists a polynomial that is as “close” to the given function as desired. This result is expressed precisely in the following theorem, (See Figure 3.1.) (Weierstrass Approximation Theorem) Suppose that fis defined and continuous on {a, b]. For each ¢ > 0, there exists a polyno- mial P(x), with the property that If) — P(x) <¢, forall x in[a, 6). . ‘The proof of this theorem can be found in most elementary texts on real analysis (see, for example, [Bart, pp. 165-172)). ‘Another important reason for considering the class of polynomials in the approxima- tion of functions is that the derivative and indefinite integral of a polynomial are easy to106 Figure 3.2 CHAPTER 3 = Intepolation and Polynomial Approximation determine and are also polynomials. For these reasons, polynomials are often used for approximating continuous functions. ‘The Taylor polynomials were introduced in the first section of the book, where they were described as one of the fundamental building blocks of numerical analysis. Given this prominence, you might assume that polynomial interpolation would make heavy use of these functions. However, this is not the case. The Taylor polynomials agree as closely as possible with a given function at a specific point, but they concentrate their accuracy near that point. A good interpolation polynomial needs to provide a relatively accurate approximation over an entire interval, and Taylor polynomials do not generally do this. For example, suppose we calculate the first six Taylor polynomials about ro = 0 for f(x) = e" Since the derivatives of f(x) are all e*, which evaluated at ro = 0 gives 1, the Taylor polynomials are Polx)=1, Pix) =1+x, Ppax)altxt+ a, Px) = L4+x+ eo xt wee x Paaltxt +545, md A@aleet tba Ty The graphs of the polynomials are shown in Figure 3.2. (Notice that even for the higher-degree polynomials, the error becomes progressively worse as we move away from zero.) Although better approximations are obtained for f(x) = e* if higher-degree Taylor polynomials are used, this is not true for all functions. Consider, as an extreme example, :Table 3.1 3.1. Interpolation and the Lagrange Polynomial 107 using Taylor polynomials of various degrees for f(x) = 1/x expanded about x = 1 to approximate f(3) = }. Since faa, f') =x, f"@) = (12, and, in general, FPO) = (Dkk the Taylor polynomials are a foc " Paw) = > ao donk = Dept — Ht pad fo To approximate (3) = + by P,(3) for increasing values of n, we obtain the values in ‘Table 3.1—rather a dramatic failure! a|os 6 7 -s |u| -2 | 43 | -8s Since the Taylor polynomials have the property that all the information used in the approximation is concentrated at the single point x9, the type of difficulty that occurs here is quite common and limits Taylor polynomial approximation to the situation in which ap- proximations are needed only at points close to xo. For ordinary computational purposes it is more efficient to use methods that include information at various points, which we con- sider in the remainder of this chapter. The primary use of Taylor polynomials in numerical analysis is not for approximation purposes but for the derivation of numerical techniques and error estimation. n 0 1 2 Pr) | 1 3.1 Interpolation and the Lagrange Polynomial Since the Taylor polynomials are not appropriate for interpolation, alternative methods are needed. In this section we find approximating polynomials that are determined simply by specifying certain points on the plane through which they must pass. The problem of determining a polynomial of degree one that passes through the dis- tinct points (xo, yo) and (x1, y1) is the same as approximating a function f for which ‘Jf (%o) = yo and f (x1) = y; by means of a first-degree polynomial interpolating, or agree- ing with, the values of f at the given points. We first define the functions Lox) ==) and Lyx) = =, Xoo x0 and then define P(x) = Lolx) f 0) + Lie) f(a).Figure 33 Figure 34 CHAPTER 3 = Interpolation and Polynomial Approximation Since Lo(xo) = 1, Lo(x1) =0, Lito) =0, and Li() = 1, wwe have P(xq) = 1+ Fo) + 0+ FO) = Fo) = yo and P(x) = 0+ F(x) +1 FO) = f@) = yi So P is the unique linear function passing through (xo, yo) and (x1, yi). (See Figure 3.3.) y= fe) 1 =f) Yo = Feo) y= Pox) ‘To generalize the concept of linear interpolation, consider the construction of a poly- nomial of degree at most n that passes through the n + 1 points (Go, F (Xo). (tr, FD), «+ Ons Fn). (See Figure 3.4.)3.1._Interpolation and the Lagrange Polynomial 109 In this case we need to construct, for each k = 0,1,... .7, a function Ly,e(x) with the property that Lp.x(x;) = 0 when i # k and Ly.x(x4) = 1. To satisfy Lyx(x;) = 0 for each i # k requires that the numerator of L,,.(x) contains the term (x = xo)(e = x1) ++ tea) = Xe) = En) To satisfy Ln.x(tz) = 1, the denominator of Lq,x() must be equal to this term evaluated atx = x,. Thus, (= Xo) = Xe) = Fert) = An) Oe = 0) ++ Oe tO = X41) + Oe = Xn) A sketch of the graph of a typical L,,. is shown in Figure 3.5. Ln xa) = Figure 3.5 Lys) The interpolating polynomial is easily described once the form of Ly,. is known. This polynomial, called the nth Lagrange interpolating polynomial, is defined in the follow- ing theorem. Theorem 3.2 If xo, x1,... x, aren + 1 distinct numbers and f is a function whose values are given at these numbers, then a unique polynomial P (x) of degree at most n exists with F(x) = Pox), foreach k=0,1,....1. ‘This polynomial is given by P(x) = flo) Lno(X) +--+ Fn) Ena) = DO Fennel), G1) rad where, for each k = 0,1,... (= 4) & Fett Ln. = (3.2) MO = GaN a) ENG) OD) 1&2 . Laan" Fe We will write L,,4(x) simply as Ly (x) when there is no confusion as to its degree.110 CHAPTER 3 ~ Interpolation and Polynomial Approximation EXAMPLE 1 Using the numbers (or nodes) x9 = 2, x; = 2.5, and.xz = 4 to find the second interpolating polynomial for f(x) = 1/x requires that we determine the coefficient polynomials Lo(x), L(x), and L(x). In nested form they are (& — 2.5) - Lo) = ae (%—6.5)x +10, Lyx) = LADERA _ (ote $2) 32 = O5-na5-H 3 and (45x45 3 Since f(%0) = f(2) = 0.5, fxr) = f(2.5) = 04, and f(2) = (4) = 0.25, we have PQ) = fGdLe) c= =0.5((x — 6.5)x +10) +04 tee +0, aS ton ts = (0.05x — 0.425)x + LIS. An approximation to f (3) = } (see Figure 3.6) is £(3) © PG) = 0.325 Figure 3.6 & —. Compare this to Table 3.1, where no ayer polynomial, expanded about xp = 1, could be used to reasonably approximate f (3) =Theorem 3.3 3.1. Interpolation and the Lagrange Polynomial 11 We can use a CAS to construct an interpolating polynomial. For example, in Maple we use >interp(X,Y,x); where X is the list [xo, ... , xp], ¥ is the list [f(x0), ..- » {(Gtq)], and x is the variable to be used. In this example we can generate the interpolating polynomial p = 0.05x? —0.425x-+ 1.15 with the command >p:sinterp([2,2.5,4], [0.5,0.4,0.25] ,x); To evaluate p(3) as an approximation to f(3) = }, enter >subs(x=3,p); which gives 0.325. ‘The next step is to calculate a remainder term or bound for the error involved in ap- proximating a function by an interpolating polynomial. This is done in the following theo- rem. Suppose Xo, X1,... ,%q are distinct numbers in the interval [a, b] and f = C"*![a, b]. ‘Then, for each x in [a, b], a number (x) in (a, b) exists with FOP ER) F(A) = POD + Ty A a) = de (3.3) where P(x) is the interpolating polynomial given in Eq. (3.1). . Proof Note first that if x = xy, for any k = 0,1,...,n, then f(x,) = P(x), and Olen, choosing &(x,) arbitrarily in (a,b) yields Eq. (3.3). If x # xx, for all k define the function g for ¢ in [a, b] by (= mo) 0) = (ea) A) te) a(t) = f(t) — P®) - (Ff) - PANG =x) =f) - PO) - [fF @) - roll =) Since f € C"*fa, b], and P € C™[a, b], it follows that g € C"*![a, b]. For f= x, we have Fy (k=) _ 80%) = fae) — PO) -(f@) - Po] — (f(x) — PQ) -0= 0. (x =m) Moreover, (8) =f) — P(x) -[f@)— PO) te e3 = f(x) = P(x) Lf) ~ PO) Thus, ¢ € C"*"[a, 6], and g is zero at the n +2 distinct numbers x, x0, x1, ... . Xn. By the Generalized Rolle’s Theorem, there exists a number £ in (a, 6) for which ¢*"'() = 0.12 EXAMPLE 2 CHAPTER 3 + Interpolation and Polynomial Approximation So a x = PE = fore) — nig) —(7a)— Poot | | it aa. GA) Since P(x) is a polynomial of degree at most n, the (n + 1)st derivative, P"+ (x), is identically zero. Also, []?_ol(t — x:)/(« — x,)] is a polynomial of degree (n + 1), so tt Gox) [rete | + (lower-degree terms in 1), =m) LTio@ — =) and qt x) (+I! ant i @=a) ~ Tio - =) Equation (3.4) now becomes SOME) — 0 — LF (2) — POD} and, upon solving for f(x), we have F(x) = PQ) + T]@-»- sae see ne The error formula in Theorem 3.3 is an important theoretical result because Lagrange polynomials are used extensively for deriving numerical differentiation and integration methods. Error bounds for these techniques are obtained from the Lagrange error formula. Note that the error form for the Lagrange polynomial is quite similar to that for the ‘Taylor polynomial. The nth Taylor polynomial about xo concentrates all the known infor- mation at x9 and has an error term of the form LEP EG) G@+D! The Lagrange polynomial of degree n uses information at the distinct numbers xo, x1, .%n and, in place of (x — xo)", its error formula uses a product of the n + I terms (8 20), =D aE f£OP EG) (+)! ‘The specific use of this error formula is restricted to those functions whose derivatives have known bounds. (= x9)" (a = x0)(x = a1) +++ Ot ~ ap). ‘Suppose a table is to be prepared for the function f(x) = e*, for x in {0, 1]. Assume the number of decimal places to be given per entry is d > 8 and that the difference between adjacent x-values, the step size, is h. What should h be for linear interpolation (that is, the Lagrange polynomial of degree 1) to give an absolute error of at most 10°?EXAMPLE 3 Table 3.2 3.1 Interpolation and the Lagrange Polynomial 113 Let xo, x1,-.. be the numbers at which f is evaluated, x be in [0,1], and suppose j satisfies x; 2. . Definition 3.7 implies that 1 Slim tet) EVFGH) fen te1.te a= VF On, and, in general, 1 Sin Sects ee nou) = GEV FO). Consequently, s+ De - SOF gage) gece g SEED HE tN= Dow rey Pala) = flea) +5V Gx) + >128 EXAMPLE 2 Table 3.9 CHAPTER 3 = Intepolation and Polynomial Approximation If we extend the binomial coefficient notation to include all real values of s by letting sot Io G+k-) bi _yt then Poo = Staale(-D'(5 ‘Yvroar-i( Se Fan +eu(? “Yer rose which gives the following result. Newton Backward-Difference Formula = stl) vt pox Pala) = Seal + YC HD) (Z) f(a) G.13) ‘The divided-difference Table 3.9 corresponds to the data in Example 1 First Second Third Fourth, divided divided ided divided differences differences differences differences 10 0.765197 0.4837057 13 0.6200860 0.108739 —0.5489460 16 0.455402 0.044433 0,0018251 ~0.5786120 . 19) 0.2818186 22 0.103623 Only one interpolating polynomial of degree at most 4 uses these five data points, but ‘we will organize the data points to obtain the best interpolation approximations of degrees 1, 2, and 3. This will give us a sense of accuracy of the fourth-degree approximation for the given value of x. If an approximation to f (1.1) is required, the reasonable choice for the nodes would be Xo = 1.0, x = 1.3, x2 = 1.6, x3 = 1.9, and xz = 2.2 since this choice makes the earliest possible use of the data points closest to x = 1.1, and also makes use of the fourth divided difference. This implies that h = 0.3 and s = 4, so the Newton forward divided-difference formula is used with the divided differences that have a solid underscore in Table 3.9: 1 Pa(L.l) = Pa(l.0-+ 50.3)) = 0.7651997 + $10.3)(-0.4837057) + ; (- 3) (0.3)°(—0.1087339)3.2. Divided Diferences 129 1(2\(5\ aos +4 (-3) (-3) (0.3)3(0.0658784) 1(_2\(_5\(_8 ‘, +5 (-3) (-3) (-3) (0.3)*(0.0018251) = 0.7196480. To approximate a value when x is close to the end of the tabulated values, say, x we would again like to make the earliest use of the data points closest to x. This re using the Newton backward divided-difference formula with s differences in Table 3.9 that have a dashed underscore: 100)=n(22- 203) = 0.1103623 2(1\(4 -3(3) (3) (0.3)3(0.0680685) 0.238754, . Fos -0 5715210) ‘The Newton formulas are not appropriate for approximating f(x) when x lies near the center of the table since employing either the backward or forward method in such @ way ‘that the highest-order difference is involved will not allow x9 to be close to x. A number of divided-difference formulas are available for this case, each of which has situations when it can be used to maximum advantage. These methods are known as centered-difference formulas. There are a number of such methods, but we will present only one, Stirling's method, and again refer the interested reader to [Hild] for a more complete presentation, For the centered-difference formulas, we choose x9 near the point being approxi- mated and label the nodes directly below xo as x1, X2, and those directly above as X-1) 4-2)...» With this convention, Stirling’s formula is given by h 2 Pa) = Pans) = fla) + Fle 30) + Flo.) +54? Fle. x0.¥1) B14) 1a + LoD pa, ais toot + Flx-1 40041 a2) tee $5265? = 165? = 4) 2 (8? = Om = DPV f Beams oo Sin) 1). (9? =m )nm! 2 if n = 2m +1 is odd. If n = 2m is even, we use the same formula but delete the last line. ‘The entries used for this formula are underlined in Table 3.10 on page 130. (s? + (feamaty oo im) + fleas oo mts EXAMPLE 3 Consider the table of data that was given in the previous examples. To use Stirling's formula to approximate f (1.5) with xo = 1.6, we use the underlined entries in the difference Table 3A.130 Table 3.10 Table 3.11 CHAPTER 3 - Interpolation and Polynomial Approximation First Second Third Fourth divided divided divided divided x f(x) differences__differences differences differences xa flea) Flat] xa flxal S241, 40) les, x0) fle Ho, x1] xo fled fle1 0.41) Flea, x1, 20.41, 22) fl0.%1] flea X00 X12] a fll Pleo. x1. 2] Fle, x2] v2 fel First Second Third Fourth divided divided divided divided x F(x) differences differences differences differences 10 0.7651977 =0.4837057 13 0,6200860 —0.1087339 0.5489460 0.0658784 16 0.454022 =0.0494433 0.0018251 =0.5786120 (0.0680685 1.9 0,2818186 0.018183 -0.5715210 22 0.103623 = oassaon2 + (-3) ( %) ((-0.5489460) + (—0.5786120)) 1? + (-3) (0.3)?(—0.0494433) 17.1 1)? 5 7 + z (-4) (4) - ‘) (0.3)° (0.0658784 + 0.0680685) nefy ye +(-3 ((-) -1) (0.3)*(0.0018251) = 0.5118200. .32 Divided Differences 131 SS EXERCISE SET 3.2 L 2 Use Newton's interpolatory divided-difference formula or Algorithm 3.2 to construct inter- polating polynomials of degree one, two, and three for the following data, Approximate the specified value using each of the polynomials. a. f(8.4) if f(8.1) = 16.94410, f(8.3) = 17.56492, (8.6) = 18.50515, f(8.7) = 18.82091 b. FO) if f(0.6) = —0.17694460, f(0.7) = 0.01375227, (0.8) = 0.22363362, ‘F(1.0) = 0.65809197 Use Newton's forward-difference formula to construct interpolating polynomials of degree ‘one, Wo, and three forthe following data, Approximate the specified value using each of the polynomials. a f(-4) if f(-0.75) = —0.07181250, f(-0.5) = -0.02475000, f(-0.25) = 0.33493750, # (0) = 1.10100000 b. (0.25) if f(0.1) = —0.62049958, 7 (0.2) = —-0.28398668, (0.3) = 0.00660095, £ (0.4) = 0.24842440 Use Newton's backward-difference formula to construct interpolating polynomials of degree ‘one, two, and three for the following data, Approximate the specified value using each of the polynomials. a. f(-4) if f(-0.75) = —0.07181250, f(-0.5) = -0.02475000, f(-0.25) = 0.33493750, (0) = 1.10100000 db. £(0.25) if f(0.1) = —0.62049958, (0.2) = —0.28398668, f (0.3) = 0.00660095, (0.4) = 0.24842440 a. Use Algorithm 3.2 to construct the interpolating polynomial of degree four for the un- ‘equally spaced points given in the following table: f@) 6.00000 o.1 | -5.89483 03 | -5.65014 06 | ~5.17788 Lo | —4.28172 b. Add f(1-1) = —3.99583 to the table, and construct the interpolating polynomial of degree five. Approximate (0.05) using the following data and the Newton forward divided- difference formula: 00 [02 fos 06 Jos Fea) | 1.00000 | 1.22140 | 1.49182 | 1.82212 | 2.22558 D. Use the Newton backward divided-difference formula to approximate (0.65) €. Use Stirling’s formula to approximate (0.43), Show that the polynomial interpolating the following data has degree 3.132 CHAPTER 3 + Interpolation and Polynomial Approximation 7. a. Show that the Newton forward divided-difference polynomials, P(x) = 3-2 +1) +0 + DG) + & + D@E-1) and QU) = 144 +2) -3G $+ DEED $+ DOEF DE) both interpolate the data x -2|-1/0 1/2 ye -1[ 3[1[-1[3 'b. Why does part (a) not violate the uniqueness property of interpolating polynomials? 8. A fourth-degree polynomial P(x) satisfies A‘P(0) = 24, A®P(0) = 6, and A?P(0) = where AP(x) = P(x +1) — P(x). Compute A?P(10), 9. The following data are given for a polynomial P(x) of unknown degree. x jo] 1]2 Pa@) 2|-1/4 Determine the coefficient of x? in P(x) if all third-order forward differences are 1 10. The following data are given for a polynomial P(x) of unknown degree. x [Of1] 2) 3 P@|4folis| is Determine the coefficient of x* in P(x) if all fourth-order forward differences are 1 11. The Newton forward divided-difference formula is used to approximate f (0.3) given the fol- lowing data. 02) 04| 06 f(s) | 15.0 | 21.0 | 30.0 | Si Suppose it is discovered that (0.4) was understated by 10 and (0.6) was overstated by 5. By what amount should the approximation to f(0.3) be changed? 12. Fora function f, the Newton's interpolatory divided-difference formula gives the interpolating polynomial P(x) = 1 +e + 4x(x - 0.25) + eee —0.25)(x -0.5), (on the nodes xo = 0, x1 = 0.25, x = 0.5 and x5 = 0.75. Find (0.75), 13, Fora function f, the forward divided differences are given by Ft. 1) ftom.) =F Sls x2] = 10 Determine the missing entries in the table.3.3 Hermite interpolation 133 14, a, The introduction to this chapter included a table listing the population of the United States from 1940 to 1990. Use appropriate divided differences to approximate the population in the years 1930, 1965, and 2010. . The population in 1930 was approximately 123,203,000. How accurate do you think your 1965 and 2010 figures are?” 15. Given Py(x) = flto + flto. tra ~ x0) + ag(x — x0) = 41) fay(x = ap)(x = xy) = an) +++ 4 a6 — aa )(X = 1) ee ruse P, (x3) to show that ay = fx, x1, x2) 16, Show that fog) Gt” FUR Hty eo ne for some &(x). (Aint: From Eq. (3.3), - £6) Fa) = Pala + FEE Cx — 20) — a). Considering the interpolation polynomial of degree m+ 1 on xo, 815. ++ yeu, WE have F(R) = Pre (0) = Pal) + FE, Ay oo ony AIG = Ho) (=) 17. Loti. i, ... yy be a rearrangement of the integers 0, 1, ... .. Show that flxigs i. ---s Xi] = fl%o, Xi, «4 Xq)- [Hint: Consider the leading coefficient of the nth Lagrange polynomial fom the data (x04.t1¢.0+ «e} = (pe Sigs +i] LS 3.3 Hermite Interpolation Osculating polynomials generalize both the Taylor polynomials and the Lagrange poly- nomials. Suppose that we are given n + 1 distinct numbers x9, x),... ,%» in (a, b]-and nonnegative integers mo, m1,...,™®q, and m = max{mo, m;,... mq). The osculating polynomial approximating a function f ¢ C"[a, b] at x;, for each i = 0,... ,, is the polynomial of least degree with the property that it agrees with the function and all its derivatives of order less than or equal to m, at x;. The degree of this osculating polynomial is at most M=Som+n ms because the number of conditions to be satisfied is 77g mi + (n + 1), and a polynomial of degree M has M + 1 coefficients that can be used to satisfy these condit134 Definition 3.8 Theorem 3.9 CHAPTER 3. = Interpolation and Polynomial Approximation Let x0, x1, ..- +t, be m+ I distinct numbers in {a, b] and m; be a nonnegative integer asso- ciated with x;, for = 0, 1,... ,n. Suppose that f € C"[a, 6], where m = maxoxien ™ ‘The osculating polynomial approximating f is the polynomial P(x) of least degree such that ' aA P(x) _ d*f dxt ~ dxk » foreachi=0,1,...,0° and k=0,1,...,m . Note that when 1 = 0, the osculating polynomial.approximating is the moth Taylor polynomial for f at xo. When m; = 0 for each i, the osculating polynomial is the nth ‘Lagrange polynomial interpolating f on x0,X1, +6. «Xn ‘The case when m, = 1, for each i = 0, 1... ,n, gives the Hermite polynomials. For ‘a given function f, these polynomials agree with fat xo,1,... ,n. In addition, since their first derivatives agree with those of f, they have the same “shape” as the function at (x, f(%))) in the sense that the tangent lines'to the polynomial and to the function agree. We will restrict our study of osculating polynomials to this situation and consider first a theorem that describes precisely the form of the Hermite polynomials. If f € C'[a, b] and xo, ... , , € [a, b} are distinct, the unique polynomial of least degree agreeing with f and f’ at xo, ... , %, is the Hermite polynomial of degree at most 2n + 1 given by Hansi) = > F%)Hn sj) + DO Fy) Hass i= i= where Hy 2) = (1 = 2x — x/)L4, LG, | @) and Fy, j= (x = x,)E2 (2), In this context, Ly,)(x) denotes the jth Lagrange coefficient polynomial of degree n de- fined in Eq. (3.2). Moreover, if f € C*"*[a, 5), then (= 40)... (Qn +2)! Bn 2 £ (8) = Hans (x) + LOVE), for some§ witha <§ £0) OF FA) LHD £4) -0= FO), o = te 90 Ho» +1 agrees with f at x9, x}, Xn: To show the agreement of H;,,,, with J’ at the nodes, first note that L(x) is a factor of Hy ,(x), 80 Hf, (i) = O when i # j. In addition, when i = j and L,.i(%) = 1, we have Hg a4) = 21,05) Lh Gai) + (1 = 2044 = aL, ZL ADL y 4) = 214, (4) + 20}, (xi) = 0. Hence, Hy, (xj) = 0 for all i and j. Finally, Fy (aa) = LF 00a) + Ce = x) 2La EDLY, (40 = Lp jt ba 0) +204 = L010), so HY, ,(x;) =Oifi ¢ j and Ay ,(x;) = 1. Combining these facts, we have Hyp) = Yo FO) 0+ Df’) 04 f)-1= fad j= jab Jet Therefore, Han+1 agrees with f and Hy, with f’ at xo,%1,... Xn ‘The uniqueness of this polynomial and the error formula are considered in Exercise 8. Use the Hermite polynomial that agrees with the data listed in Table 3.12 to find an ap- proximation of (1.5).136 Table 3.12 CHAPTER 3. = Intepolation and Polynomial Approximation kon £64) i) 0 13 0.6200860 0.520232 1 16 04554022. ——0.5698959 219 02818186 11ST We first compute the Lagrange polynomials and their derivatives. This gives (w—x)@—x) 50, 175, 152 100.175 Lyo(x) = RoE) rT Lyo(x) = ex — 209) = GaGa) 9 OTTO 2002) = tg 100, , 320 247 LQ) = 200, 320 9 a an) 9 and (x= x0)(@ =m) 104 : 100 faa = a) a" baal) = 9 The polynomials H,;(x) and A, ;(x) are then 2 o(X) = [= 2 ~ 1.3)(-5)] (3. 2 By 12) 9 9 50,,_ 175, 152 2 (10x, 19) (2s oo 100, 320. 247\* Hoi(x) =1 +i), ats) (S +o >) _ 50,2 _ 145 4 toe 2 Hy, 2(x) = 10(2 (Fx > 9 9) . . 50 175 412) Ago(x) = (x — 1.3) ( =x? - x ols) = ¢ ee eae), 2 Base) = = 1.6 (= +P. - 2) . and Aya) = -19(F Finally, Hs(x) = 0.6200860H, o(x) + 0.455402 Hp,1(x) + 0.2818186H2 2(x) = 0,5220232Ah o(x) — 0.5698959 Fh, (x) — 0.581157] Fh.2(x)3.3. Hermite interpolation 137 and 4 4 5 Hs(1.5) = 0.621 = ) +0.4554022 ( ~ ) +0.281 = (1.5) = 0. 0850 ( +) + 024 (3)+ sis6(=) 4 =32 0.52202 =) ~ ==) -o.s811571 32 (4s) o.seasaso (=) o.s8115 ( = 05118277, a result that is accurate to the places listed . Although Theorem 3.9 provides a complete description of the Hermite polynomials, it is clear from Example | that the need to determine and evaluate the Lagrange polynomials and their derivatives makes the procedure tedious even for small values of n. An alternative method for generating Hermite approximations has as its basis the Newton interpolatory divided-difference formula (3.10) for the Lagrange polynomial at x0, 1, -.. sn, XJ ~ 80) OF = Hs Pax) = FO + DO F001 it and the connection between the nth divided difference and the nth derivative of f, as outlined in Theorem 3.6 in Section 3.2. ‘Suppose that the distinct numbers x9, x1,... ,%, are given together with the values of J and f’ at these numbers. Define a new sequence zo, 21, ... » Zan41 BY 2 =a =H, foreachi=0,1,....m, and construct the divided difference table in the form of Table 3.7 that uses zp, 21, .--+ Zant: Since zz; = cas; = x) for each i, we cannot define f[z2, z2/+1] by the divided difference formula. If we assume, based on Theorem 3.6, that the reasonable substitution in this situation is f[2xj, zai+1] = f’(@ai) = f’(%i), we can use the entries SF (40), fC). sf On) in place of the undefined first divided differences Fiza, 21), flza, 23], «+.» Fans Zang]: ‘The remaining divided differences are produced as usual, and the appropriate divided dif- ferences are employed in Newton's interpolatory divided-difference formula. Table 3.13 shows the entries that are used for the first three divided-difference columns when de- termining the Hermite polynomial Hs(x) for xo, x1, and xp. The remaining entries are generated in the same manner as in Table 3.7. The Hermite polynomial is given by eH Hanxi (x) = Flzol + >>) Feo, +++ + Za — Zoe ~ Za) ~ B=). cot A proof of this fact can be found in [Po, p. 56]138 Table 3.13 EXAMPLE 2 Table 3.14 CHAPTER 3 = Intepolation and Polynomial Approximation First divided ‘Second divided z f@ differences differences = %9 — flzo) = f(x) fl20, 211 = f'Gxo) nam flel= Soa flzo, 21.22) Angle al Flan zal = fala fe nen flel= se) Flom tng) = Hee Les Flea, 23] = #04) 1 J [ 1 nen flel=sov Flan 25,24) = Leste = fleas flex 2 = =} wen flel= fx) Sle 24, 25) = Een) of ad Flea, zs] = f'(a) gem files) = fe) ‘The entries in Table 3.14 use the data given in Example 1. The underlined entries are the given data; the remainder are generated by the standard divided-difference formula (3.9): Hs(1.5) = 0.6200860 + (1.5 — 1.3)(—0.5220232) + (1.5 — 1.3)°(—0.0897427) + (1.5 = 1.3)7(1.5 — 1.6)(0.0663657) + (1.5 — 1.3)°(1.5 — 1.6)*(0.0026663) + (LS ~ 1.37.5 ~ 1.6)°(1.5 ~ 1.9)(—0.0027738) = 0.511827, . 13 0,6200860 =0.5220232 1.3 046200860 —0.0897427 ~ —0.5489460 0.063657 0.455402 = 0.0698330 0.002663, —0.5698959 0.067965 =0.0027738 1.6 0.455402 =0.0290537 0.0010020 ~ ~~ ~0,5786120 0.0685667 19 02818186 0.084837 — -0.5811571 19 0,2818186 The technique used in Algorithm 3.3 can be extended for use in determining other osculating polynomials. A concise discussion of the procedures can be found in [Po, pp. 53-57]3.3. Hermite interpolation 139 peas Hermite Interpolation 33 ‘To obtain the coefficients of the Hermite interpolating polynomial H(x) on the (n + 1) distinct numbers xo, ... , X_ for the function f: INPUT numbers x0, x1, ... . m3 Values (x0), +f (n) and f(x)... F'n). OUTPUT the numbers oo, Q1.1 Qinsianer Where H(3x) = Qoo + Qua — x0) + Q2.a0% — x0)? + Qa ~ x9)*(x = a1) + Qsa(x — x0)2(x = xy)? + F Qonst.anti = X09)? =P Oe = yO = Hy). Step 1 Fori =0.1,... .n do Steps 2 and 3. Step2 Set oa Za =X Quo = Fx): Qrso = fds Orisa = F%). Step 3 Iti #Othen set 0 = Qr-19 22,1 2b — 21-1 Step4 For =2,3,...,2n+1 - 0 for j=2.3,...,iset Q,, = Sut ins, ua tes Step 5 OUTPUT (Qo0, Qi.ty-++ » Qanti2nti)s STOP . 1 SE SSE SESS EXERCISE SET 33 1. Use Theorem 3.9 or Algorithm 3.3 to construct an approximating polynomial for the following data a box fy | fe 83 | 1756492 | 3.116256 os | 0.22363362 | 2.1691753 8.6 | 1850515 | 3.151762 1.0 | 0.65809197 | 2.0466965 © * fa) fi) ~0.0247500 0.1 | -0.62049958 | 358502082 ~0.25 | 03349375 | 2.1890000 0.2 | ~0.28398668 | 3.140327) 0 1.1010000 | 4.020000 0.3 | 0,00660095 | 2.66668043 0.4 | 0.24842440 | 2.16529366 2. The data in Exercise 1 were generated using the following functions. Use the polynomials constructed in Exercise 1 for the given value of x to approximate f(x), and calculate the actual error.