108
PART TWO

Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

  • Upload
    letuyen

  • View
    225

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PART TWO

Page 2: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

ROOTS OF EQUATIONS

PT2.1 MOTIVATION Years ago, you learned to use the quadratic formula

to solve

The values calculated with Eq. (PT2.1) are called the "roots" of Eq. (PT2.2). They repre- sent the values of x that make Eq. (PT2.2) equal to zero. Thus, we can define the root of an equation as the value of x that makes f(x) = 0. For this reason, roots are sometimes called the zeros of the equation.

Although the quadratic formula is handy for solving Eq. (PT2.2), there are many other functions for which the root cannot be determined so easily. For these cases, the numerical methods described in Chaps. 5 , 6, and 7 provide efficient means to obtain the answer.

PT2.1.1 Noncomputer Methods for Determining Roots

Before the advent of digital computers, there were several ways to solve for roots of alge- braic and transcendental equations. For some cases, the roots could be obtained by direct methods, as was done with Eq. (PT2.1). Although there were equations like this that could be solved directly, there were many more that could not. For example, even an apparently simple function such as f(x) = e-" - x cannot be solved analytically. In such instances, the only alternative is an approximate solution technique.

One method to obtain an approximate solution is to plot the function and determine where it crosses the x axis. This point, which represents the x value for which f(x) = 0, is the root. Graphical techniques are discussed at the beginning of Chaps. 5 and 6.

Although graphical methods are useful for obtaining rough estimates of roots, they are limited because of their lack of precision. An alternative approach is to use trial and error. This "technique" consists of guessing a value of x and evaluating whether f(x) is zero. If not (as is almost always the case), another guess is made, and f (x) is again evaluated to de- termine whether the new value provides a better estimate of the root. The process is re- peated until a guess is obtained that results in an f ( ~ ) that is close to zero.

Such haphazard methods are obviously inefficient and inadequate for the requirements of engineering practice. The techniques described in Part Two represent alternatives that are also approximate but employ systematic strategies to home in on the true root. As elaborated on in the following pages, the combination of these systematic methods and

Page 3: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

112 ROOTS OF EQUATIONS

computers makes the solution of most applied roots-of-equations problems a simple and efficient task.

PT2.1.2 Roots of Equations and Engineering Practice

Although they arise in other problem contexts, roots of equations frequently occur in the area of engineering design. Table PT2.1 lists several fundamental principles that are rou- tinely used in design work. As introduced in Chap. 1, mathematical equations or models derived from these principles are employed to predict dependent variables as a function of independent variables, forcing functions, and parameters. Note that in each case, the de- pendent variables reflect the state or performance of the system, whereas the parameters represent its properties or composition.

An example of such a model is the equation, derived from Newton's second law, used in Chap. 1 for the parachutist's velocity:

TABLE PT2.1 Fundamental principles used in engineering design problems.

Fundamental Dependent Independent Principle Variable Variable Parameters

Heat balance Temperature

Mass balance

Force balance

Energy balance

Newton's laws of motion

K~rchhoff's laws

Concentration 01 quantity of mass

Magnitude and direct~on of forces

Changes in the kinetic and potential-energy states of the system

Acceleration, velocity, or location

Currents and voltages in electric circuits

Time and Thermal properties position of material and

geometry of system

Time ond Chemical behavior position of rnoter~ai, mass

transfer coefficients, and geometry of system

Time and Strength of position material, structural

Time and position

Time and position

Time

properties, and geometry of system Thermal properties, mass of material, and system geometry Mass of material, system geometry, and dissipative parameters such as friction or drag Electrical properties of systems such as resistance, capacitance, and inductance

Page 4: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PT2.2 MATHEMATICAL BACKGROUND 113

where velocity v = the dependent variable, time t = the independent variable, the gravi- tational constant g = the forcing function, and the drag coefficient c and mass m = parameters. If the parameters are known, Eq. (PT2.3) can be used to predict the para- chutist's velocity as a function of time. Such computations can be performed directly be- cause u is expressed explicitly as a function of time. That is, it is isolated on one side of the equal sign.

However, suppose we had to determine the drag coefficient for a parachutist of a given mass to attain a prescribed velocity in a set time period. Although Eq. (PT2.3) provides a mathematical representation of the interrelationship among the model variables and para- meters, it cannot be solved explicitly for the drag coefficient. Try it. There is no way to re- arrange the equation so that c is isolated on one side of the equal sign. In such cases, c is said to be implicit.

This represents a real dilemma, because many engineering design problems involve specifying the properties or composition of a system (as represented by its parameters) to ensure that it performs in a desired manner (as represented by its variables). Thus, these problems often require the determination of implicit parameters.

The solution to the dilemma is provided by numerical methods for roots of equations. To solve the problem using numerical methods, it is conventional to re-express Eq. (PT2.3). This is done by subtracting the dependent variable v from both sides of the equation to give

The value of c that makes f(c) = 0 is, therefore, the root of the equation. This value also represents the drag coefficient that solves the design problem.

Part Two of this book deals with a variety of numerical and graphical methods for determining roots of relationships such as Eq. (PT2.4). These techniques can be applied to engineering design problems that are based on the fundamental principles outlined in Table PT2.1 as well as to many other problems confronted routinely in engineering practice.

PT2.2 MATHEMATICAL BACKGROUND For most of the subject areas in this book, there is usually some prerequisite mathematical background needed to successfully master the topic. For example, the concepts of error es- timation and the Taylor series expansion discussed in Chaps. 3 and 4 have direct relevance to our discussion of roots of equations. Additionally, prior to this point we have mentioned the terms "algebraic" and "transcendental" equations. It might be helpful to formally de- fine these terms and discuss how they relate to the scope of this part of the book.

By definition, a function given by y =Ax) is algebraic if it can be expressed in the form

where5 = an ith-order polynomial in x. Polynomials are a simple class of algebraic func- tions that are represented generally by

Page 5: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

114 ROOTS OF EQUATIONS

where n = the order of the polynomial and the a's = constants. Some specific examples are

and

A transcendental function is one that is nonalgebraic. These include trigonometric, exponential, logarithmic, and other, less familiar, functions. Examples are

and

f ( x ) = e-0.2X sin (3x - 0.5) (FT2.10)

Roots of equations may be either real or complex. Although there are cases where complex roots of nonpolynomials are of interest, such situations are less common than for polyno- mials. As a consequence, the standard methods for locating roots typically fall into two somewhat related but primarily distinct problem areas:

1. The determination of the real roots of algebraic and transcendental equations. These techniques are usually designed to determine the value of a single real root on the basis of foreknowledge of its approximate location.

2. The determination of all real and complex roots of polynomials. These methods are specifically designed for polynomials. They systematically determine all the roots of the polynomial rather than determining a single real root given an approximate location.

In this book we discuss both. Chapters 5 and 6 are devoted to the first category. Chapter 7 deals with polynomials.

PT2.3 ORIENTATION

Some orientation is helpful before proceeding to the numerical methods for determining roots of equations. The following is intended to give you an overview of the material in Part Two. In addition, some objectives have been included to help you focus your efforts when studying the material.

PT2.3.1 Scope and Preview

Figure PT2.1 is a schematic representation of the organization of Part Two. Examine this figure carefully, starting at the top and working clockwise.

After the present introduction, Chap. 5 is devoted to bracketing methods for finding roots. These methods start with guesses that bracket, or contain, the root and then system- atically reduce the width of the bracket. Two specific methods are covered: bisection and false position. Graphical methods are used to provide visual insight into the techniques. Error formulations are developed to help you determine how much computational effort is required to estimate the root to a prespecified level of precision.

Page 6: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PT2.3 ORIENTATION 115

FIGURE PT2.1 Schematic of the organization of the material in Part Two: Roots of Equations

Chapter 6 covers open methods. These methods also involve systematic trial-and-error iterations but do not require that the initial guesses bracket the root. We will discover that these methods are usually more computationally efficient than bracketing methods, but that they do not always work. One-point iteration, Newton-Raphson, and secant methods are described. Graphical methods are used to provide geometric insight into cases where the

Page 7: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

116 ROOTS OF EQUATIONS

open methods do not work. Formulas are developed that provide an idea of how fast open methods home in on the root. In addition, an approach to extend the Newton-Raphson method to systems of nonlinear equations is explained.

Chapter 7 is devoted to finding the roots ofpolynomials. After background sections on polynomials, the use of conventional methods (in particular the open methods from Chap. 6) are discussed. Then two special methods for locating polynomial roots are described: Miiller's and Bairstow's methods. The chapter ends with information related to finding roots with program libraries and software packages.

Chapter 8 extends the above concepts to actual engineering problems. Engineering ap- plications are used to illustrate the strengths and weaknesses of each method and to provide insight into the application of the techniques in professional practice. The applications also highlight the trade-offs (as discussed in Part One) associated with the various methods.

An epilogue is included at the end of Part Two. It contains a detailed comparison of the methods discussed in Chaps. 5, 6, and 7. This comparison includes a description of trade- offs related to the proper use of each technique. This section also provides a summary of important formulas, along with references for some numerical methods that are beyond the scope of this text.

PT2.3.2 Goals and Objectives

Study Objectives. After completing Part Two, you should have sufficient information to successfully approach a wide variety of engineering problems dealing with roots of equa- tions. In general, you should have mastered the techniques, have learned to assess their re- liability, and be capable of choosing the best method (or methods) for any particular prob- lem. In addition to these general goals, the specific concepts in Table PT2.2 should be assimilated for a comprehensive understanding of the material in Part Two.

Computer Objectives. The book provides you with software and simple computer algo- rithms to implement the techniques discussed in Part Two. All have utility as learning tools.

TABLE PT2.2 Specific study obiectives for Part Two.

1 . Understand the graphical interpretation of a root 2. Know the graphical interpretation of the false-positlon method and why it is usually superior to the bi-

section method 3. Understand the difference between bracketing and open methods for root locatior; 4. Understand the concepts of convergence and d~ver~ence. Use the two-curve graphical method to pro-

vide a visual manifestation of the concepts 5 . Know why bracketing methods always converge, whereas open methods may sometimes diverge 6. Reolize that convergence of open methods is more likely if the initial guess IS close to the true root 7 . Understand the concepts of linear and quadratic convergence and their implicot~ons for the efficlencles

of the fixed-point-iteration and Newton-Raphson methods 8. Know the fundamental difference between the false-position and secant methods ond how ~t relates to

convergence 9. Understand the problems posed by multiple roots and the modlflcations available to m~tigote them

10 Know haw to extend the singleequation Newton-Raphson approach to solve systems of nonlinear equations

Page 8: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PT2.3 ORIENTATION 117

The Numerical Methods TOOLKIT contains the bisection method to determine the real roots of algebraic and transcendental equations. The graphics associated with this soft- ware will enable you to easily visualize the behavior of the function being analyzed. The software can be used to conveniently determine roots of equations to a desired degree of precision. The TOOLKIT is easy to apply in solving many practical problems and can be used to check the results of any computer programs you may develop yourself.

Pseudocodes for several methods are also supplied directly in the text. This informa- tion will allow you to expand your software library to include programs that are more effi- cient than the bisection method. For example, you may also want to have your own soft- ware for the false-position, Newton-Raphson, and secant techniques, which are often more efficient than the bisection method.

Finally, software packages such as Mathcad, Excel, and MATLAB and program li- braries like IMSL have powerful capabilities for locating roots. You can use this part of the book to become familiar with these capabilities.

Page 9: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

CHAPTER 5 Bracketing Methods

This chapter on roots of equations deals with methods that exploit the fact that a function typically changes sign in the vicinity of a root. These techniques are called bracketing methods because two initial guesses for the root are required. As the name implies, these guesses must "bracket," or be on either side of, the root. The particular methods described herein employ different strategies to systematically reduce the width of the bracket and, hence, home in on the correct answer.

As a prelude to these techniques, we will briefly discuss graphical methods for depict- ing functions and their roots. Beyond their utility for providing rough guesses, graphical techniques are also useful for visualizing the properties of the functions and the behavior of the various numerical methods.

5.1 GRAPHICAL METHODS

A simple method for obtaining an estimate of the root of the equation f(x) = 0 is to make a plot of the function and observe where it crosses the x axis. This point, which represents the x value for which f(x) = 0, provides a rough approximation of the root.

EXAMPLE 5.1 The Graphical Approach

1 Problem Statement. Use the graphical approach to determine the drag coefficient c needed for a parachutist of mass m = 68.1 kg to have a velocity of 40 m/s after free- falling for time t = 10 s. Note: The acceleration due to gravity is 9.8 rn/s2.

! I Solution. This problem can be solved by determining the root of Eq. (PT2.4) using the I parameters t = 10, g = 9.8, v = 40, and rn = 68.1: I

1 Various values of c can be substituted into the right-hand side of this equation to compute

Page 10: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.1 GRAPHICAL METHODS 119

These points are plotted in Fig. 5.1. The resulting curve crosses the c axis between 12 and 16. Visual inspection of the plot provides a rough estimate of the root of 14.75. The valid- ity of the graphical estimate can be checked by substituting it into Eq. (E5.1.1) to yield

which is close to zero. It can also be checked by substituting it into Eq. (PT2.4) along with the parameter values from this example to give

which is very close to the desired fall velocity of 40 m/s.

FIGURE 5.1 The graphical approach for determining the roots of an equation

Page 11: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 20 BRACKETING METHODS

Graphical techniques are of limited practical value because they are not precise. HOW- ever, graphical methods can be utilized to obtain rough estimates of roots. These estimates can be employed as starting guesses for numerical methods discussed in this and the next chapter. For example, the Numerical Methods TOOLKIT software that supplements this text allows you to plot the function over a specified range. This plot can be used to select guesses that bracket the root prior to implementing the numerical method. The plotting op- tion greatly enhances the utility of the software.

Aside from providing rough estimates of the root, graphical interpretations are impor- tant tools for understanding the properties of the functions and anticipating the pitfalls of the numerical methods. For example, Fig. 5.2 shows a number of ways in which roots can occur (or be absent) in an interval prescribed by a lower bound xl and an upper bound xu. Figure 5.2b depicts the case where a single root is bracketed by negative and positive values of f(x). However, Fig. 5.2d, where f(xJ and f(xu) are also on opposite sides of thex axis, shows three roots occurring within the interval. In general, iff(xl) and f(xu) have opposite signs, there are an odd number of roots in the interval. As indicated by Fig. 5 . 2 ~ and c, if f(xJ and f(x,) have the same sign, there are either no roots or an even number of roots between the values.

Although these generalizations are usually true, there are cases where they do not hold. For example, functions that are tangential to the x axis (Fig. 5 . 3 ~ ) and discontinuous func- tions (Fig. 5.3b) can violate these principles. An example of a function that is tangential to the axis is the cubic equation f(x) = (x - 2)(x - 2)(x - 4). Notice that x = 2 makes two terms in this polynomial equal to zero. Mathematically, x = 2 is called a multiple root. At the end of Chap. 6, we will present techniques that are expressly designed to locate multiple roots.

FIGURE 5.3 Illustration of some exceptions to the general cases depicted in Fig. 5.2 . (a) Multiple root that occurs when the function is tan- gential to the x axis. For this case, although the end points are of opposite signs, there are an even number of axis intersections for the interval. [b) Discontinuous function where end points of oppo- site sign bracket an even number of roots. Special strategies are required for determining the roots for these cases.

FIGURE 5.2 Illustration of a number of gen- eral wavs that a root mav occur in an Inierval by a lower bound xi and an upper bound x,. Parts (a] and (c) indi- cate that if both f(xij ond {(xu) have the same sign, either there will be no roots or there will be an even number of roots within the interval. Parts (b) and (dl in- dicate that if the function has different signs at the end points, there will be an odd number of roots in the interval.

Page 12: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.1 GRAPHICAL METHODS 121

The existence of cases of the type depicted in Fig. 5.3 makes it difficult to develop general computer algorithms guaranteed to locate all the roots in an interval. However, when used in conjunction with graphical approaches, the methods described in the follow- ing sections are extremely useful for solving many roots of equations problems confronted routinely by engineers and applied mathematicians.

EXAMPLE 5.2 Use of Computer Graphics to Locate Roots

Problem Statement. Computer graphics can expedite and improve your efforts to locate roots of equations. The present example was developed using the Numerical Methods TOOLKIT software package. We have chosen the TOOLKIT because of the ease with which the axis scaling can be modified with this tool. Thus, it is ideal for the type of visual, exploratory analysis we are illustrating here. It should be noted, however, that while it might be a tad more inconvenient, other software with graphical capabilities could be used

FIGURE 5.4 The progressive enlargement of f(x) = sin 1 Ox + cos 3x by the computer. Such interactive graphics permits the analyst to determine that two distinct roots exist between x = 4.2 and x = 4.3.

Page 13: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

122 BRACKETING METHODS

to perform a similar analysis. Further, the insights and issues raised are not software- specific, but are relevant to computer graphics in general.

The function

f(x) = sin lox + cos 3x

has several roots over the range x = 0 to x = 5. Use computer graphics to gain insight into the behavior of this function.

Solution. As previously illustrated in Example 2.1, the TOOLKIT can be used to gen- erate plots. Figure 5 . 4 ~ is a plot of f(x) from x = 0 to x = 5. This plot suggests the presence of several roots, including a possible double root at about x = 4.2, where f(x) appears to be tangent to the x axis. A more detailed picture of the behavior of f(x) is obtained by changing the plotting range from x = 3 to x = 5, as shown in Fig. 5.4h. Finally, in Fig. 5.4c, the vertical scale is narrowed further to f(x) = -0.15 to f(x) = 0.15 and the horizontal scale is narrowed to x = 4.2 to x = 4.3. This plot shows clearly that a double root does not exist in this region and that in fact there are two distinct roots at about x = 4.23 and x = 4.26.

Computer graphics will have great utility in your studies of numerical methods. This capability will also find many other applications in your other classes and professional ac- tivities as well.

5.2 THE BISECTION METHOD

When applying the graphical technique in Example 5.1, you have observed (Fig. 5.1) that f(x) changed sign on opposite sides of the root. In general, if f(x) is real and continuous in the interval from x, to xu and f(xJ and f(xu) have opposite signs, that is,

then there is at least one real root between x, and xu. Incremental search methods capitalize on this observation by locating an interval

where the function changes sign. Then the location of the sign change (and consequently, the root) is identified more precisely by dividing the interval into a number of subintervals. Each of these subintervals is searched to locate the sign change. The process is repeated and the root estimate refined by dividing the subintervals into finer increments. We will re- turn to the general topic of incremental searches in Sec. 5.4.

The bisection method, which is alternatively called binary chopping, interval halving, or Bolzano's method, is one type of incremental search method in which the interval is al- ways divided in half. If a function changes sign over an interval, the function value at the midpoint is evaluated. The location of the root is then determined as lying at the midpoint of the subinterval within which the sign change occurs. The process is repeated to obtain refined estimates. A simple algorithm for the bisection calculation is listed in Fig. 5.5, and a graphical depiction of the method is provided in Fig. 5.6. The following example goes through the actual computations involved in the method.

Page 14: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.2 THE BISECTION METHOD 123

FIGURE 5.5

Step 1 : Choose lower xi and upper xu guesses for the root such that the function changes sign over the interval. This can be checked by ensuring that f(xdf(x,) < 0.

Step 2: An estimate of the root x, is determined by

XI + xu x, = - 2

Step 3: Make the following evaluations to determine in which subinterval the root lies: (a) If f(x,)f(xJ < 0, the root lies in the lower subinterval. Therefore, set xu= x, and

return to step 2. (6) If f(xl)f(x,] >0, the root lies in the upper subinterval. Therefore, set x,=x,

and return to step 2. (c) If f(xl)f(xJ =0, the root equals x,; terminate the computation.

FIGURE 5.6 A graphical depiction of the bi- section method. This plot con- forms to the first three iterations from Example 5.3.

EXAMPLE 5.3 Bisection

Problem Statement. Use bisection to solve the same problem approached graphically in Example 5.1.

Solution. The first step in bisection is to guess two values of the unknown (in the present problem, c) that give values for f(c) with different signs. From Fig. 5.1, we can see that the function changes sign between values of 12 and 16. Therefore, the initial estimate of the root x, lies at the midpoint of the interval

Page 15: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

124 BRACKETING METHODS

This estimate represents a true percent relative error of E, = 5.3% (note that the true value of the root is 14.7802). Next we compute the product of the function value at the lower bound and at the midpoint:

which is greater than zero, and hence no sign change occurs between the lower bound and the midpoint. Consequently, the root must be located between 14 and 16. Therefore, we create a new interval by redefining the lower bound as 14 and determining a revised root estimate as

which represents a true percent error of E, = 1.5%. The process can be repeated to obtain refined estimates. For example,

Therefore, the root is between 14 and 15. The upper bound is redefined as 15, and the root estimate for the third iteration is calculated as

which represents a percent relative error of E, = 1.9%. The method can be repeated until the result is accurate enough to satisfy your needs.

In the previous example, you may have noticed that the true error does not decrease with each iteration. However, the interval within which the root is located is halved with each step in the process. As discussed in the next section, the interval width provides an exact estimate of the upper bound of the error for the bisection method.

5.2.1 Termination Criteria and Error Estimates

We ended Example 5.3 with the statement that the method could be continued to obtain a refined estimate of the root. We must now develop an objective criterion for deciding when to terminate the method.

An initial suggestion might be to end the calculation when the true error falls below some prespecified level. For instance, in Example 5.3, the relative error dropped from 5.3 to 1.9 percent during the course of the computation. We might decide that we should ter- minate when the error drops below, say, 0.1 percent. This strategy is flawed because the error estimates in the example were based on knowledge of the true root of the function. This would not be the case in an actual situation because there would be no point in using the method if we already knew the root.

Therefore, we require an error estimate that is not contingent on foreknowledge of the root. As developed previously in Sec. 3.3, an approximate percent relative error E, can be

Page 16: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.2 THE BISECTION METHOD 125

calculated, as in [recall Eq. (3.91

where x r w is the root for the present iteration and x;ld is the root from the previous itera- tion. The absolute value is used because we are usually concerned with the magnitude of E, rather than with its sign. When E, becomes less than a prespecified stopping criterion E,, the computation is terminated.

EXAMPLE 5.4 Error Estimates for Bisection

Problem Statement. Continue Example 5.3 until the approximate error falls below a stopping criterion of E , = 0.5%. Use Eq. (5.2) to compute the errors.

Solution. The results of the first two iterations for Example 5.3 were 14 and 15. Substi- tuting these values into Eq. (5.2) yields

Recall that the true percent relative error for the root estimate of 15 was 1.5%. Therefore, E , is greater than E,. This behavior is manifested for the other iterations:

Iteration XI XU Xr E., (%) Q(%)

1 12 16 14 5.279 2 14 16 15 6.667 1.487 3 14 15 14.5 3.448 1.896 4 14 5 15 14.75 1.695 0.204 5 14.75 15 14.875 0.840 0.641 6 14.75 14.875 14.8125 0422 0.219

Thus, after six iterations e, finally falls below e, = 0.5%, and the computation can be terminated.

These results are summarized in Fig. 5.7. The "ragged" nature of the true error is due to the fact that, for bisection, the true root can lie anywhere within the bracketing interval. The true and approximate errors are far apart when the interval happens to be centered on the true root. They are close when the true root falls at either end of the interval.

Although the approximate error does not provide an exact estimate of the true error, Fig. 5.7 suggests that E , captures the general downward trend of E,. In addition, the plot exhibits the extremely attractive characteristic that e, is always greater than E,. Thus, when e, falls below e,, the computation could be terminated with confidence that the root is known to be at least as accurate as the prespecified acceptable level.

Page 17: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

126 BRACKETING METHODS

FIGURE 5.7 Errors for the bisection method. True and estimated errors are plotted versus the number of iterations.

Although it is always dangerous to draw general conclusions from a single example, it can be demonstrated that E, will always be greater than E, for the bisection method. This is because each time an approximate root is located using bisection as x,. = (xl + x,)/2, we know that the true root lies somewhere within an interval of (xu - x1)/2 = Ax/2. There- fore, the root must lie within f Ax12 of our estimate (Fig. 5.8). For instance, when Exam- ple 5.3 was terminated, we could make the definitive statement that

Because Ax12 = x r W - x,Old (Fig. 5.9), Eq. (5.2) provides an exact upper bound on the true error. For this bound to be exceeded, the true root would have to fall outside the bracketing interval, which, by definition, could never occur for the bisection method. As il- lustrated in a subsequent example (Example 5.7), other root-locating techniques do not al- ways behave as nicely. Although bisection is generally slower than other methods, the neat- ness of its error analysis is certainly a positive aspect that could make it attractive for certain engineering applications.

Before proceeding to the computer program for bisection, we should note that the re- lationships (Fig. 5.9)

Page 18: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.2 THE BISECTION METHOD 127

FIGURE 5.8 Three ways In which the interval may bracket the root. In (a) the true value lies at the center of the interval, whereas in [b) and (c) the true value lies near the extreme. Notice that the discrep- ancy between the true value and the midpoint of the interval never exceeds half the interval length, or Ax/?.

FIGURE 5.9 Graphical depiction of why the error estimate for bisection AX/^) is equivalent to the root esti. mate for the present iteration (x:"") minus the root estimate for the previous iteration (xpId).

Page 19: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

128 BRACKETING METHODS

and

can be substituted into Eq. (5.2) to develop an alternative formulation for the approximate percent relative error

This equation yields identical results to Eq. (5.2) for bisection. In addition, it allows us to cal- culate an error estimate on the basis of our initial guesses-that is, on our first iteration. For instance, on the first iteration of Example 5.2, an approximate error can be computed as

Another benefit of the bisection method is that the number of iterations required to at- tain an absolute error can be computed a priori-that is, before starting the iterations. This can be seen by recognizing that before starting the technique, the absolute error is

E: = xf - xp = Ax0

where the superscript designates the iteration. Hence, before starting the method, we are at the "zero iteration." After the first iteration, the error becomes

Because each succeeding iteration halves the error, a general formula relating the error and the number of iterations, n, is

If Ea,d is the desired error, this equation can be solved for

n = log (AxO1Ea.d)

log 2 = logl ( X O ) Ea,d

Let's test the formula. For Example 5.4, the initial interval was Axo = 16 - 12 = 4. After six iterations, the absolute error was

We can substitute these values into Eq. (5.5) to give

log (410.0625) n = = 6

log 2

Thus, if we knew beforehand that an error of less than 0.0625 was acceptable, the formula tells us that six iterations would yield the desired result.

Page 20: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.2 THE BISECTION METHOD 129

Although we have emphasized the use of relative errors for obvious reasons, there will be cases where (usually through knowledge of the problem context) you will be able to specify an absolute error. For these cases, bisection along with Eq. (5.5) can provide a useful root-location algorithm. We will explore such applications in the end-of-chapter problems.

5.2.2 Bisection Algorithm

The algorithm in Fig. 5.5 can now be expanded to include the error check (Fig. 5.10). The algorithm employs user-defined functions to make root location and function evaluation more efficient. In addition, an upper limit is placed on the number of iterations. Finally, an error check is included to avoid division by zero during the error evaluation. Such would be the case when the bracketing interval is centered on zero. For this situation Eq. (5.2) be- comes infinite. If this occurs, the program skips over the error evaluation for that iteration.

The algorithm in Fig. 5.10 is not user-friendly; it is designed strictly to come up with the answer. In Prob. 5.14 at the end of this chapter, you will have the task of making it eas- ier to use and understand. An example of a user-friendly program for implementing bisec- tion is included in the Numerical Methods TOOLKIT software associated with this text. The following example demonstrates the use of this software for root location. It also pro- vides a good reference for assessing and testing your own software.

FIGURE 5.10 Pseudocode for function to implement bisection

FUNCTION Bisect (XI, xu, es, imax, xc iter, ea) iter = 0 DO

xrold = xr xr = (XI + xu) / 2 iter = i ter + 1 IF xr # 0 THEN

ea = ABS((xr - xrold) / x r ) +? 100 END IF t e s t = f(x1) +? f(xr) IF t e s t < 0 THEN

X U = xr ELSE IF t e s t > 0 THEN

XI = xr ELSE

ea = 0 END IF IF ea < es OR iter 2 imax EXIT

END DO Bisect = xr

END Bisect

Page 21: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

130 BRACKETING METHODS

EXAMPLE 5.5 Root Location Using the Computer

Problem Statement. A user-friendly computer program to implement the bisection method is contained in the Numerical Methods TOOLKIT software associated with the text. We can use this software to find the smallest positive root of

Solution. Press the "Find Root" button from the main menu of the Numerical Methods TOOLKIT to obtain a blank screen similar to Fig. 5.1 1. The first step is to input the equation that you want to solve in the form of f(x) = 0 in the input box provided. The Help button on the main menu lists the functions and constants recognized by the TOOLKIT.

To enter Eq. (E5.5.1), simply click on the input function box and enter the function. Let's assume we have no idea what the root might be, and therefore decide to construct a plot to provide some guidance regarding selection of appropriate upper and lower guesses. A plot is constructed by supplying values for the minimum X and Y and a Delta X and Y to the Parameter Input table. This generates a plot with maximum values of (Xmin + 10 Delta X) and (Ymin + 10 Delta Y) when the Plot button is clicked. This is the convention that is used for all the plots in the TOOLKIT and is further explained from the Help button on the main menu. A plot with Xmin = -2, Delta X = 0.4, Ymin = -5 , and Delta Y = 1 is shown in Fig. 5.11. Inspection of this plot shows that a root exists at about x = 0.7. This is the insight needed to provide low and high guesses for the root. The final inputs required are the maximum number of iterations and the maximum allowable percent error (E,).

Iterations stop either when the iterations equal the input Max Iteration or when the es- timated error calculated with Eq. (5.3) is less than the input Max % Error (e,). The actual calculation is initiated by clicking the Calc button. Note that this button is red when any input to the screen renders the numerical values in the Results Table obsolete.

FIGURE 5.1 1 Finding the root of an equation using bisection and the TOOLKIT.

Page 22: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.2 THE BISECTION METHOD 131

In this case a root equal to 0.7390747 was found in I4 iterations that gave an error of about 0.008%. The function is also evaluated at the root as a check. The function evaluated at the root is close to zero (- 1.745 x The screen design facilitates experimentation by allowing you to vary the Max % Error and Max Iteration. The overall procedure for finding roots is summarized by the Help button. In addition, you may write yourself some notes regarding the analysis by clicking the Notes button. Finally, you can save the results for further reference by using the Save and Open buttons on the main menu.

These results are based on a simple algorithm for the bisection method with user-friendly input and output routines. The algorithm employed is similar to the one shown in Fig. 5.10. You should be able to write your own program for the bisection method and use our software as a model and to check the adequacy of your own program.

5.2.3 Minimizing Function Evaluations

The bisection algorithm in Fig. 5.10 is just fine if you are performing a single root eval- uation for a function that is easy to evaluate. However, there are many instances in

FIGURE 5.12 Pseudocode for b~section subprogram which minimizes function evaluations

FUNCTION Bisect (xl, xu, es, imax xr, iter, eaj i ter = 0

DO xrold = xr

i te r = i ter 4- 7 F x r f OTHEN

ea = ABS[ [xr - xroldj / xr) 100 END IF -

t es t = fl * fr IF t e s t < 0 THEN

XU = xr ELSE IF t e s t > 0 THEN

ELSE ea = 0

END IF IF ea < es OR i ter > imax EXIT

END DO Bisect = xr

END Bisect

Page 23: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

132 BRACKETING METHODS

engineering when this is not the case. For example, suppose that you develop a computer program that must locate a root numerous times. In such cases you could call the algorithm from Fig. 5.10 thousands and even millions of times in the course of a single run.

Further, in its most general sense, a univariate function is merely an entity that returns a single value in return for a single value you send to it. Perceived in this sense, functions are not always simple formulas like the one-line equations solved in the preceding exam- ples in this chapter. For example, a function might consist of many lines of code that could take a significant amount of execution time to evaluate. In some cases, the function might even represent an independent computer program.

Because of both these factors, it is imperative that numerical algorithms minimize function evaluations. In this light, the algorithm from Fig. 5.10 is deficient. In particular, notice that in making two function evaluations per iteration, it recalculates one of the func- tions that was determined on the previous iteration.

Figure 5.12 provides a modified algorithm that does not have this deficiency. We have highlighted the lines that differ from Fig. 5.10. In this case, only the new function value at the root estimate is calculated. Previously calculated values are saved and merely reassigned as the bracket shrinks. Thus, rather than 2n, the function evaluations are reduced to n + 1.

5.3 THE FALSE-POSITION METHOD

Although bisection is a perfectly valid technique for determining roots, its "brute-force" ap- proach is relatively inefficient. False position is an alternative based on a graphical insight.

A shortcoming of the bisection method is that, in dividing the interval from xl to xu into equal halves, no account is taken of the magnitudes of f(xl) and f(x,). For example, if f(xJ is much closer to zero than f (xu), it is likely that the root is closer to XI, than to xu (Fig. 5.13). An alternative method that exploits this graphical insight is to join f(xl) and f(xu) by a straight line. The intersection of this line with the x axis represents an improved estimate of the root. The fact that the replacement of the curve by a straight line gives a "false position" of the root is the origin of the name, method of false position, or in Latin, regula falsi. It is also called the linear interpolation method.

Using similar triangles (Fig. 5.13), the intersection of the straight line with the x axis can be estimated as

which can be solved for (see Box 5.1 for details).

This is the false-position formula. The value of x, computed with Eq. (5.7) then replaces whichever of the two initial guesses, x, or xu, yields a function value with the same sign as f(x,.). In this way, the values of XI and xu always bracket the true root. The process is re- peated until the root is estimated adequately. The algorithm is identical to the one for bi- section (Fig. 5.5) with the exception that Eq. (5.7) is used for step 2. In addition, the same stopping criterion [Eq. (5.2)] is used to terminate the computation.

Page 24: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.3 THE FALSE-POSITION METHOD 1 33

FIGURE 5.1 3 A graphical depiction of the method of false position. Similar triangles used to derive the formula for the method are shaded.

Cross-multiply Eq. (5.6) to yield then adding and subtracting xu on the right-hand side:

f(x1) (x,. - xu) = f(xu ( X I - - 11)

Collect terms and rearrange:

xr [ f ( xO - f(xu>1 = xuf(x1) - xl f (xu) Collecting terms yields

Divide by f(xl) - f(x,):

X,. = xu f ( X I - XI f (xu) f(x1) - f (xu)

X,. = X u + xu f(xu - XI f (xu)

f ( x l ) - f ( x u ) f ( x , ) - f ( x u )

This is one form of the method of false position. Note that i t al- X,. = X u -

f(xu ( X I - xu) lows the computation of the root x,. as a function of the lower and f (x l ) - f ( x ~ ) upper guesses xl and xu. It can be put in an alternative form by ex- panding it: which is the same as Eq. (5.7). We use this form because it involves

one less function evaluation and one less multiplication than

X,. = xu f ( X I -

f(x1) - f(xu)

Eq. (B5.1.1). In addition, it is directly comparable with the secant method which will be discussed in Chap. 6.

Page 25: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

134 BRACKETING METHODS

EXAMPLE 5.6 False Position

Problem Statement. Use the false-position method to determine the root of the same i equation investigated in Example 5.1 [Eq. (E5.1. I ) ] .

i Solution. As in Example 5.3, initiate the computation with guesses of xl = 12 and I i xu = 16. i

First iteration: !

I

i which has a true relative error of 0.89 percent. I 1 Second iteration:

Therefore, the root lies in the first subinterval, and x, becomes the upper limit for the next : iteration, xu = 14.9 11 3:

which has true and approximate relative errors of 0.09 and 0.79 percent. Additional itera- tions can be performed to refine the estimate of the roots.

A feeling for the relative efficiency of the bisection and false-position methods can be appreciated by referring to Fig. 5.14, where we have plotted the true percent relative errors for Examples 5.4 and 5.6. Note how the error for false position decreases much faster than for bisection because of the more efficient scheme for root location in the false-position method.

Recall in the bisection method that the interval between xl and xu grew smaller during the course of a computation. The interval, as defined by Ax12 = Ix, - xl1/2 for the first iteration, therefore provided a measure of the error for this approach. This is not the case for the method of false position because one of the initial guesses may stay fixed through- out the computation as the other guess converges on the root. For instance, in Example 5.6 the lower guess xl remained at 12 while xu, converged on the root. For such cases, the in- terval does not shrink but rather approaches a constant value.

Example 5.6 suggests that Eq. (5.2) represents a very conservative error criterion. In fact, Eq. (5.2) actually constitutes an approximation of the discrepancy of the previous

Page 26: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.3 THE FALSE-POSITION METHOD 135

FIGURE 5.14 Comparison of the relative errors of the bisection and the false-position methods

iteration. This is because for a case such as Example 5.6, where the method is converging quickly (for example, the error is being reduced nearly an order of magnitude per iteration), the root for the present iteration XY is a much better estimate of the true value than the re- sult of the previous iteration Thus, the quantity in the numerator of Eq. (5.2) actually represents the discrepancy of the previous iteration. Consequently, we are assured that sat- isfaction of Eq. (5.2) ensures that the root will be known with greater accuracy than the prescribed tolerance. However, as described in the next section, there are cases where false position converges slowly. For these cases, Eq. (5.2) becomes unreliable, and an alternative stopping criterion must be developed.

5.3.1 Pitfalls of the False-Position Method

Although the false-position method would seem to always be the bracketing method of preference, there are cases where it performs poorly. In fact, as in the following example, there are certain cases where bisection yields superior results.

Page 27: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

136 BRACKETING METHODS

EXAMPLE 5.7 A Case Where Bisection Is Preferable to False Position

Problem Statement. Use bisection and false position to locate the root of

f ( x ) =x1° - 1

between x = 0 and 1.3.

Solution. Using bisection, the results can be summarized as

Iteration XI XU XI E ~ ( % ) E+(%)

FIGURE 5.15 / Plot of i (x ) = xlo - 1 , illustrating slow convergence of the false-position method,

Page 28: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

5.4 INCREMENTAL SEARCHES AND DETERMINING INITIAL GUESSES 137

Thus, after five iterations, the true error is reduced to less than 2 percent. For false position, a very different outcome is obtained:

Iteration €a (%) E , (%)

After five iterations, the true error has only been reduced to about 59 percent. In addition, note that E, < E ~ . Thus, the approximate error is misleading. Insight into these results can be gained by examining a plot of the function. As in Fig. 5.15, the curve violates the premise upon which false position was based-that is, if f(xl) is much closer to zero than f(x,) is, then the root is closer to xl than to xu (recall Fig. 5.13). Because of the shape of the present function, the opposite is true.

The foregoing example illustrates that blanket generalizations regarding root-location methods are usually not possible. Although a method such as false position is often supe- rior to bisection, there are invariably cases that violate this general conclusion. Therefore, in addition to using Eq. (5.2), the results should always be checked by substituting the root estimate into the original equation and determining whether the result is close to zero. Such a check should be incorporated into all computer programs for root location.

5.3.2 False-Position Algorithm An algorithm for the false-position method can be developed directly from the bisection al- gorithm in Fig. 5.10. The only modification is to substitute Eq. (5.7). In addition, the zero check suggested in the last section should also be incorporated into the code.

An alternative version that minimizes function evaluation can also be patterned after Fig. 5.12. For this case, additional modifications are needed to evaluate and save the nec- essary function evaluation per iteration. This will be left as a homework exercise.

5.4 INCREMENTAL SEARCHES AND DETERMINING INITIAL GUESSES

Besides checking an individual answer, you must determine whether all possible roots have been located. As mentioned previously, a plot of the function is usually very useful in guid- ing you in this task. Another option is to incorporate an incremental search at the beginning of the computer program. This consists of starting at one end of the region of interest and then making function evaluations at small increments across the region. When the function changes sign, it is assumed that a root falls within the increment. The x values at the be- ginning and the end of the increment can then serve as the initial guesses for one of the bracketing techniques described in this chapter.

Page 29: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

138 BRACKETING METHODS

FIGURE 5.16 Cases where roots could be missed because the increment length of the search procedure is too large. Note that the last root on the right is multiple and would be missed regardless of incre- ment length.

A potential problem with an incremental search is the choice of the increment length. If the length is too small, the search can be very time-consuming. On the other hand, if the length is too great, there is a possibility that closely spaced roots might be missed (Fig. 5.16). The problem is compounded by the possible existence of multiple roots. A partial remedy for such cases is to compute the first derivative of the function f '(x) at the beginning and the end of each interval. If the derivative changes sign, it suggests that a minimum or maximum may have occurred and that the interval should be examined more closely for the existence of a possible root.

Although such modifications or the employment of a very fine increment can alleviate the problem, it should be clear that brute-force methods such as incremental search are not foolproof. You would be wise to supplement such automatic techniques with any other information that provides insight into the location of the roots. Such information can be found in plotting and in understanding the physical problem from which the equation originated.

PROBLEMS

5.1 Determine the real roots of f ( x ) = -0.4x2 + 2 . 2 ~ + 4.7: (a) Graphically. ( b ) Using the quadratic formula. (c) Using three iterations of the bisection method to determine the

highest root. Employ initial guesses of x, = 5 and xu = 10. Compute the estimated error E, and the true error s, after each iteration.

5.2 Determine the real roots of f ( x ) = -2 + 7 x - 5x2 + 6x3: (a ) Graphically.

( b ) Using bisection to locate the lowest root. Employ initial guesses of xi = 0 and xu = 1 and iterate until the estimated error s, falls below a level of s, = 10%.

5.3 Determine the real roots of f ( x ) = -26 + 8 2 . 3 ~ - 88x2 + 45.4x3 - 9x4 + 0.65x5: (a) Graphically. ( b ) Using bisection to determine the highest root to s, = 10%.

Employ initial guesses of x, = 0.5 and xu = 1.0.

Page 30: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PROBLEMS 139

(c) Perform the same computation as in (b) but use the false- position method and E, = 0.1 %.

5.4 Determine the real roots off (x) = - 11 - 22x + 1 7 2 - 2.52: (a) Graphically. (b) Using the false-position method with a value of E, corre-

sponding to three significant figures to determine the lowest root.

5.5 Locate the first nontrivial root of sin x = x2, where x is in radi- ans. Use a graphical technique and bisection with the initial inter- val from 0.5 to 1. Perform the computation until E, is less than E , = 2%. Also perform an error check by substituting your final answer into the original equation. 5.6 Determine the real root of In x2 = 0.7: (a) Graphically. (b) Using three iterations of the bisection method, with initial

guesses of xl = 0.5 and xu = 2. (c) Using three iterations of the false-position method, with the

same initial guesses as in (b). 5.7 Determine the real root of f(x) = (0.9 - 0.4x)lx: (a) Analytically. (b) Graphically. (c) Using three iterations of the false-position method and initial

guesses of 1 and 3. Compute the approximate error E, and the true error E, after each iteration.

5.8 Find the positive square root of 15 using the false-position method to within E, = 0.5%. Employ initial guesses of xl = 3 and Xu = 4. 5.9 Find the smallest positive root of the function (x is in radians) x2 Isin fiI = 5 using the false-position method. To locate the region in which the root lies, first plot this function for values of x between 0 and 5. Perform the computation until E, falls below F, = 1%. Check your final answer by substituting it into the origi- nal function. 5.10 Find the positive real root of f(x) = x4 - 8 2 - 36x2 + 462x - 1010 using the false-position method. Use a plot to make your initial guess, and perform the computation to within E, = 1.0%. 5.11 Determine the real root of x3 ' = 79: (a) Analytically. (b) With the false-position method to within E , = 0.1%. Use ini-

tial guesses of 3.0 and 4.0. 5.12 The velocity v of a falling parachutist is given by

where g = 9.8. For a parachutist with a drag coefficient c = 14 kg/s, compute the mass m so that the velocity is v = 35 m/s at t = 7 s. Use the false-position method to determine m to a level of E , = 0.1%.

5.13 The saturation concentration of dissolved oxygen in freshwa- ter can be calculated with the equation (APHA, 1992)

where os,- = the saturation concentration of dissolved oxygen in freshwater at 1 atm (mg/L) and To = absolute temperature (K). Re- member that T, = T + 273.15, where T = temperature ("C). Ac- cording to this equation, saturation decreases with increasing tem- perature. For typical natural waters in temperate climates, the equation can be used to determine that oxygen concentration ranges from 14.621 mg/L at O°C to 6.949 mg/L at 35°C. Given a value of oxygen concentration, this formula and the bisection method can be used to solve for temperature in OC. (a) If the initial guesses are set as 0 and 3S°C, how many bisection

iterations would be required to determine temperature to an ab- solute error of 0.05"C?

(b) Based on (a), develop and test a bisection program to deter- mine T as a function of a given oxygen concentration. Test your program for of = 8, 10, and 14 mg/L. Check your results.

5.14 Integrate the algorithm outlined in Fig. 5.10 into a complete, user-friendly bisection subprogram. Among other things: (a) Place documentation statements throughout the subprogram to

identify what each section is intended to accomplish. (b) Label the input and output. (c) Add an answer check that substitutes the root estimate into the

original function to verify whether the final result is close to zero.

(d) Test the subprogram by duplicating the computations from Ex- ample 5.3.

5.15 Use the subprogram you developed in Prob. 5.14 to repeat Probs. 5.1 through 5.6. 5.16 Repeat Prob. 5.15 except use the TOOLKIT software avail- able with the text. Use the plotting capabilities of this program to verify your results. 5.17 Use the TOOLKIT software to find the real roots of two third-order-polynomial functions of your choice. Plot each func- tion over a range you specify to obtain upper and lower bounds on the roots. 5.18 Repeat Prob. 5.17 except use two transcendental functions of your choice. 5.19 This problem uses only the graphics capability of the TOOLKIT software available with the text. The software plots the function over smaller and smaller intervals to increase the number

Page 31: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 40 BRACKETING METHODS

of significant figures to which a root can be estimated. Start with f(x) = e-" cos 8x. Plot the function with a full-scale range of x = 0 to 2.5. Estimate the lowest root in this interval. Plot the function again with x = 0 to 0.5. Estimate the root. Finally, plot the function over a range of 0.1 to 0.2. This permits you to find the root to two significant figures and estimate a third. 5.20 Develop a user-friendly subprogram for the false-position method based on Sec. 5.3.2 and Fig. 5.10. Test the program by du- plicating Example 5.6.

5.21 Use the subprogram you developed in Prob. 5.20 to duplicate the computation from Example 5.7. Perform a number of runs until the true percent relative error falls below 0.01%. Plot the true and approximate percent relative errors versus number of iterations on semilog paper. Interpret your results. 5.22 Develop a subprogram for the false-position method that minimizes function evaluations in a fashion similar to Fig. 5.11. Determine the number n of function evaluations per total iterations. Test the program by duplicating Example 5.6.

Page 32: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

CHAPTER 6 Open Methods

For the bracketing methods in the previous chapter, the root is located within an interval prescribed by a lower and an upper bound. Repeated application of these methods always results in closer estimates of the true value of the root. Such methods are said to be con- vergent because they move closer to the truth as the computation progresses (Fig. 6 . 1 ~ ) .

In contrast, the open methods described in this chapter are based on formulas that re- quire only a single starting value of x or two starting values that do not necessarily bracket

FIGURE 6.1 Graphical depiction of the fun- damental difference between the (a) bracketing and (b) and (c) open methods for root loca- tion. In (a), which is the bisec- tion method, the root is con- strained within the interval prescribed by X I and xu. In con- trast, for the open method de- picted in (b) and (c), a formula is used to project from x, to x,+l in an iterative fashion. Thus, the method can either (b) diverge or (c) converge rapidly, depending on the value of the initial guess.

Page 33: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

142 OPEN METHODS

the root. As such, they sometimes diverge or move away from the true root as the compu- tation progresses (Fig. 6. lb). However, when the open methods converge (Fig. 6.1 c) they usually do so much more quickly than the bracketing methods. We will begin our discus- sion of open techniques with a simple version that is useful for illustrating their general form and also for demonstrating the concept of convergence.

6.1 SIMPLE FIXED-POINT ITERATION

As mentioned above, open methods employ a formula to predict the root. Such a formula can be developed for simplefixed-point iteration (or, as it is also called, one-point iteration, or successive substitution) by rearranging the function f(x) = 0 so that x is on the left-hand side of the equation:

This transformation can be accomplished either by algebraic manipulation or by simply adding x to both sides of the original equation. For example,

can be simply manipulated to yield

whereas sin x = 0 could be put into the form of Eq. (6.1) by adding x to both sides to yield

The utility of Eq. (6.1) is that it provides a formula to predict a new value of x as a function of an old value of x. Thus, given an initial guess at the root xi, Eq. (6.1) can be used to compute a new estimate xi+, as expressed by the iterative formula

As with other iterative formulas in this book, the approximate error for this equation can be determined using the error estimator [Eq. (3.5)]:

EXAMPLE 6.1 Simple Fixed-Point Iteration

Problem Statement. Use simple fixed-point iteration to locate the root of Ax) = e-" - x.

Solution. The function can be separated directly and expressed in the form of Eq. (6.2) as

Page 34: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.1 SIMPLE FIXED-POINT ITERATION 143

Starting with an initial guess of xo = 0, this iterative equation can be applied to compute

Thus, each iteration brings the estimate closer to the true value of the root: 0.56714329.

6.1.1 Convergence Notice that the true percent relative error for each iteration of Example 6.1 is roughly pro- portional (by a factor of about 0.5 to 0.6) to the error from the previous iteration. This prop- erty, called linear convergence, is characteristic of fixed-point iteration.

Aside from the "rate" of convergence, we must comment at this point about the "possibility" of convergence. The concepts of convergence and divergence can be depicted graphically. Recall that in Sec. 5.1, we graphed a function to visualize its structure and behavior (Example 5.1). Such an approach is employed in Fig. 6.2a for the function Ax) = e-" - x: An alternative graphical approach is to separate the equation into two component parts, as in

f1(x) = f2(x)

Then the two equations

Y1 = f i b )

and

~2 = f2(x) (6.4)

can be plotted separately (Fig. 6.2b). The x values corresponding to the intersections of these functions represent the roots off (x) = 0.

EXAMPLE 6.2 The Two-Curve Graphical Method

Problem Statement. Separate the equation e-" - x = 0 into two parts and determine its root graphically.

Solution. Reformulate the equation as yl = x and y2 = e-". The following values can be computed:

Page 35: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 44 OPEN METHODS

These points are plotted in Fig. 6.2b. The intersection of the two curves indicates a root es- timate of approximately x = 0.57, which corresponds to the point where the single curve in Fig. 6.2a crosses the x axis.

FIGURE 6.2 Two alternative graphical methods for determining the root of f(x) = e-x - x. (a) Root at the point where it crosses the x axis; (b) root at the intersection of the component functions.

Page 36: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.1 SIMPLE FIXED-POINT ITERATION 145

The two-curve method can now be used to illustrate the convergence and divergence of fixed-point iteration. First, Eq. (6 .1) can be re-expressed as a pair of equations yl = x and y2 = g(x). These two equations can then be plotted separately. As was the case with Eqs. (6.3) and (6 .4) , the roots of f (x ) = 0 correspond to the abscissa value at the intersec- tion of the two curves. The function yl = xand four different shapes for y2 = g(x) are plot- ted in Fig. 6.3 .

For the first case (Fig. 6.3a), the initial guess of xo is used to determine the correspond- ing point on the y2 curve [x0, g(xo)]. The point (XI, x l ) is located by moving left horizontally to the yl curve. These movements are equivalent to the first iteration in the fixed-point method:

Thus, in both the equation and in the plot, a starting value of xo is used to obtain an estimate of x l . The next iteration consists of moving to [ x l , g (x l ) ] and then to (x2, x2). This iteration

FIGURE 6.3 Graphical depiction of (a) and (b) convergence and (c) and (d) divergence of simple fixed-point iteration. Graphs (a) and (c) are called monotone patterns, whereas [b) and (d) are called oscillating or spiral patterns. Note that convergence occurs when 1 g'(x) 1 < 1 .

Page 37: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 46 OPEN METHODS

From studying Fig. 6.3 it should be clear that fixed-point iteration converges if, in the region of interest, Igl(x) 1 < 1. In other words, convergence occurs if the magnitude of the slope of g(x) is less than the slope of the line f(x) = x. This observation can be demonstrated theoretically. Recall that the iterative equation is

Suppose that the true solution is

Subtracting these equations yields

The derivative mean-value theorem (recall Sec. 4.1.1) states that if a function g(x) and its first derivative are continuous over an interval a 5 x 5 b, then there exists at least one value of x = 6 within the interval such that

Now, if we let a = x; and b = xr, the right-hand side of Eq. (B6.1.1) can be expressed as

g(xr) - g(xi) = (xr - xi)g'(O

where 6 is somewhere between x; and xr. This result can then be substituted into Eq. (B6.1.1) to yield

xr - Xi+l = (xr - xi)g1(6) (B6.1.3)

If the true error for iteration i is defined as

Et,i = X, - X;

then Eq. (B6.1.3) becomes

Et,,+l = g'(6)Er.i

Consequently, if I gl(x) I < 1, the errors decrease with each itera- tion. For I gt(x) I > 1, the errors grow. Notice also that if the deriv- ative is positive, the errors will be positive, and hence, the iterative solution will be monotonic (Fig. 6 . 3 ~ and c). If the derivative is

g(b) - g(a) negative, the errors will oscillate (Fig. 6.3b and d). g1(6) = - a ( ~ 6 . 1 . 2 )

An offshoot of the analysis is that it also demonstrates that when

The right-hand side of this equation is the slope of the line joining the method converges, the error is roughly proportional to and less

g(a) and g(b). Thus, the mem-value theorem states that there is at than the of the previous step. For this fixed-

least one point between a and b that has a slope, designated by gl((), point iteration 's said be linearly 'Onvergent.

which is parallel to the line joining g(a) and g(b) (recall Fig. 4.3).

is equivalent to the equation

The solution in Fig. 6 . 3 ~ is convergent because the estimates of x move closer to the root with each iteration. The same is true for Fig. 6.3b. However, this is not the case for Fig. 6 . 3 ~ and d, where the iterations diverge from the root. Notice that convergence seems to occur only when the absolute value of the slope of y2 = g(x) is less than the slope of yl = x, that is, when Igl(x) 1 < 1 . Box 6.1 provides a theoretical derivation of this result.

6.1.2 Algorithm for Fixed-Point Iteration

The computer algorithm for fixed-point iteration is extremely simple. It consists of a loop to iteratively compute new estimates until the termination criterion has been met. Fig- ure 6.4 presents pseudocode for the algorithm. Other open methods can be programmed in a similar way, the major modification being to change the iterative formula that is used to compute the new root estimate.

Page 38: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.2 THE NEWTON-RAPHSON METHOD 147

FUNCTION Onept (xO, e5, imax, iter, ea) xr = x0 i ter = 0 DO

xrold = xr xr = g(xrold) i ter = iter + 1 IF xr #O THEN

xr - xrold ea = I xr I . I O O

END IF FIGURE 6.4 Pseudocode for fixed-point itera-

IF ea < es OR iter 2 imax EXIT

tion. Note that other oDen rneth- END Do ods can be cast in thi; general Onept = xr format. END OnePt

FIGURE 6.5 Graphical depiction of the Newton-Raphson method. A tangent to the function of x, [that is, f'lx,)] is extrapolated down to the x axis to provide an estimate of the root at x,+l

6.2 THE NEWTON-RAPHSON METHOD Perhaps the most widely used of all root-locating formulas is the Newton-Raphson equa- tion (Fig. 6.5). If the initial guess at the root is xi, a tangent can be extended from the point [xi, f (x i ) ] . The point where this tangent crosses the x axis usually represents an improved estimate of the root.

Page 39: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

148 OPEN METHODS

The Newton-Raphson method can be derived on the basis of this geometrical inter- pretation (an alternative method based on the Taylor series is described in Box 6.2). As in Fig. 6.5, the first derivative at x is equivalent to the slope:

which can be rearranged to yield

which is called the Newton-Raphson formula.

EXAMPLE 6.3 Newton-Raphson Method

Problem Statement. Use the Newton-Raphson method to estimate the root of f(x) = e-" - x employing an initial guess of xo = 0.

Solution. The first derivative of the function can be evaluated as

f '(x) = -e-" - 1

which can be substituted along with the original function into Eq. (6.6) to give

Starting with an initial guess of xo = 0, this iterative equation can be applied to compute

Thus, the approach rapidly converges on the true root. Notice that the true percent relative error at each iteration decreases much faster than it does in simple fixed-point iteration (compare with Example 6.1).

6.2.1 Termination Criteria and Error Estimates

As with other root-location methods, Eq. (3.5) can be used as a termination criterion. In addition, however, the Taylor series derivation of the method (Box 6.2) provides theoreti- cal insight regarding the rate of convergence as expressed by Ei+l = o(E:). Thus the error should be roughly proportional to the square of the previous error. In other words, the

Page 40: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.2 THE NEWTON-RAPHSON METHOD 1 49

Aside from the geometric derivation [Eqs. (6.5) and (6 .6 ) ] , the the root. Substituting this value along with f(x,) = 0 into Eq. Newton-Raphson method may also be developed from the Taylor (B6.2.1) yields series expansion. This alternative derivation is useful in that it also provides insight into the rate of convergence of the method.

f "(t) 0 = f ( x , ) + f ' (x i ) (x , - x i ) + T ( ~ r - (B6.2.3)

L: Recall from Chap. 4 that the Taylor series expansion can be rep-

resented as Equation (B6.2.2) can be subtracted from Eq. (B6.2.3) to give

f (x i+ l ) = f ( x i ) f l (x i ) (x i+ l - x i ) (B6.2.J) O = f l ( x i ) ( x r - x i + l ) + - f "(6) (x,. - (B6.2.4) 2!

f t t W ( x i + l - & ) 2 +- 2! Now, realize that the error is equal to the discrepancy between x,+l

and the true value x,, as in where < lies somewhere in the interval from xi to xi+ l . An approxi- mate version is obtainable by truncating the series after the first de- EI. ,+I = x,. - XI+I rivative term: and Eq. (B6.2.4) can be expressed as

f ( x l + ~ ) 2 f (x i ) + f l (x i ) (x l+ l - x i ) 0 = f l (xi)Et , i+l + -

At the intersection with thex axis, f(xi+1) would be equal to zero, or 2!

0 = f ( x i ) + f l (x i ) (x i+ l - x i )

which can be solved for

(B6.2.2) If we assume convergence, both xi and 6 should eventually be ap- proximated by the root x,, and Eq. (B6.2.5) can be rearranged to yield

which is identical to Eq. (6.6) . Thus, we have derived the Newton- Raphson formula using a Taylor series.

Aside from the derivation, the Taylor series can also be used to estimate the error of the formula. This can be done by realizing that if the complete Taylor series were employed, an exact result would be obtained. For this situation xi+, = xr, wherex is the true value of

- f " ( x r ) 2 E t , i + ~ = --- 2 f '(x,.)

According to Eq. (B6.2.6), the error is roughly proportional to the square of the previous error. This means that the number of correct decimal places approximately doubles with each iteration. Such be- havior is referred to as quadratic convergence. Example 6 .4 mani- fests this property.

number of significant figures of accuracy approximately doubles with each iteration. This behavior is examined in the following example.

EXAMPLE 6.4 Error Analysis of Newton-Raphson Method

Problem Statement. As derived in Box 6.2, the Newton-Raphson method is quadrat- ically convergent. That is, the error is roughly proportional to the square of the previous

1 error, as in I

Examine this formula and see if it applies to the results of Example 6.3.

Solution. The first derivative of f (x ) = e-" - x is

f l ( x ) = -ePx - 1

Page 41: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 50 OPEN METHODS

which can be evaluated at x, = 0.56714329 as f '(0.56714329) = -1.56714329. The sec- ond derivative is

which can be evaluated as f "(0.56714329) = 0.56714329. These results can be substituted into Eq. (E6.4.1) to yield

From Example 6.3, the initial error was Ej,o = 0.56714329, which can be substituted into the error equation to predict

E I v 1 S 0.18095(0.56714329)~ = 0.0582

which is close to the true error of 0.06714329. For the next iteration,

Z 0.18095(0.06714329)~ = 0.0008158

which also compares favorably with the true error of 0.0008323. For the third iteration,

E j , 3 2 0.18095(0.0008323)~ = 0.000000125

which is the error obtained in Example 6.3. The error estimate improves in this manner be- cause, as we come closer to the root, x and ,$ are better approximated by x, [recall our as- sumption in going from Eq. (B6.2.5) to Eq. (B6.2.6) in Box 6.21. Finally,

Thus, this example illustrates that the error of the Newton-Raphson method for this case is, in fact, roughly proportional (by a factor of 0.18095) to the square of the error of the pre- vious iteration.

6.2.2 Pitfalls of the Newton-Raphson Method

Although the Newton-Raphson method is often very efficient, there are situations where it performs poorly. A special case-multiple roots-will be addressed later in this chapter. However, even when dealing with simple roots, difficulties can also arise, as in the follow- ing example.

EXAMPLE 6.5 Example of a Slowly Converging Function with Newton-Raphson

Problem Statement. Determine the positive root of f(x) = x1° - 1 using the Newton- Raphson method and an initial guess of x = 0.5.

I Solution. The Newton-Raphson formula for this case is

I which can be used to compute

Page 42: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.2 THE NEWTON-RAPHSON METHOD 151

Iteration x

Thus, after the first poor prediction, the technique is converging on the true root of 1, but at a very slow rate.

Aside from slow convergence due to the nature of the function, other difficulties can arise, as illustrated in Fig. 6.6. For example, Fig. 6.6a depicts the case where an inflection point [that is, f "(x) = 0] occurs in the vicinity of a root. Notice that iterations beginning at xo progressively diverge from the root. Figure 6.6b illustrates the tendency of the Newton- Raphson technique to oscillate around a local maximum or minimum. Such oscillations may persist, or as in Fig. 6.6b, a near-zero slope is reached, whereupon the solution is sent far from the area of interest. Figure 6 . 6 ~ shows how an initial guess that is close to one root can jump to a location several roots away. This tendency to move away from the area of in- terest is because near-zero slopes are encountered. Obviously, a zero slope [ f ' (x) = 01 is truly a disaster because it causes division by zero in the Newton-Raphson formula [Eq. (6.6)]. Graphically (see Fig 6.6d), it means that the solution shoots off horizontally and never hits the x axis.

Thus, there is no general convergence criterion for Newton-Raphson. Its convergence depends on the nature of the function and on the accuracy of the initial guess. The only remedy is to have an initial guess that is "sufficiently" close to the root. And for some func- tions, no guess will work! Good guesses are usually predicated on knowledge of the phys- ical problem setting or on devices such as graphs that provide insight into the behavior of the solution. The lack of a general convergence criterion also suggests that good computer software should be designed to recognize slow convergence or divergence. The next sec- tion addresses some of these issues.

6.2.3 Algorithm for Newton-Raphson

An algorithm for the Newton-Raphson method is readily obtained by substituting Eq. (6.6) for the predictive formula [Eq. (6.2)] in Fig. 6.4. Note, however, that the progrm must also be modified to compute the first derivative. This can be simply accomplished by the inclu- sion of a user-defined function.

Additionally, in light of the foregoing discussion of potential problems of the Newton- Raphson method, the program would be improved by incorporating several additional features:

Page 43: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

152 OPEN METHODS

FIGURE 6.6 Four cases where the Newton-Raphson method exhibits poor convergence.

Page 44: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.3 THE SECANT METHOD 153

1. A plotting routine should be included in the program. 2. At the end of the computation, the final root estimate should always be substituted into

the original function to compute whether the result is close to zero. This check partially guards against those cases where slow or oscillating convergence may lead to a small value of E, while the solution is still far from a root.

3. The program should always include an upper limit on the number of iterations to guard against oscillating, slowly convergent, or divergent solutions that could persist inter- minably.

4. The program should alert the user and take account of the possibility that f '(x) might equal zero at any time during the computation.

6.3 THE SECANT METHOD

A potential problem in implementing the Newton-Raphson method is the evaluation of the derivative. Although this is not inconvenient for polynomials and many other functions, there are certain functions whose derivatives may be extremely difficult or inconvenient to evaluate. For these cases, the derivative can be approximated by a backward finite divided difference, as in (Fig. 6.7)

FIGURE 6.7 Graphical depiction of the secant method. This technique is similar to the Newton-Raphson technique (Fig. 6.5) in the sense that an estimate of the root is predicted by extrapolating a tangent of the function to the x axis. However, the secant method uses a difference rather than a derivative to estimate the slope.

Page 45: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

154 OPEN METHODS

This approximation can be substituted into Eq. (6.6) to yield the following iterative equation:

Equation (6.7) is the formula for the secant method. Notice that the approach requires two initial estimates of x. However, because f(x) is not required to change signs between the es- timates, it is not classified as a bracketing method,

EXAMPLE 6.6 The Secant Method

Problem Statement. Use the secant method to estimate the root of f(x) = e-" - x. Start with initial estimates of xPl = 0 and xo = 1.0.

Solution. Recall that the true root is 0.56714329. . . .

First iteration:

x-1 = 0 f(x-1) = 1.00000

xo = 1 ~ ( x o ) = -0.63212

Second iteration:

xo = 1 f(xo) = -0.63212

X I = 0.61270 XI) = -0.07081

(Note that both estimates are now on the same side of the root.)

Third iteration:

X I = 0.61270 f ( x l ) = -0.07081

x2 = 0.56384 f(x2) = 0.005 18

6.3.1 The DiHerence Between the Seeant and False-Position Methods

Note the similarity between the secant method and the false-position method. For example, Eqs. (6.7) and (5.7) are identical on a term-by-term basis. Both use two initial estimates to compute an approximation of the slope of the function that is used to project to the x axis for a new estimate of the root. However, a critical difference between the methods is how

Page 46: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.3 THE SECANT METHOD 155

one of the initial values is replaced by the new estimate. Recall that in the false-position method the latest estimate of the root replaces whichever of the original values yielded a function value with the same sign as f(x,.). Consequently, the two estimates always bracket the root. Therefore, for all practical purposes, the method always converges because the root is kept within the bracket. In contrast, the secant method replaces the values in strict sequence, with the new value xi+, replacing xi and xi replacing xi-1. As a result, the two values can sometimes lie on the same side of the root. For certain cases, this can lead to divergence.

EXAMPLE 6.7 Comparison of Convergence of the Secant and False-Position Techniques

Problem Statement. Use the false-position and secant methods to estimate the root of f(x) = In x. Start the computation with values of x, = xi-I = 0.5 and xu = xi = 5.0.

i

Comparison of the falseposition and the secant methods. The first iterations [a) and [b) for both techniques are identical. However, for the second iterations (c) and (d ) , the points used differ. As a consequence, the secant method can diverge, as indicated in (d ) .

Page 47: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

156 OPEN METHODS

Solution. For the false-position method the use of Eq. (5.7) and the bracketing criterion for replacing estimates results in the following iterations:

Iteration XI X, Xr

As can be seen (Fig. 6 . 8 ~ and c), the estimates are converging on the true root which is equal to 1.

For the secant method, using Eq. (6.7) and the sequential criterion for replacing esti- mates results in

Iteration

As in Fig. 6.8d, the approach is divergent.

Although the secant method may be divergent, when it converges it usually does so at a quicker rate than the false-position method. For instance, Fig. 6.9 demonstrates the supe- riority of the secant method in this regard. The inferiority of the false-position method is due to one end staying fixed to maintain the bracketing of the root. This property, which is an advantage in that it prevents divergence, is a shortcoming with regard to the rate of convergence; it makes the finite-difference estimate a less-accurate approximation of the derivative.

6.3.2 Algorithm for the Secant Method

As with the other open methods, an algorithm for the secant method is obtained simply by modifying Fig. 6.4 so that two initial guesses are input and by using Eq. (6.7) to calculate the root. In addition, the options suggested in Sec. 6.2.3 for the Newton-Raphson method can also be applied to good advantage for the secant program.

6.3.3 Modified Secant Method Rather than using two arbitrary values to estimate the derivative, an alternative approach involves a fractional perturbation of the independent variable to estimate f '(x),

Page 48: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.3 THE SECANT METHOD 157

FIGURE 6.9 Comparison of the true percent relative errors e, for the methods to determine the roots of f ( X I = e-% - x.

where 6 = a small perturbation fraction. This approximation can be substituted into Eq. (6.6) to yield the following iterative equation:

EXAMPLE 6.8 Modified Secant Method

Problem Statement. Use the modified secant method to estimate the root of f(x) = e-" - x. Use a value of 0.01 for 6 and start with xo = 1.0. Recall that the true root is 0.56714329. . . .

Page 49: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

158 OPEN METHODS

Solution. First iteration:

Second iteration:

xo = 0.537263 f(x0) = 0.047083

xo + 6x0 = 0.542635 ~ ( X O + 6x0) = 0.038579

Third iteration:

xo = 0.56701 f(x0) = 0.000209

xo + 6x0 = 0.567143 f(x0 + 6x0) = -0.00867

The choice of a proper value for S is not automatic. If S is too small, the method can be swamped by round-off error caused by subtractive cancellation in the denominator of Eq. (6.8). If it is too big, the technique can become inefficient and even divergent. How- ever, if chosen correctly, it provides a nice alternative for cases where evaluating the de- rivative is difficult and developing two initial guesses is inconvenient.

6.4 MULTIPLE ROOTS A multiple root corresponds to a point where a function is tangent to the x axis. For exam- ple, a double root results from

f ( x ) = ( X - 3) ( X - 1) (x - 1 ) (6.9)

or, multiplying terms, f(x) = x3 - 5x2 + 7x - 3. The equation has a double root because one value of x makes two terms in Eq. (6.9) equal to zero. Graphically, this corresponds to the curve touching the x axis tangentially at the double root. Examine Fig. 6 . 1 0 ~ at x = 1 . Notice that the function touches the axis but does not cross it at the root.

A triple root corresponds to the case where one x value makes three terms in an equa- tion equal to zero, as in

or, multiplying terms, f(x) = x4 - 6x3 + 12x2 - lox + 3. Notice that the graphical depic- tion (Fig. 6. lob) again indicates that the function is tangent to the axis at the root, but that for this case the axis is crossed. In general, odd multiple roots cross the axis, whereas even ones do not. For example, the quadruple root in Fig. 6 . 1 0 ~ does not cross the axis.

Page 50: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.4 MULTIPLE ROOTS 159

FlGURE 6.10 Examples of multiple roots that are tangential to the x axis. Notice that the function does not cross the axis on either side of even multiple roots (a) and (c), whereas it crosses the axis for odd cases (b).

Multiple roots pose some difficulties for many of the numerical methods described in Part Two:

1. The fact that the function does not change sign at even multiple roots precludes the use of the reliable bracketing methods that were discussed in Chap. 5. Thus, of the methods covered in this book, you are limited to the open methods that may diverge.

2. Another possible problem is related to the fact that not only f(x) but also f '(x) goes to zero at the root. This poses problems for both the Newton-Raphson and secant methods, which both contain the derivative (or its estimate) in the denominator of their respective formulas. This could result in division by zero when the solution converges very close to the root. A simple way to circumvent these problems is based on the fact that it can be demonstrated theoretically (Ralston and Rabinowitz, 1978) that f(x) will always reach zero before ff(x). Therefore, if a zero check for f(x) is incorporated into the computer program, the computation can be terminated before f '(x) reaches zero.

3. It can be demonstrated that the Newton-Raphson and secant methods are linearly, rather than quadratically, convergent for multiple roots (Ralston and Rabinowitz, 1978). Mod- ifications have been proposed to alleviate this problem. Ralston and Rabinowitz (1978) have indicated that a slight change in the formulation returns it to quadratic conver- gence, as in

f (xi > xi+l = xi - rn-

f '(xi)

where m is the multiplicity of the root (that is, m = 2 for a double root, rn = 3 for a triple root, etc.). Of course, this may be an unsatisfactory alternative because it hinges on foreknowledge of the multiplicity of the root.

Another alternative, also suggested by Ralston and Rabinowitz (1978), is to define a new function u(x), that is, the ratio of the function to its derivative, as in

It can be shown that this function has roots at all the same locations as the original func- tion. Therefore, Eq. (6.10) can be substituted into Eq. (6.6) to develop an alternative form of the Newton-Raphson method:

Equation (6.10) can be differentiated to give

Equations (6.10) and (6.12) can be substituted into Eq. (6.11) and the result simplified to yield

Page 51: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 60 OPEN METHODS

EXAMPLE 6.9 Modified ~ewton-~hphson Method for Multiple Roots

Problem Statement. Use both the standard and modified Newton-Raphson methods to evaluate the multiple root of Eq. (6.9), with an initial guess of xo = 0.

Solution. The first derivative of Eq. (6.9) is f l(x) = 3x2 - lox + 7 , and therefore, the standard Newton-Raphson method for this problem is [Eq. (6.6)]

which can be solved iteratively for

As anticipated, the method is linearly convergent toward the true value of 1 .O. For the modified method, the second derivative is f "(x) = 6x - 10, and the iterative

relationship is [Eq. (6.13)]

which can be solved for

Thus, the modified formula is quadratically convergent. We can also use both methods to search for the single root at x = 3. Using an initial guess of xo = 4 gives the following results:

i standard st (%) Modified 8t (%I

Page 52: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.5 SYSTEMS OF NONLINEAR EQUATIONS 161

Thus, both methods converge quickly, with the standard method being somewhat more ef- ficient.

The above example illustrates the trade-offs involved in opting for the modified Newton-Raphson method. Although it is preferable for multiple roots, it is somewhat less efficient and requires more computational effort than the standard method for simple roots.

It should be noted that a modified version of the secant method suited for multiple roots can also be developed by substituting Eq. (6.10) into Eq. (6.7). The resulting formula is (Ralston and Rabinowitz, 1978)

6.5 SYSTEMS OF NONLINEAR EQUATIONS

To this point, we have focused on the determination of the roots of a single equation. A re- lated problem is to locate the roots of a set of simultaneous equations,

The solution of this system consists of a set of x values that simultaneously result in all the equations equaling zero.

In Part Three, we will present methods for the case where the simultaneous equations are linear-that is, they can be expressed in the general form

where the b and the a's are constants. Algebraic and transcendental equations that do not fit this format are called nonlinear equations. For example,

and

are two simultaneous nonlinear equations with two unknowns, x and y. They can be ex- pressed in the form of Eq. (6.14) as

Thus, the solution would be the values of x and y that make the functions u(x, y) and v(x, y) equal to zero. Most approaches for determining such solutions are extensions of the open

Page 53: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 62 OPEN METHODS

methods for solving single equations. In this section, we will investigate two of these: fixed-point iteration and Newton-Raphson.

6.5.1 Fixed-Point Iteration

The fixed-point-iteration approach (Sec. 6.1) can be modified to solve two simultaneous, nonlinear equations. This approach will be illustrated in the following example.

EXAMPLE 6.10 Fixed-Point lteration for a Nonlinear System

Problem Statement. Use fixed-point iteration to determine the roots of Eq. (6.16). Note that a correct pair of roots is x = 2 and y = 3. Initiate the computation with guesses of x = 1.5 and y = 3.5.

I Solution. Equation (6.16~) can be solved for

I and Eq. (6.166) can be solved for

Note that we will drop the subscripts for the remainder of the example. On the basis of the initial guesses, Eq. (E6.10.1) can be used to determine a new value

of x:

This result and the initial value of y = 3.5 can be substituted into Eq. (E6.10.2) to deter- mine a new value of y:

Thus, the approach seems to be diverging. This behavior is even more pronounced on the second iteration:

Obviously, the approach is deteriorating. Now we will repeat the computation but with the original equations set up in a differ-

ent format. For example, an alternative formulation of Eq. (6 .16~) is

Page 54: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

6.5 SYSTEMS OF NONLINEAR EQUATIONS 1 63

Now the results are more satisfactory:

Thus, the approach is converging on the true values of x = 2 and y = 3.

The previous example illustrates the most serious shortcoming of simple fixed-point iteration-that is, convergence often depends on the manner in which the equations are for- mulated. Additionally, even in those instances where convergence is possible, divergence can occur if the initial guesses are insufficiently close to the true solution. Using reasoning similar to that in Box 6.1, it can be demonstrated that sufficient conditions for convergence for the two-equation case are

and

These criteria are so restrictive that fixed-point iteration has limited utility for solving non- linear systems. However, as we will describe later in the book, .it can be very useful for solving linear systems.

6.5.2 Newton-Raphson

Recall that the Newton-Raphson method was predicated on employing the derivative (that is, the slope) of a function to estimate its intercept with the axis of the independent vari- able-that is, the root (Fig. 6.5). This estimate was based on a first-order Taylor series ex- pansion (recall Box 6.2),

where x, is the initial guess at the root and xi+, is the point at which the slope intercepts the x axis. At this intercept, f (xi+l) by definition equals zero and Eq. (6.17) can be rearranged to yield

f (xi > Xi+] = x i - -

f '(xi)

Page 55: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 64 OPEN METHODS

which is the single-equation form of the Newton-Raphson method. The multiequation form is derived in an identical fashion. However, a multivariable

Taylor series must be used to account for the fact that more than one independent variable contributes to the determination of the root. For the two-variable case, a first-order Taylor series can be written [recall Eq. (4.26)] for each nonlinear equation as

and

Just as for the single-equation version, the root estimate corresponds to the values of x and y, where ui+l and v;+l equal zero. For this situation, Eq. (6.19) can be rearranged to give

Because all values subscripted with i's are known (they correspond to the latest guess or approximation), the only unknowns are xi+, and y;+l. Thus, Eq. (6.20) is a set of two linear equations with two unknowns [compare with Eq. (6.15)]. Consequently, algebraic manip- ulations (for example, Crarner's rule) can be employed to solve for

The denominator of each of these equations is formally referred to as the determinant of the Jacobian of the system.

Equation (6.21) is the two-equation version of the Newton-Raphson method. As in the following example, it can be employed iteratively to home in on the roots of two simulta- neous equations.

EXAMPLE 6.1 1 Newton-Raphson for a Nonlinear System

Problem Statement. Use the multiple-equation Newton-Raphson method to determine roots of Eq. (6.16). Note that a correct pair of roots is x = 2 and y = 3. Initiate the computation with guesses of x = 1.5 and y = 3.5.

Page 56: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PROBLEMS 165

Solution. First compute the partial derivatives and evaluate them at the initial guesses of x and y:

Thus, the determinant of the Jacobian for the first iteration is

The values of the functions can be evaluated at the initial guesses as

These values can be substituted into Eq. (6.21) to give

Thus, the results are converging to the true values of x = 2 and y = 3. The computation can be repeated until an acceptable accuracy is obtained.

Just as with fixed-point iteration, the Newton-Raphson approach will often diverge if the initial guesses are not sufficiently close to the true roots. Whereas graphical methods could be employed to derive good guesses for the single-equation case, no such simple pro- cedure is available for the multiequation version. Although there are some advanced ap- proaches for obtaining acceptable first estimates, often the initial guesses must be obtained on the basis of trial and error and knowledge of the physical system being modeled.

The two-equation Newton-Raphson approach can be generalized to solve n simulta- neous equations. Because the most efficient way to do this involves matrix algebra and the solution of simultaneous linear equations, we will defer discussion of the general approach to Part Three.

PROBLEMS

6.1 Use simple fixed-point iteration to locate the root of 6.3 Determine the real roots of f (x ) = -2.0 + 6x - 4x2 + 0.5x3:

f ( x ) = sin (,h ) - x (a) graphically and (b) using the Newton-Raphson method to within E, = 0.01%.

Use an initial guess of xo = 0.5 and iterate until E, 5 0.01%. 6.4 Employ the Newton-Raphson method to determine a real root 6.2 Use (a) fixed-point iteration and (b) the Newton-Raphson for f (x ) = -2.0 + 6x - 4x2 + 0 . 5 ~ ~ using initial guesses of (a) method determine off(x) = - 0 . 9 ~ ~ f 1 . 7 ~ + 2.5 using 4.2 and (b) 4.43. Discuss and use graphical and analytical methods xo = 5. Perfom the computation until E, is less than E , = 0.01%. to explain any peculiarities in your results. Also perform an error check of your final answer.

Page 57: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

166 OPEN METHODS

6.5 Determine the lowest real root of f(x) = -11 - 2 2 + 1 7 2 - 2.52: (a) graphically and (b) using the secant method to a value of E, corresponding to three significant figures. 6.6 Locate the first positive root of

f(x) = sinx + cos (1 + x2) - 1

where x is in radians. Use four iterations of the Newton-Raphson method with initial guesses of (a) xi-1 = 1.0 and x; = 3.0, and (b) xi-, = 1.5 andx; = 2.5, to locate the root. (c) Use the graphical method to explain your results. 6.7 Determine the real root of x ~ . ~ = 79, with the modified secant method to within E, = 0.1%. Try different values of 6 and discuss your results. 6.8 Determine the highest real root of f(x) = x3 - 6x2 + 1 lx - 6.1 : (a) Graphically. (b) Using the Newton-Raphson method (three iterations, xi = 3.5). (c) Using the secant method (three iterations, xi-1 = 2.5 and

x, = 3.5). (d) Using the modified secant method (three iterations, xi = 3.5,

6 = 0.02). 6.9 Determine the lowest positive root of f(x) = 7 sin (x)e-" - 1: (a) Graphically. (b) Using the Newton-Raphson method (three iterations, x, = 0.3). (c) Using the secant method (three iterations, xi-1 = 0.5 and

x, = 0.4). (d) Using the modified secant method (five iterations, xi = 0.5,

6 = 0.03). 6.10 The function x3 + 2x2 - 5x + 3 has a double root at x = 1. Use (a) the standard Newton-Raphson [Eq. (6.6)], (b) the modified Newton-Raphson [Eq. (6.9a)], and (c) the modified Newton- Raphson [Eq. (6.13)] to solve for the root at x = 1. Compare and discuss the rate of convergence using xo = 0.2. 6.11 Determine the roots of the following simultaneous nonlinear equations using (a) fixed-point iteration and (b) the Newton-Raph- son method:

Employ initial guesses of x = y = 1.0 and discuss the results. 6.12 Determine the roots of the simultaneous nonlinear equations

Use a graphical approach to obtain your initial guesses. Determine refined estimates with the two-equation Newton-Raphson method described in Sec. 6.5.2.

6.13 Repeat Prob. 6.12 except for

6.14 A mass balance for a pollutant in a well-mixed lake can be written as

Given the parameter values V = 1 x lo6 m3, Q = 1 x lo5 m31yr, W = 1 x lo6 g/yr, and k = 0.2 m0-5/g0.5/yr, use the modified secant method to solve for the steady-state concentration. Employ an ini- tial guess of c = 4 g/m3 and an 6 = 0.5. Perform two iterations and determine the percent relative error after the second iteration. 6.15 For Prob. 6.14, the root can be located with fixed-point itera- tion as

Only one will work all the time for initial guesses of c > 1. Select the correct one and demonstrate why it will always work. 6.16 Develop a user-friendly subprogram for the Newton-Raphson method based on Fig. 6.4 and Sec. 6.2.3. Test it by duplicating the computation from Example 6.3. 6.17 Develop a user-friendly subprogram for the secant method based on Fig. 6.4 and Sec. 6.3.2. Test it by duplicating the compu- tation from Example 6.6. 6.18 Develop a user-friendly subprogram for the modified secant method based on Fig. 6.4 and Sec. 6.3.2. Test it by duplicating the computation from Example 6.8. 6.19 Develop a user-friendly subprogram for the two-equation Newton-Raphson method based on Sec. 6.5. Test it by solving Example 6.10. 6.20 Use the subprogram you developed in Prob. 6.19 to solve Probs. 6.11 and 6.12 to within a tolerance of E,, = 0.01 %. 6.21 The "divide and average" method, an old-time method for ap- proximating the square root of any positive number a , can be for- mulated as

Prove that this formula is based on the Newton-Raphson algorithm.

Page 58: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

CHAPTER 7 Roots of PolynomiaIs

In this chapter, we will discuss methods to find the roots of polynomial equations of the general form

f,(x) = ao + alx + a2x2 + . . . + a,xn (7.1)

where n = the order of the polynomial and the a's = constant coefficients. Although the coefficients can be complex numbers, we will limit our discussion to cases where they are real. For such cases, the roots can be real and/or complex.

The roots of such polynomials follow these rules:

1. For an nth-order equation, there are n real or complex roots. It should be noted that these roots will not necessarily be distinct.

2. If n is odd, there is at least one real root. 3. If complex roots exist, they exist in conjugate pairs (that is, A + pi and h - pi), where

i = a. Before describing the techniques for locating the roots of polynomials, we will provide some background. The first section offers some motivation for studying the techniques; the second deals with some fundamental computer manipulations involving polynomials.

7.1 POLYNOMIALS IN ENGINEERING AND SCIENCE Polynomials have many applications in engineering and science. For example, they are used extensively in curve-fitting. However, we believe that one of their most interesting and powerful applications is in characterizing dynamic systems and, in particular, linear systems. Examples include mechanical devices, structures, and electrical circuits. We will be exploring specific examples throughout the remainder of this text. In particular, they will be the focus of several of the engineering applications throughout the remainder of this text.

For the time being, we will keep the discussion simple and general by focusing on a simple second-order system defined by the following linear ordinary differential equation (or ODE):

d2y dy a2- + a1 - + aoy = F( t )

dt2 dl

Page 59: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

168 ROOTS OF POLYNOMIALS

where y and t are the dependent and independent variables, respectively, the a's are con- stant coefficients, and F(t) is the forcing function. If seeing how this equation is derived from a physical system helps motivate your study of the mathematics, you might peruse the beginning of Sec. 8.4 before proceeding.

In addition, it should be noted that Eq. (7.2) can be alternatively expressed as a pair of first-order ODEs by defining a new variable z ,

Equation (7.3) can be substituted along with its derivative into Eq. (7.2) to remove the second-derivative term. This reduces the problem to solving

In a similar fashion, an nth-order linear ODE can always be expressed as a system of n first-order ODEs.

Now let's look at the solution. The forcing function represents the effect of the exter- nal world on the system. The homogeneous or general solution of the equation deals with the case when the forcing function is set to zero,

Thus, as the name implies, the general solution should tell us something very fundamental about the system being simulated-that is, how the system responds in the absence of ex- ternal stimuli.

Now, the general solution to all unforced linear systems is of the form y = err. If this function is differentiated and substituted into Eq. (7.6), the result is

or canceling the exponential terms,

Notice that the result is a polynomial called the characteristic equation. The roots of this polynomial are the values of r that satisfy Eq. (7.7). These r's are referred to as the sys- tem's characteristic values, or eigenvalues.

So, here is the connection between roots of polynomials and engineering and sci- ence. The eigenvalue tells us something fundamental about the system we're modeling, and finding the eigenvalues involves finding the roots of polynomials. And, whereas find- ing the root of a second-order equation is easy with the quadratic formula, finding roots of higher-order systems (and hence, higher-order polynomials) is arduous analytically. Thus, the best general approach requires numerical methods of the type described in this chapter.

Before proceeding to these methods, let's take our analysis a bit farther by investigat- ing what specific values of the eigenvalues might imply about the behavior of physical

Page 60: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.1 POLYNOMIALS IN ENGINEERING AND SCIENCE 169

systems. First, let's evaluate the roots of Eq. (7.7) with the quadratic formula,

Thus, we get two roots. If the discriminant (a12 - 4a2ao) is positive, the roots are real and the general solution can be represented as

y = clerlt + c2er2' (7.8)

where the c's = constants that can be determined from the initial conditions. This is called the overdamped case.

If the discriminant is zero, a single real root results, and the general solution can be for- mulated as

y = (cl + c2t)eh' (7.9)

This is called the critically damped case. If the discriminant is negative, the roots will be complex conjugate numbers,

and the general solution can be formulated as

= Cle(h+~')t + C2e(h-fii)t

FIGURE 7.1 The general solution for linear ODES can be composed of (a] exponential and (b] sinusoidal components. The combination of the two shapes results in the damped sinusoid shown in [c].

Page 61: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 70 ROOTS OF POLYNOMIALS

The physical behavior of this solution can be elucidated by using Euler's formula

epi' = cos pt + i sin pt

to reformulate the general solution as (see Boyce and DiPrima, 1992, for details of the derivation)

y = cl e" cos pt + c2eA' sin pt (7.10)

This is called the underdamped case. Equations (7.8), (7.9), and (7.10) express the possible ways that linear systems re-

spond dynamically. The exponential terms mean that the solutions are capable of decaying (negative real part) or growing (positive real part) exponentially with time (Fig. 7 . 1 ~ ) . The sinusoidal terms (imaginary part) mean that the solutions can oscillate (Fig. 7.lb). If the eigenvalue has both real and imaginary parts, the exponential and sinusoidal shapes are combined (Fig. 7. lc) Because such knowledge is a key element in understanding, design- ing, and controlling the behavior of a physical system, characteristic polynomials are very important in engineering and many branches of science. We will explore the dynamics of several engineering systems in the applications covered in Chap. 8.

7.2 COMPUTING WITH POLYNOMIALS Before describing root-location methods we will discuss some fundamental computer op- erations involving polynomials. These have utility in their own right, as well as providing support for root finding.

7.2.1 Polynomial Evaluation and Differentiation Although it's the most common format, Eq. (7.1) provides a poor means for determining the value of a polynomial for a particular value of x. For example, evaluating a third-order polynomial as

involves six multiplications and three additions. In general, for an nth-order polynomial, this approach requires n(n + 1)/2 multiplications and n additions.

In contrast, a nested format,

involves three multiplications and three additions. For an nth-order polynomial, this ap- proach requires n multiplications and n additions. Because the nested format minimizes the number of operations, it also tends to minimize round-off errors. Note that, depending on your preference, the order of nesting can be reversed:

Succinct pseudocode to implement the nested form can be written simply as

D O j = n,O, -1 p = p " x+a(j)

END DO

Page 62: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.2 COMPUTING WITH POLYNOMIALS 171

where p holds the value of the polynomial (defined by its coefficients, the a's) evaluated at x.

There are cases (such as in the Newton-Raphson method) where you might want to evaluate both the function and its derivative. This evaluation can also be neatly included by adding a single line to the preceding pseudocode,

p = p * x+a ( j ) END DO

where df holds the first derivative of the polynomial.

7.2.2 Polynomial Deflation

Suppose that you determine a single root of an nth-order polynomial. If you repeat your root location procedure, you might find the same root. Therefore, it would be nice to re- move the found root before proceeding. This removal process is referred to as polynomial deflation.

Before we show how this is done, some orientation might be useful. Polynomials are typically represented in the format of Eq. (7.1). For example, a fifth-order polynomial could be written as

Although this is a familiar format, it is not necessarily the best expression to understand the polynomial's mathematical behavior. For example, this fifth-order polynomial might be expressed alternatively as

This is called the factored form of the polynomial. If multiplication is completed and like terms collected, Eq. (7.14) would be obtained. However, the format of Eq. (7.15) has the advantage that it clearly indicates the function's roots. Thus, it is apparent that x = - 1, 4,5, -3, and 2 are all roots because each causes an individual term in Eq. (7.15) to become zero.

Now, suppose that we divide this fifth-order polynomial by any of its factors, for ex- ample, x + 3. For this case the result would be a fourth-order polynomial

with a remainder of zero. In the distant past, you probably learned to divide polynomials using the approach

called synthetic division. Several computer algorithms (based on both synthetic division, as well as other methods) are available for performing the operation. One simple scheme is ~rovided bv the following ~seudocode, which divides an nth-order polynomial by a

Page 63: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 72 ROOTS OF POLYNOMIALS

monomial factor x - t:

r = a(n) a(n) = 0 D O i = n-?,O,-?

s = a(i) a(i) = r r = 5+rut

END DO

If the monomial is a root of the polynomial, the remainder r will be zero, and the coeffi- cients of the quotient stored in a, at the end of the loop.

EXAMPLE 7.1 Polynomial Deflation

1 Problem Statement. Divide the second-order polynomial,

by the factor x - 4.

Solution. Using the approach outlined in the above pseudocode, the parameters are n = 2, a0 = -24, a , = 2, a2 = 1, and t = 4. These can be used to compute

r = a 2 = 1

a2 = 0

The loop is then iterated from i = 2 - 1 = 1 to 0. For i = 1,

s = a l = 2

a l = r = l

r = s + r t = 2 + 1 ( 4 ) = 6

/ For i = 0,

s = a0 = 24

a o = r = 6

r = -24 + 6(4) = 0

Thus, the result is as expected-the quotient is a0 + alx = 6 + x, with a remainder of zero.

It is also possible to divide by polynomials of higher order. As we will see later in this chapter, the most common task involves dividing by a second-order polynomial or parabola. The subroutine in Fig. 7.2 addresses the more general problem of dividing an nth- order polynomial a by an mth-order polynomial d. The result is an (n - m)th-order poly- nomial q, with an (m - 1)th-order polynomial as the remainder.

Because each calculated root is known only approximately, it should be noted that deflation is sensitive to round-off error. In some cases, they can grow to the point that the results can become meaningless.

Some general strategies can be applied to minimize this problem. For example, round- off error is affected by the order in which the terms are evaluated. Forward deflation refers

Page 64: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.3 CONVENTIONAL METHODS 173

5U6 poldiv (a, n, d, m, q, r ) D O j = 0 , n

r ( j ) = 4 ) 4 0 ) = 0

END DO DO k = n-m, 0, -1

q(k+l) = r(m+k) l d(m) DOj = m+k-1, k, -1

r ( j ) = r(j)-q(k+1) * b(j-k) END DO

END DO DOj = m, n

r ( j ) = 0 END DO n = n-m D O i = O , n

a( i) = q(i+1) END DO END SUB

FIGURE 7.2 Algorithm to divide a polynomial (defined by its coefficients a) by a lower-order polynomial d.

to the case where new polynomial coefficients are in order of descending powers of x (that is, from the highest-order to the zero-order term). For this case, it is preferable to divide by the roots of smallest absolute value first. Conversely, for backward deflation (that is, from the zero-order to the highest-order term), it is preferable to divide by the roots of smallest absolute value first.

Another way to reduce round-off errors is to consider each successive root estimate obtained during deflation as a good first guess. These can then be used as a starting guess, and the root determined again with the original nondeflated polynomial. This is referred to as root polishing.

Finally, a problem arises when two deflated roots are inaccurate enough that they both converge on the same undeflated root. In that case, you might be erroneously led to believe that the polynomial has a multiple root (recall Sec. 6.4). One way to detect this problem is to compare each polished root with those that were located previously. Press et al. (1992) discuss this problem in more detail.

7.3 CONVENTIONAL METHODS

Now that we've covered some background material on polynomials, we can begin to de- scribe methods to locate their roots. The obvious first step would be to investigate the via- bility of the bracketing and open approaches described in Chaps. 5 and 6.

The efficacy of these approaches depends on whether the problem being solved involves complex roots. If only real roots exist, any of the previously described methods could have utility. However, the problem of finding good initial guesses complicates both the bracketing and the open methods, whereas the open methods could be susceptible to divergence.

Page 65: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 74 ROOTS OF POLYNOMIALS

When complex roots are possible, the bracketing methods cannot be used because of the obvious problem that the criterion for defining a bracket (that is, sign change) does not translate to complex guesses.

Of the open methods, the conventional Newton-Raphson method would provide a vi- able approach. In particular, concise code including deflation can be developed. If a lan- guage that accommodates complex variables (like Fortran) is used, such an algorithm will locate both real and complex roots. However, as might be expected, it would be suscepti- ble to convergence problems. For this reason, special methods have been developed to find the real and complex roots of polynomials. We describe two-the Miiller and Bairstow methods-in the following sections. As you will see, both are related to the more conven- tional open approaches described in Chap. 6.

7.4 M~~LLER'S METHOD

Recall that the secant method obtains a root estimate by projecting a straight line to the x axis through two function values (Fig. 7.3a). Muller's method takes a similar approach, but projects a parabola through three points (Fig. 7.3b).

The method consists of deriving the coefficients of the parabola that goes through the three points. These coefficients can then be substituted into the quadratic formula to obtain the point where the parabola intercepts the x axis-that is, the root estimate. The approach is facilitated by writing the parabolic equation in a convenient form,

We want this parabola to intersect the three points [xo, f(xo)l, [xl, f (xl)l, and [xz, f (x2)1. The coefficients of Eq. (7.17) can be evaluated by substituting each of the three points to give

FIGURE 7.3 A comparison of two related approaches for locating roots: (a) the secant method and (b) Muller's method.

Page 66: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.4 MULLER'S METHOD 175

Note that we have dropped the subscript "2" from the function for conciseness. Because we have three equations, we can solve for the three unknown coefficients, a, b, and c. Because two of the terms in Eq. (7.20) are zero, it can be immediately solved for c = f(x2). Thus, the coefficient c is merely equal to the function value evaluated at the third guess, x2. This result can then be substituted into Eqs. (7.18) and (7.19) to yield two equations with two unknowns:

Algebraic manipulation can then be used to solve for the remaining coefficients, a and b. One way to do this involves defining a number of differences,

These can be substituted into Eqs. (7.21) and (7.22) to give

which can be solved for a and b. The results can be summarized as

To find the root, we apply the quadratic formula to Eq. (7.17). However, because of potential round-off error, rather than using the conventional form, we use the alternative formulation [Eq. (3.13)] to yield

or isolating the unknown x3 on the left side of the equal sign,

Note that the use of the quadratic formula means that both real and complex roots can be located. This is a major benefit of the method.

In addition, Eq. (7.27~) provides a neat means to determine the approximate error. Be- cause the left side represents the difference between the present (x3) and the previous (xz) root estimate, the error can be calculated as

Page 67: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 76 ROOTS OF POLYNOMIALS

Now, a problem with Eq. (7.27a) is that it yields two roots, corresponding to the f term in the denominator. In Miiller's method, the sign is chosen to agree with the sign of 6. This choice will result in the largest denominator, and hence, will give the root estimate that is closest to x2.

Once x3 is determined, the process is repeated. This brings up the issue of which point is discarded. Two general strategies are typically used:

1. If only real roots are being located, we choose the two original points that are nearest the new root estimate, x3.

2. If both real and complex roots are being evaluated, a sequential approach is employed. That is, just like the secant method, X I , x2, and x3 take the place of xo, X I , and x2.

EXAMPLE 7.2 Muller's Method

Problem Statement. Use Miiller's method with guesses of xo, X I , and x2 = 4.5, 5.5, and / 5 to determine a root of the equation

1 Note that the roots of this equation are -3, - 1, and 4.

/ Solution. First, we evaluate the function at the guesses

I which can be used to calculate 1

1 These values in turn can be substituted into Eqs. (7.24) through (7.26) to compute I

1 The square root of the discriminant can be evaluated as

/ Then, because (62.25 + 3 1.5445 1 1 > 162.25 - 3 1.5445 1 1 , a positive sign is employed in

I the denominator of Eq. (7.27b), and the new root estimate can be determined as

1 and develop the error estimate i

Because the error is large, new guesses are assigned; xo is replaced by x l , xl is replaced by x2, and x2 is replaced by x3. Therefore, for the new iteration,

Page 68: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.4 MULLER'S METHOD 1 77

I and the calculation is repeated. The results, tabulated below, show that the method con- / verges rapidly on the root, r, = 4: i

Pseudocode to implement Miiller's method for real roots is presented in Fig. 7.4. No- tice that this routine is set up to take a single initial nonzero guess that is then perturbed to

FIGURE 7.4 Pseudocode for Miiller's method

SUB Muller(xr, h, ep5, maxit) x2 = x, XI = X, + h*xr xo = xr - h*xr DO

i ter = i ter + 1 ho = XI - xo hl = X2 - XI

do = (f(x1) - f(x0)) 1 ho dl = (f(x2) - f(x1)) 1 hl a = (dl - do) 1 (hl + ho) b = a * h l + d l c = f(x2) rad = SQRT(b*b - 4 * a * c ) If Ib+radl > Ib-radl THEN

den = b + rad ELSE

den = b - rad END IF dx, = -2.c 1 den xr = x2 + dx, PRINT iter, x, IF ( ldxrl < eps* xr OR i te r > maxit) EXIT xo = Xl

XI = x2 x2 = X,

END DO END Mijller

Page 69: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 78 ROOTS OF POLYNOMIALS

develop the other two guesses. Of course, the algorithm can also be programmed to ac- commodate three guesses. For languages like Fortran, the code will find complex roots if the proper variables are declared as complex.

7.5 BAIRSTOW'S METHOD

Bairstow's method is an iterative approach related loosely to both the Miiller and Newton- Raphson methods. Before launching into a mathematical description of the technique, re- call the factored form of the polynomial,

If we divided by a factor that is not a root (for example, x + 6), the quotient would be a fourth-order polynomial. However, for this case, a remainder would result.

On the basis of the above, we can elaborate on an algorithm for determining a root of a polynomial: (1) guess a value for the root x = t , (2) divide the polynomial by the factor x - t , and (3) determine whether there is a remainder. If not, the guess was perfect and the root is equal to t. If there is a remainder, the guess can be systematically adjusted and the procedure repeated until the remainder disappears and a root is located. After this is ac- complished, the entire procedure can be repeated for the quotient to locate another root.

Bairstow's method is generally based on this approach. Consequently, it hinges on the mathematical process of dividing a polynomial by a factor. Recall from our discussion of polynomial deflation (Sec. 7.2.2) that synthetic division involves dividing a polynomial by a factor x - t . For example, the general polynomial [Eq. (7. I)]

can be divided by the factor x - t to yield a second polynomial that is one order lower,

with a remainder R = bo, where the coefficients can be calculated by the recurrence rela- tionship

Note that if t were a root of the original polynomial, the remainder bo would equal zero. To permit the evaluation of complex roots, Bairstow's method divides the polyno-

mial by a quadratic factor x2 - rx - s. If this is done to Eq. (7.29), the result is a new polynomial

with a remainder

As with normal synthetic division, a simple recurrence relationship can be used to perform the division by the quadratic factor:

Page 70: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.5 BAIRSTOW'S METHOD 1 79

bn-l = a,-1 + rb,

b, = a ; +rb;+l +sb;+2 fori = n - 2 too

The quadratic factor is introduced to allow the determination of complex roots. This relates to the fact that, if the coefficients of the original polynomial are real, the complex roots occur in conjugate pairs. 1f 2 - rx - s is an exact divisor of the polynomial, com- plex roots can be determined by the quadratic formula. Thus, the method reduces to deter- mining the values of r and s that make the quadratic factor an exact divisor. In other words, we seek the values that make the remainder term equal to zero.

Inspection of Eq. (7.3 1) leads us to conclude that for the remainder to be zero, bo and bl must be zero. Because it is unlikely that our initial guesses at the values of r and s will lead to this result, we must determine a systematic way to modify our guesses so that bo and bl approach zero. To do this, Bairstow's method uses a strategy similar to the Newton- Raphson approach. Because both bo and bl are functions of both r and s, they can be ex- panded using a Taylor series, as in [recall Eq. (4.26)]

a bo a bo bo(r + Ar, s + A s ) = bo + - Ar + - As

ar as where the values on the right-hand side are all evaluated at r and s. Notice that second- and higher-order terms have been neglected. This represents an implicit assumption that -r and -s are small enough that the higher-order terms are negligible. Another way of expressing this assumption is to say that the initial guesses are adequately close to the values of r and s at the roots.

The changes, Ar and As, needed to improve our guesses can be estimated by setting Eq. (7.33) equal to zero to give

If the partial derivatives of the b's can be determined, these are a system of two equations that can be solved simultaneously for the two unknowns, Arand As. Bairstow showed that the partial derivatives can be obtained by a synthetic division of the h's in a fashion simi- lar to the way in which the b's themselves were derived:

where abo/ar = el , i3ho/as = abl/ar = c2, and abl/as = c3. Thus, the partial derivatives are obtained by synthetic division of the h's. Then the partial derivatives can be substituted into Eqs. (7.34) and (7.35) along with the b's to give

Page 71: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 80 ROOTS OF POLYNOMIALS

These equations can be solved for Ar and As, which can in turn be employed to improve the initial guesses of r and s. At each step, an approximate error in rands can be estimated, as in

and

When both of these error estimates fall below a prespecified stopping criterion E,, the val- ues of the roots can be determined by

At this point, three possibilities exist:

1. The quotient is a third-order polynomial or greater. For this case, Bairstow's method would be applied to the quotient to evaluate new values for r and s. The previous values of r and s can serve as the starting guesses for this application.

2. The quotient is a quadratic. For this case, the remaining two roots could be evaluated directly with Eq. (7.39).

3. The quotient is afirst-order polynomial. For this case, the remaining single root can be evaluated simply as

EXAMPLE 7.3 Bairstow's Method

! Problem Statement. Employ Bairstow's method to determine the roots of the polynomial I

/ Use initial guesses of r = s = - 1 and iterate to a level of E, = 1 %.

j Solution. Equations (7.32) and (7.36) can be applied to compute i

1 Thus, the simultaneous equations to solve for Ar and As are

I j -4.875Ar + 10.75As = 10.5

i -16.375Ar - 4.875As = -11.375

1 which can be solved for Ar = 0.3558 and As = 1.1381. Therefore, our original guesses can be corrected to

Page 72: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.5 BAIRSTOW'S METHOD 181

i and the approximate errors can be evaluated by Eqs. (7.37) and (7.38), I

i : Next, the computation is repeated using the revised values for r and s. Applying Eqs. (7.32) I and (7.36) yields

Therefore, we must solve

for Ar = 0.1331 and As = 0.3316, which can be used to correct the root estimates as

r = -0.6442 + 0.1331 = -0.51 11 Is,,. I = 26.0%

s = 0.1381 + 0.3316 = 0.4697 Is,,, I = 70.6%

The computation can be continued, with the result that after four iterations the method converges on values of r = -0.5 I = 0.063%) and s = 0.5 ((s,,, I = 0.040%). Equa- tion (7.39) can then be employed to evaluate the roots as

At this point, the quotient is the cubic equation

Bairstow's method can be applied to this polynomial using the results of the previous step, r = -0.5 and s = 0.5, as starting guesses. Five iterations yield estimates of r = 2 and s = - 1.249, which can be used to compute

1 At this point, the quotient is a first-order polynomial that can be directly evaluated by i Eq. (7.40) to determine the fifth root: 2. j- -

Note that the heart of Bairstow's method is the evaluation of the b's and c's via Eqs. (7.32) and (7.36). One of the primary strengths of the method is the concise way in which these recurrence relationships can be programmed.

Figure 7.5 lists pseudocode to implement Bairstow's method. The heart of the algo- rithm consists of the loop to evaluate the b's and c's. Also notice that the code to solve the simultaneous equations checks to prevent division by zero. If this is the case, the values of r and s are perturbed slightly and the procedure is begun again. In addition, the algorithm

Page 73: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

182 ROOTS OF POLYNOMIALS

(a) Bairstow Algorithm

SUB Bairstow (a,nn,es,rr,ss,maxit,re,im,ier) DIMENSION b(nn), c(nn) r = r r ;s = 55;n = nn ier = 0; ea1 = 1: ea2 = 1 DO

IF n < 3 OR iter > maxit EXlT iter = 0 DO

iter = iter + 1 b(n) = a(n) b(n - 1) = a(n - 1) + r * b(n) c(n) = b(n) c(n - 1) = b(n - 1) + r * c(n) DOi = n - 2 , 0 , -1

b(i) = a(i) + r * b(i + 1) + s * b(i + 2 ) ~ ( i ) = b(i) + r * c(i + 1) + s * c(i + 2)

END DO det = 4 2 ) * c(2) - 4 3 ) * c(l) IF det # 0 THEN

dr = (-b(1) * ~ ( 2 ) + b(0) * c(3))Idet ds = (-b(0) * c(2) + b(1) * c(?))/det r = r + d r (b) Roots of Quadratic Algorithm

IF iter c maxit THEN IFn = 2 THEN

r = -a(l)/a(Z) 5 = -a(O)/a(2) CALL Quadroot(r,s,r?,il,r2,i2) re(n) = rl im[n) = i1 re(n - 1) = r2 im(n - 1) = i2

ELSE re(n) = -a(O)/a(l) im(n) = 0

END IF ELSE

ier = ? END IF END Bairstow

s = s + d s IF r f 0 THEN ea1 = ABS(dr/r) * 100 IF s f 0 THEN ea2 = ABS(ds/s) * 100

ELSE r = r + 1 s = s + 1 iter = 0

END IF IF eal 5 es AND ea2 5 es OR iter > maxit EXlT

END DO CALL Quadroot(r,s,r1,il,r2,i2) re(n) = r1 im(n) = i1 re(n - 1) = r2 im(n - 1) = i2

SUB Quadroot (r,s,r?,il,rZ,iZ) d i s c = r A 2 + 4 * s IF disc > 0 THEN

r1 = (r + SQRT(disc))/2 r2 = (r - SQRT[disc))/2 i1 = 0 i2 = 0

ELSE r1 = 1-12 r2 = r1 i1 = SQRT(ABS(disc))/2 i2 = -il

END IF END QuadRoot

n = n - 2 DO i = 0 , n

a(i) = b(i + 2 ) END DO

END DO

FIGURE 7.5 (a) Algorithm for implementing Bairstow's method, along with (b) an algorithm to determine the roots of a quadratic

Page 74: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.7 ROOT LOCATION WITH LIBRARIES AND PACKAGES 183

places a user-defined upper limit on the number of iterations (MAXIT) and should be de- signed to avoid division by zero while calculating the error estimates. Finally, the algo- rithm requires initial guesses for r and s (rr and ss in the code). If no prior knowledge of the roots exist, they can be set to zero in the calling program.

7.6 OTHER METHODS

Other methods are available to locate the roots of polynomials. The Jenkins-Traub method (Jenkins and Traub, 1970) is commonly used in software libraries like IMSL. It is fairly complicated, and a good starting point to understanding it is found in Ralston and Rabinowitz (1978).

Laguerre's method, which approximates both real and complex roots and has cubic convergence, is among the best approaches. A complete discussion can be found in House- holder (1970). In addition, Press et al. (1992) present a nice algorithm to implement the method.

7.7 ROOT LOCATION WlTH LIBRARIES AND PACKAGES

Software libraries and packages have great capabilities for locating roots. In this section, we will give you a taste of some of the more useful ones.

7.7.1 Mathcad

Mathcad has a numeric mode function called root that can be used to solve an equation of a single variable using the secant method. The method requires that you supply a function f ( x ) and an initial guess. It iterates until the magnitude of f (x ) at the proposed root is less than the predefined value of TOL. The Mathcad implementation has similar advantages and disadvantages as the conventional secant method such as issues concerning the accu- racy of the initial guess and the rate of convergence.

Mathcad can find all the real or complex roots of polynomials with polyroots. This nu- meric or symbolic mode function is based on the Laguerre method. This function does not require initial guesses, and all the roots are returned at the same time.

Mathcad contains a numeric mode function called Find that can be used to solve up to 50 simultaneous nonlinear algebraic equations. Acceptable values for the solution may be unconstrained or constrained to fall within specified limits. If Find fails to locate a solution that satisfies the equations and constraints, it returns the error message "did not find solu- tion." However, Mathcad also contains a similar function called Minerr. This function gives solution results that minimize the errors in the constraints even when exact solutions cannot be found. Thus, the problem of solving for the roots of nonlinear equations is closely related to both nonlinear least-squares and optimization problems. These problems and Minerr are covered in detail in Parts Four and Five.

Figure 7.6 shows a typical Mathcad worksheet. The menus at the top give you quick access to common arithmetic operators and functions, various two- and three-dimensional plot types, and the environment to create subprograms. Equations, text, data, or graphs can be placed anywhere on the screen. You can use a variety of fonts, colors, and styles to con- struct worksheets with almost any design and format that pleases you. Consult the

Page 75: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 84 ROOTS OF POLYNOMIALS

File Edit m w Insert Fonnat W~ Symboncs Wndow )blp

FIGURE 7.6 Mathcad screen to solve single equation.

summary of the Mathcad User's manual in App. B or the full manual available from Math- soft. Note that in all our Mathcad examples, we have tried to fit the entire Mathcad session onto a single screen. You should realize that the graph would have to be placed below the commands to work properly.

Let's start with an example that solves for the root of f(x) = x - cos x. The first step is to enter the function. This is done by typing f(x): which is automatically converted to f(x):= by Mathcad. The := is called the definition symbol. Next an initial guess is input in a similar manner using the definition symbol. Now, soln is defined as root (f(x), x), which invokes the secant method with a starting value of 1 .O. Iteration is continued until f(x) eval- uated at the proposed root is less than TOL. The value of TOL is set from the Mathlop- tions pull down menu. Finally the value of soln is displayed using a normal equal sign (=). The number of significant figures is set from the Format/Number pull down menu. The text labels and equation definitions can be placed anywhere on the screen in a number of dif- ferent fonts, styles, sizes, and colors. The graph can be placed anywhere on the worksheet by clicking to the desired location. This places a red cross hair at that location. Then use the Insert/Graph/X-Y Plot pull down menu to place an empty plot on the worksheet with place- holders for the expressions to be graphed and for the ranges of the x and y axes. Simply type f ( z ) in the placeholder on they axis and - 10 and 10 for the z-axis range. Mathcad does all the rest to produce the graph shown in Fig. 7.6. Once the graph has been created you can use the Format/Graph/X-Y Plot pull down menu to vary the type of graph; change the color, type, and weight of the trace of the function; and add titles, labels and other features.

Figure 7.7 shows how Mathcad can be used to find the roots of a polynomial using the polyroots function. First, p(x) and v are input using the := definition symbol. Note that v is a vector that contains the coefficients of the polynomial starting with zero-order term and ending in this case with the third-order term. Next, r is defined (using :=) as polyroots(v),

Page 76: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.7 ROOT LOCATION WITH LIBRARIES AND PACKAGES 185

Inpa vector of coeEficimts, beginningwithconstanttam: tg O

Determine the rods

fl= [-3.25789'701 0.2W80976 3.05708726 ]

FIGURE 7.7 Mathcad screen to solve for roots of polynomial.

which invokes the Laguerre method. The roots contained in r are displayed as using a normal equal sign (=). Next, a plot is constructed in a manner similar to the above, except that now two range variables, j and x, are used to define the range of the x axis and the lo- cation of the roots. The range variable for x is constructed by typing x and then ":" (which appears as :=) and then -4, and then "," and then -3.99, and then ";" (which is trans- formed into .. by Mathcad), and finally 4. This creates a vector of values of x ranging from -4 to 4 with an increment of 0.01 for the x axis with corresponding values for p(x) on the y axis. The j range variable is used to create three values for r and p(r) that are plotted as individual small squares. Note that again, in our effort to fit the entire Mathcad session onto a single screen, we have placed the graph above the commands. You should realize that the graph would have to be below the commands to work properly.

The last example shows the solution of a system of nonlinear equations using a Math- cad Solve Block (Fig. 7.8). The process begins with using the definition symbol to create initial guesses for x and y. The word Given then alerts Mathcad that what follows is a sys- tem of equations. Then comes the equations and inequalities (not used here). Note that for this application Mathcad requires the use of a symbolic equal sign typed as [Ctrl]= or < and > to separate left and right sides of an equation. Now, the variable vec is defined as Find (x,y) and the value of vec is shown using an equal sign.

7.7.2 Excel

A spreadsheet like Excel can be used to locate a root by trial and error. For example, if we want to find a root of

f(x) = X - COSX

Page 77: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

186 ROOTS OF POLYNOMIALS

Enter then equaticns: [Note Use the symbolic equals sign[CM]=

for equations within thesolve Block.]

FIGURE 7.8 Mathcad screen to solve a system of nonlinear equations.

FIGURE 7.9 A spreadsheet set up to determine the root of f(x) = x - cos x by trial and error. The plot is used to obtain a good initial guess.

first, you can enter a value for x in a cell. Then set up another cell for f(x) that would ob- tain its value for x from the first cell. You can then vary the x cell until the f(x) cell ap- proaches zero. This process can be further enhanced by using Excel's plotting capabilities to obtain a good initial guess (Fig. 7.9).

Although Excel does facilitate a trial-and-error approach, it also has two standard tools that can be employed for root location: Goal Seek and Solver. Both these tools can be em- ployed to systematically adjust the initial guesses. Goal Seek is expressly used to drive an equation to a value (in our case, zero) by varying a single parameter.

Page 78: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.7 ROOT LOCATION WITH LIBRARIES AND PACKAGES 187

EXAMPLE 7.4 Using Excel's Goal Seek Tool to Locate a Single Root

1 Problem Statement. Employ Goal Seek to determine the root of the transcendental I ! function

f(x) = X - COSX

Solution. As in Fig. 7.9, the key to solving a single equation with Excel is creating a cell to hold the value of the function in question, and then making the value dependent on another cell. Once this is done, the selection Goal Seek is chosen from the Tools menu. At this point a dialogue box will be displayed, asking you to set a cell to a value by changing another cell. For the example, suppose that as in Fig. 7.9 your guess is entered in cell B10 and your function result in cell B11. The Goal Seek dialogue box would be filled out as

I When the OK button is selected, a message box displays the results, i

i The cells on the spreadsheet would also be modified to the new values (as shown in Fig. 7.9). I

The Solver tool is more sophisticated than Goal Seek in that (1) it can vary several cells simultaneously and (2) along with driving a target cell to a value, it can minimize and maximize its value. The next example illustrates how it can be used to solve a system of nonlinear equations.

EXAMPLE 7.5 Using Excel's Solver for a Nonlinear System

Problem Statement. Recall that in Sec. 6.5 we obtained the solution of the following set of simultaneous equations,

Note that a correct pair of roots is x = 2 and y = 3. Use Solver to determine the roots using initial guesses of x = 1 and y = 3.5.

Page 79: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

ROOTS OF POLYNOMIALS

Solution. As shown below, two cells (B1 and B2) can be created to hold the guesses for x and y. The function values themselves, u(x, y) and v(x, y) can then be entered into two other cells (B3 and B4). As can be seen, the initial guesses result in function values that are far from zero.

Next, another cell can be created that contains a single value reflecting how close both functions are to zero. One way to do this is to sum the squares of the function values. This is done and the result entered in cell B6. If both functions are at zero, this function should also be at zero. Further, using the squared functions avoids the possibility that both func- tions could have the same nonzero value, but with opposite signs. For this case, the target cell (B6) would be zero, but the roots would be incorrect.

Once the spreadsheet is created, the selection Solver is chosen from the Tools menu. At this point a dialogue box will be displayed, querying you for pertinent information. The pertinent cells of the Solver dialogue box would be filled out as

Equal to 0 max 0 mln equal to ] By chang~ng cells

When the OK button is selected, a dialogue box will open with a report on the success of the operation. For the present case, the Solver obtains the correct solution:

Page 80: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.7.3 ROOT LOCATION WITH LIBRARIES AND PROBLEMS 189

It should be noted that the Solver can fail. Its success depends on (1) the condition of the system of equations and/or (2) the quality of the initial guesses. Thus, the successful outcome of the previous example is not guaranteed. Despite this, we have found Solver useful enough to make it a feasible option for quickly obtaining roots in a wide range of en- gineering applications.

Although add-ons are available that can expand its fundamental capabilities, the basic MATLAB package did not have a general root-location capability at the time this book was published. However, it is superb at manipulating and locating the roots of polynomials. Some of the key MATLAB functions related to polynomial manipulation are listed in Table 7.1. The following example illustrates how some of these functions can be employed to both manipulate polynomials and determine their roots.

TABLE 7.1 Common functions in MATLAB related to polynomial manipulation and root location.

EXAMPLE 7.6

Function Description

roots

PO~Y polyval polyvolm residue polyder conv deconv

Find polynomial roots. Construct polynomial with specified roots. Evaluate polynomial. Evaluate polynomial with matrix argument Partial-fraction expansion (residues). Differentiote polynomial. Multiply polynomials. Divide polynomials.

Using MATLAB to Manipulate and Determine the Roots of Polynomials

Problem Statement. Explore how MATLAB can be employed to manipulate and determine the roots of polynomials. Use the following equation from Example 7.3,

which has three real roots: 0.5, - 1 .O, and 2, and one pair of complex roots: - 1 f 0.5.

Solution. Polynomials are entered into MATLAB by storing the coefficients as a vector. For example, at the MATLAB prompt (>>) typing and entering the follow line stores the coefficients in the vector a.

We can then proceed to manipulate the polynomial. For example we can evaluate it at x = 1 by typing

Page 81: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 90 ROOTS OF POLYNOMIALS

with the result 1 ( 1 ) ~ - 3.5(1)~ + 2.75(1)~ + 2.125(1)~ - 3.875(1) + 1.25 = -0.25,

a n s = - 0 .2500

We can evaluate the derivative f'(x) = 5x4 - 149 + 8.25x2 + 4 . 2 5 ~ - 3.875 by

>> p o l y d e r ( a ) a n s =

5.0000 -14 .0000 8 .2500 4 .2500 -3 .8750

Next, let's create a quadratic polynomial that has roots corresponding to two of the origi- nal roots of Eq. (E7.6.1): 0.5 and -1. This quadratic is (x - 0.5)(x + 1) = x2 + 0 . 5 ~ - 0.5 and can be entered into MATLAB as the vector b,

We can divide this polynomial into the original polynomial by

with the result being a quotient (a third-order polynomial d) and a remainder (e),

Because the polynomial is a perfect divisor, the remainder polynomial has zero coeffi- cients. Now, the roots of the quotient polynomial can be determined as

with the expected result that the remaining roots of the original polynomial (E7.6.1) are found,

a n s = 2 .0000 1 .0000 + 0 . 5 0 0 0 i 1 . O O O O - 0 . 5 0 0 0 i

We can now multiply d by b to come up with the original polynomial,

>> conv(d,b) a n s =

1.0000 -3 .5000 2 .7500 2 .1250 -3 .8750 1 .2500

Finally, we can determine all the roots of the original polynomial by

Page 82: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

7.7 ROOT LOCATION WITH LIBRARIES AND PROBLEMS 191

TABLE 7.2 IMSL routines to locate roots.

Cakgory Routine Capability

Roots of a function ZREAL Finds the real zeros of a real funct~on using Muller's method.

ZBREN Finds a zero of a real function that changes sign in a given interval.

ZANlY Finds the zeros of a univariote complex function using Muller's method.

Root of a system of equations NEQNF Solves a system of nonlinear equations using a modified

Powell hybrid algorithm (a variation of Newton's method) and a finite-difference approximation of the Jacobian.

NEQNJ Solves a system of nonlinear equations using a modified Powell hybrid algorithm (a variation of Newton's method) with a user-supplied Jacobian.

NEQBF Solves a system of nonlinear equat~ons using factored secant update and a finite-difference approximation of the Jacobian.

NEQBJ Solves a system of nonlinear equations using factored secant update with a user-supplied Jacobian.

Roots of polynomials ZPORC Finds the zeros of polynomials with real coefficients with the

Jenkins-Traub algorithm. ZPLRC Finds the zeros of polynomials with real coefficients with the

Laguerre method. ZPOCC Finds the zeros of polynomials with complex coeff~cients

with the Jenkins-Traub algorithm.

IMSL has several subroutines for determining roots of equations (Table 7.2). In the present discussion, we will focus on the ZREAL routine. This routine locates the real zeros of a real function using Miiller's method.

ZREAL is implemented by the following CALL statement,

C A L L Z R E A L ( F , E R A B S , E R R E L , E P S , E T A , N R , I M A X , X O , X , I N F O )

where F = A user-defined function for which the zeros are to be found.

ERABS = First stopping criterion, terminates if I f(x;)l < ERABS. (Input)

ERREL = Second stopping criterion; terminates if /(xi - ERREL. (Input)

EPS = See ETA. (Input)

ETA = Spread criteria for multiple roots. (Input)

If the zero, xi, has been computed and Ix; - xjl < EPS, where x, is a previ- ously computed zero, the computation is restarted with a new guess of X; + ETA.

NR = Number of roots to be found. (Input)

IMAX = Maximum allowable iterations per zero. (Input)

Page 83: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

192 ROOTS OF POLYNOMIALS

XO = A vector of length NROOT containing the initial guesses. (Input)

X = A vector of length NROOT containing the computed zeros. (Output)

INFO = An integer vector of length NROOT. (Output) Contains the number of iterations to find each root.

Note that the iterations terminate when either of the stopping criteria are met, or the maximum iterations are exceeded. The function F has the general format

F U N C T I O N F ( X ) R E A L F,X F = ... END

where the line "F = . . ." is where the function of the unknown variable X is written.

EXAMPLE 7.7 Using IMSL to Locate a Single Root

Problem Statement. Use ZREAL to determine the root of the transcendental function

Solution. An example of a main Fortran 90 program and function using ZREAL to solve this problem can be written as

PROGRAM R o o t I M P L I C I T NONE 1 N T E G E R : : n r o o t P A R A M E T E R ( n r o o t = l ) I N T E G E R : : i t m a x = 5 0 REAL::errabs=O.,errrel=I.E-5,eps=0.,eta=o. REAL::f,xO(nroot),x(nroot) E X T E R N A L f I N T E G E R : : i n f o ( n r o o t ) P R I N T *, " E n t e r i n i t i a l g u e s s " READ *, x O C A L L Z R E A L ( f , e r r a b s , e r r r e ~ , e p s , e t a , n r o ~ t , i t m a x , x ~ , x , i n f o ~ P R I N T *, " r o o t = " r X

P R I N T *, " i t e r a t i o n s = ", i n f o END PROGRAM

F U N C T I O N f ( x ) I M P L I C I T NONE R E A L : : f ,x f = x - c o s ( x ) END F U N C T I O N

Output:

E n t e r i n i t i a l g u e s s 0 . 5 r o o t = 7 . 3 9 0 8 5 1 E - 0 1 i t e r a t i o n s = 5

Page 84: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PROBLEMS

PROBLEMS

7.1 Divide a polynomial

by the monomial factor x - 2. Is x = 2 a root? 7.2 Divide a polynomial

by the monomial factor x - 2. 7.3 Use Miiller's method to determine the positive real root of (a) f(x) = 2 + 2 - 4x - 4 ( b ) f(x) = X3 - 0 . 5 2 + 4x - 2 7.4 Use Miiller's method to determine the real and complex roots of (a) f(x) = 2 - 2 + 2x - 2 ( b ) f(x) = 2x4+ @ + 8 (c) f(x) = x 4 - 22 + 6 2 - 2x + 5 7.5 Use Bairstow's method to determine the roots of (a ) f(x) = -2 + 6.2x - 4 2 + 0 . 7 2 (b) f(x) = 9.34 - 2 1 . 9 7 ~ + 16.32 - 3.7042 (c) f(x) = x 4 - 2x3 + 6 2 - 2x + 5 7.6 Develop a subprogram to implement Miiller's method. Test it by duplicating Example 7.2. 7.7 Use the subprogram developed in Prob. 7.6 to determine the real roots of Prob. 7.4a. Construct a graph (by hand or with the TOOLKIT, Excel, or some other graphics package) to develop suit- able starting guesses. 7.8 Develop a subprogram to implement Bairstow's method. Test it by duplicating Example 7.3. 7.9 Use the subprogram developed in Prob. 7.8 to determine the roots of the equations in Prob. 7.5. 7-10 Determine the real root of 2.3 = 7 9 with the Goal Seek capa- bility of Excel or a library or package of your choice.

7.11 The velocity of a falling parachutist v is given by

where g = 9.8 m/s2. For a parachutist with a drag coefficient c = 14 kg/s, compute the mass m so that the velocity is v = 35 m/s at t = 7 s. Use the Goal Seek capability of Excel or a library or package of your choice to determine m. 7.12 Determine the roots of the simultaneous nonlinear equations

Employ initial guesses of x = y = 1.2 and use the Solver tool from Excel or a library or package of your choice. 7.13 Determine the roots of the simultaneous nonlinear equations

y + 1 = x 2 x2 = 5 - Y 2

Use a graphical approach to obtain your initial guesses. Determine refined estimates with the Solver tool from Excel or a library or package of your choice. 7-14 Perform the identical MATLAB operations as those in Exam- ple 7.6, or use a library or package of your choice to find all the roots of the polynomial

f s (x ) = (X + 2)(x - 6)(x - I) (x + 4)(x - 8)

7.15 Use MATLAB or a library or package of your choice to de- termine the roots for the equations in Prob. 7.5. 7.16 Develop a subprogram to solve for the roots of a polynomial using the IMSL routine, ZREAL, or a library or package of your choice. Test it by determining the roots of the equations from Probs. 7 .4 and 7.5.

Page 85: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

CHAPTER 8 t n g ~ n Roots

eerlng of Equ

ications:

The purpose of this chapter is to use the numerical procedures discussed in Chaps. 5 ,6 , and 7 to solve actual engineering problems. Numerical techniques are important for practical applications because engineers frequently encounter problems that cannot be approached using analytical techniques. For example, simple mathematical models that can be solved analytically may not be applicable when real problems are involved. Thus, more compli- cated models must be employed. For these cases, it is appropriate to implement a numeri- cal solution on a computer. In other situations, engineering design problems may require solutions for implicit variables in complicated equations.

The following applications are typical of those that are routinely encountered during upper-class and graduate studies. Furthermore, they are representative of problems you will address professionally. The problems are drawn from the four major disciplines of en- gineering: chemical, civil, electrical, and mechanical. These applications also serve to il- lustrate the trade-offs among the various numerical techniques.

The first application, taken from chemical engineering, provides an excellent example of how root-location methods allow you to use realistic formulas in engineering practice. In addition, it also demonstrates how the efficiency of the Newton-Raphson technique is used to advantage when a large number of root-location computations is required.

The following engineering design problems are taken from civil, electrical, and me- chanical engineering. Section 8.2 uses both bracketing and open methods to determine the depth and velocity of water flowing in an open channel. Section 8.3 shows how the roots of transcendental equations can be used in the design of an electrical circuit. Sections 8.2 and 8.3 also illustrate how graphical methods provide insight into the root-location process. Fi- nally, Sec. 8.4 uses polynomial root location to analyze the vibrations of an automobile.

8.1 IDEAL AND NONIDEAL GAS LAWS (CHEMICAL/PETROLEUM ENGINEERING) Background. The ideal gas law is given by

where p is the absolute pressure, V is the volume, n is the number of moles, R is the uni- versal gas constant, and T is the absolute temperature. Although this equation is widely

Page 86: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.1 IDEAL AND NONIDEAL GAS LAWS (CHEMICALIPETROLEUM ENGINEERING) 195

used by engineers and scientists, it is accurate over only a limited range of pressure and tem- perature. Furthermore, Eq. (8.1) is more appropriate for some gases than for others.

An alternative equation of state for gases is given by

known as the van der Waals equation, where v = V / n is the mold volume and a and b are empirical constants that depend on the particular gas.

A chemical engineering design project requires that you accurately estimate the molal volume ( v ) of both carbon dioxide and oxygen for a number of different temperature and pressure combinations so that appropriate containment vessels can be selected. It is also of interest to examine how well each gas conforms to the ideal gas law by comparing the molal volume as calculated by Eqs. (8.1) and (8.2). The following data are provided:

a = 3.592 carbon dioxide

b = 0.04267

a = 1.360 oxygen

b = 0.03183

The design pressures of interest are 1, 10, and 100 atm for temperature combinations of 300,500, and 700 K.

Solution. Molal volumes for both gases are calculated using the ideal gas law, with n = 1. For example, if p = 1 atm and T = 300 K ,

V RT u = - =

L atm 300 K - = 0.082054 - - = 24.6162 L/mol

n P mol K 1 atm

These calculations are repeated for all temperature and pressure combinations and pre- sented in Table 8.1.

TABLE 8.1 Computations of molal volume.

Molal Volume Temperature, Pressure, (Ideal Gas Law),

K atm L/mol

300 1 24.6 162 10 2.4616

1 00 0.2462 500 1 41 0270

10 4.1027 1 00 0.4 103

700 1 57.4378 10 5.7438

1 00 0.5744

Molal Volume (van der Waals) Carbon Dioxide,

L/mol

24.5 1 26 2.3545 0.0795

40.982 1 4.0578 0.3663

57.4 179 5.7242 0.5575

Molal Volume (van der Waals)

Oxygen, L/mol

24.5928 2.4384 0.2264

4 1.0259 4.1016 0.41 16

57.4460 5.7521 0.5842

Page 87: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

1 96 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

The computation of molal volume from the van der Waals equation can be accom- plished using any of the numerical methods for finding roots of equations discussed in Chaps. 5 ,6 , and 7, with

In this case, the derivative of f ( v ) is easy to determine and the Newton-Raphson method is convenient and efficient to implement. The derivative of f ( v ) with respect to v is given by

The Newton-Raphson method is described by Eq. (6.6):

which can be used to estimate the root. For example, using the initial guess of 24.6162, the molal volume of carbon dioxide at 300 K and 1 atm is computed as 24.5126 Llmol. This result was obtained after just two iterations and has an E, of less than 0.001 percent.

Similar computations for all combinations of pressure and temperature for both gases are presented in Table 8.1. It is seen that the results for the ideal gas law differ from those for van der Waals equation for both gases, depending on specific values for p and T. Fur- thermore, because some of these results are significantly different, your design of the con- tainment vessels would be quite different, depending on which equation of state was used.

In this case, a complicated equation of state was examined using the Newton-Raphson method. The results varied significantly from the ideal gas law for several cases. From a practical standpoint, the Newton-Raphson method was appropriate for this application be- cause f f ( v ) was easy to calculate. Thus, the rapid convergence properties of the Newton- Raphson method could be exploited.

In addition to demonstrating its power for a single computation, the present design problem also illustrates how the Newton-Raphson method is especially attractive when nu- merous computations are required. Because of the speed of digital computers, the effi- ciency of various numerical methods for most roots of equations are indistinguishable for a single computation. Even a 1-s difference between the crude bisection approach and the efficient Newton-Raphson does not amount to a significant time loss when only one com- putation is performed. However, suppose that millions of root evaluations are required to solve a problem. In this case, the efficiency of the method could be a deciding factor in the choice of a technique.

For example, suppose that you are called upon to design an automatic computerized control system for a chemical production process. This system requires accurate estimates of molal volumes on an essentially continuous basis to properly manufacture the final product. Gauges are installed that provide instantaneous readings of pressure and tempera- ture. Evaluations of v must be obtained for a variety of gases that are used in the process.

For such an application, bracketing methods such as bisection or false position would probably be too time-consuming. In addition, the two initial guesses that are required for

Page 88: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.2 OPEN-CHANNEL FLOW (CIVIL/ENVIRONMENTAL ENGINEERING) 197

these approaches may also interject a critical delay in the procedure. This shortcoming is relevant to the secant method, which also needs two initial estimates.

In contrast, the Newton-Raphson method requires only one guess for the root. The ideal gas law could be employed to obtain this guess at the initiation of the process. Then, assuming that the time frame is short enough so that pressure and temperature do not vary wildly between computations, the previous root solution would provide a good guess for the next application. Thus, the close guess that is often a prerequisite for convergence of the Newton-Raphson method would automatically be available. All the above considera- tions would greatly favor the Newton-Raphson technique for such problems.

8.2 OPEN-CHANNEL FLOW (CIVIL/ENVIRONMENTAL ENGINEERING)

Background. Civil engineering is a broad field that includes such diverse areas as struc- tural, geotechnical, transportation, environmental, and water-resources engineering. The last two specialties deal with both water pollution and water supply, and hence, make ex- tensive use of the science of fluid mechanics.

One general problem relates to the flow of water in open channels such as rivers and canals. The flow rate, which is routinely measured in most major rivers and streams, is de- fined as the volume of water passing a particular point in a channel per unit time, Q (m3/s).

Although the flow rate is a useful quantity, a further question relates to what happens when you put a specific flow rate into a sloping channel (Fig. 8.1). In fact, two things hap- pen: the water will reach a specific depth H (m) and move at a specific velocity U (mls). Environmental engineers might be interested in knowing these quantities to predict the transport and fate of pollutants in a river. So the general question is: if you are given the flow rate for a channel, how do you compute the depth and velocity?

Solution. The most fundamental relationship between flow and depth is the continuity equation:

Q = UA,. (8.5)

where A,. = the cross-sectional area of the channel (m2). Depending on the channel shape, the area can be related to the depth by some functional relationship. For the rectangular

FIGURE 8.1

Page 89: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

198 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

channel depicted in Fig. 8.1, A, = BH. Substituting this relationship into Eq. (8.5) gives

Q = UBH (8.6)

where B = the width (m). It should be noted that the continuity equation derives from the conservation of mass (recall Table 1.1).

Now, although Eq. (8.6) certainly relates the channel parameters, it is not sufficient to answer our question. Assuming that B is specified, we have one equation and two un- knowns (U and H). We therefore require an additional equation. For uniform flow (mean- ing that the flow does not vary spatially and temporally) the Irish engineer Robert Manning proposed the following semiempirical formula (appropriately called the Manning equation)

where n = the Manning roughness coefficient (a dimensionless number used to parame- terize the channel friction), S = the channel slope (dimensionless, meters drop per meter length), and R = the hydraulic radius (m), which is related to more fundamental parame- ters by

where P = the wetted perimeter (m). As the name implies, the wetted perimeter is the length of the channel sides and bottom that is under water. For example, for a rectangular channel, it is defined as

It should be noted that just as the continuity equation derives from the conservation of mass, the Manning equation is an expression of the conservation of momentum. In particu- lar, it indicates how velocity is dependent on roughness, a manifestation of friction.

Although the system of nonlinear equations (8.6 and 8.7) can be solved simultane- ously (for example, using the multidimensional Newton-Raphson approach described in Sec. 6.5.2), an easier approach would be to combine the equations. Equation (8.7) can be substituted into Eq. (8.6) to give

Then the hydraulic radius, Eq. (8.8), along with the various relationships for the rec- tangular channel can be substituted,

Thus, the equation now contains a single unknown H along with the given value for Q and the channel parameters (n, S , and B).

Although we have one equation with an unknown, it is impossible to solve explicitly for H. However, the depth can be determined numerically by reformulating the equation as a roots problem,

Page 90: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.2 OPEN-CHANNEL FLOW (CIVIL/ENVIRONMENTAL ENGINEERING) 1 99

Equation (8.12) can be solved readily with any of the root-location methods described in Chaps. 5 and 6. For example, if Q = 5 m3/s, B = 20 m, n = 0.03, and S = 0.0002, the equation is

It can be solved for H = 0.7023 m. The result can be checked by substitution into Eq. (8.13) to give

which is quite close to zero. Our other unknown, the velocity, can now be determined by substitution back into

Eq. (8.6),

Thus, we have successfully solved for the depth and velocity. Now let's delve a little deeper into the numerical aspects of this problem. One perti-

nent question might be: how do we come up with good initial guesses for our numerical method? The answer depends on the type of method.

For bracketing methods such as bisection and false position, one approach would be to determine whether we can estimate lower and upper guesses that always bracket a single root. A conservative approach might be to choose zero as our lower bound. Then, if we knew the maximum possible depth that could occur, this value could serve as the upper guess. For example, all but the world's biggest rivers are less than about 10 m deep. There- fore, we might choose 0 and 10 as our bracket for H.

If Q > 0 and H = 0, Eq. (8.12) will always be negative for the lower guess. As H is increased, Eq. (8.12) will increase monotonically and eventually become positive. There- fore, the guesses should bracket a single root for most cases routinely confronted in natural rivers and streams.

Now, a technique like bisection should very reliably home in on the root. But what price is paid? By using such a wide bracket and a technique like bisection, the number of iterations to attain a desirable precision could be computationally excessive. For example, if a tolerance of 0.001 m were chosen, Eq. (5.5) could be used to calculate

log (10/0.001) n = = 13.3

log 2

Thus, 14 iterations would be required. Although this would certainly not be costly for a sin- gle calculation, it could be exorbitant if many such evaluations were made. The alternatives would be to narrow the initial bracket (based on system-specific knowledge), change to a more efficient bracketing technique (like false position), or accept a coarser precision.

Page 91: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

200 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

Another way to get better efficiency would be to use an open method like the Newton- Raphson or secant methods. Of course, for these cases, the problem of initial guesses is complicated by the issue of convergence.

Insight into these issues can be attained by examining the least efficient of the open ap- proaches-fixed-point iteration. Examining Eq. (8.11), there are two straightforward ways to solve for H, that is, we can solve for either the H in the numerator,

or the H in the denominator

Now, here's where physical reasoning can be helpful. For most rivers and streams the width is much greater than the depth. Thus, the quantity B + 2H should not vary much. In fact, it should be roughly equal to B. In comparison, BH is directly proportional to H. Con- sequently, Eq. (8.16) should home in more rapidly on the root. This can be verified by sub- stituting the brackets of H = 0 and 10 into both equations. For Eq. (8.16), the results are 0.6834 and 0.9012, which are both close to the true value of 0.7023. In contrast, the results for Eq. (8.17) are -10 and 8,178, which clearly are distant from the root.

The superiority of Eq. (8.16) is further supported by component plots (recall Fig. 6.3). As in Fig. 8.2, the g(H) component for Eq. (8.16) is almost flat. Thus, it will not only con- verge, but should do so rapidly. In contrast, the g ( H ) component for Eq. (8.17) is almost vertical, connoting strong and rapid divergence.

There are two practical benefits to such an analysis:

1. In the event that a more refined open method were used, Eq. (8.16) provides a means to de- velop an excellent starting guess. For example, if H is chosen as zero, Eq. (8.12) becomes

FIGURE 8.2 Component plots for two cases of fixed-point iteration, one that will converge [(a), Eq. (8.16)] and one that will diverge [(b), Eq. (8.17)].

Page 92: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.3 DESIGN OF A N ELECTRIC CIRCUIT (ELECTRICAL ENGINEERING) 20 l

where Ho would be the initial value used in the Newton-Raphson or secant methods. 2. We have demonstrated that fixed-point iteration provides a viable option for this

particular problem. For example, using an initial guess of H = 0, Eq. (8.16) attains six digits of precision in four iterations for the case we are examining. One setting where a fixed-point formula might come in handy would be a spreadsheet application. That is, spreadsheets are ideal for a convergent, iterative formula that depends on a single cell.

8.3 DESlGN OF AN ELECTRlC ClRCUlT (ELECTRICAL ENGINEERING)

Background. Electrical engineers often use Kirchhoff's laws to study the steady-state (not time-varying) behavior of electric circuits. Such steady-state behavior will be exam- ined in Sec. 12.3. Another important problem involves circuits that are transient in nature where sudden temporal changes take place. Such a situation occurs following the closing of the switch in Fig. 8.3. In this case, there will be a period of adjustment following the closing of the switch as a new steady state is reached. The length of this adjustment period is closely related to the storage properties of the capacitor and the inductor. Energy storage may oscillate between these two elements during a transient period. However, resistance in the circuit will dissipate the magnitude of the oscillations.

The flow of current through the resistor causes a voltage drop (VR) given by

where i = the current and R = the resistance of the resistor. When R and i have units of ohms and amperes, VR has units of volts.

Similarly, an inductor resists changes in current, such that the voltage drop VL across it is

FIGURE 8.3 An electric circuit. When the switch is closed, the current will undergo a series of oscillations until a new steady state is reached.

Inductor

Page 93: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

202 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

where L = the inductance. When L and i have units of henrys and amperes, VL has units of volts and t has units of seconds.

The voltage drop across the capacitor (Vc) depends on the charge (q) on it:

4 vc = - C

where C = the capacitance. When the charge is expressed in units of coulombs, the unit of C is the farad.

Kirchhoff's second law states that the algebraic sum of voltage drops around a closed FlGURE 8.4 circuit is zero. After the switch is closed we have The charge on a capacitor as a function of time following the di 4 L - + R i + - = O closing of the switch in - dt C tig. 8 . 3 .

However, the current is related to the charge according to

Therefore,

This is a second-order linear ordinary differential equation that can be solved using the methods of calculus (see Sec. 8.4). This solution is given by

where at t = 0, q = qo = VoC, and Vo = the voltage from the charging battery. Equa- tion (8.19) describes the time variation of the charge on the capacitor. The solution q(t) is plotted in Fig. 8.4.

A typical electrical engineering design problem might involve determining the proper resistor to dissipate energy at a specified rate, with known values for L and C. For this prob- lem, assume the charge must be dissipated to 1 percent of its original value (q/qo = 0.01) in t =0.05 s,withL = 5 H a n d C = I O - ~ F .

Solution. It is necessary to solve Eq. (8.19) for R, with known values of q, qo, L, and C. However, a numerical approximation technique must be employed because R is an implicit variable in Eq. (8.19). The bisection method will be used for this purpose. The other meth- ods discussed in Chaps. 5 and 6 are also appropriate, although the Newton-Raphson method might be deemed inconvenient because the derivative of Eq. (8.19) is a little cum- bersome. Rearranging Eq. (8.19),

or using the numerical values given,

Page 94: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.4 VIBRATION ANALYSIS (MECHANICAL/AEROSPACE ENGINEERING) 203

Pendulum

A+--- LC circuit

FlGURE 8.5 Plot of Eq (8.20) used to obtain initial guesses for R that bracket the root.

FlGURE 8.6 f (R) = e-0.005R cos [2/2000 - 0.01 R2 (0.05)] - 0.01 (8.20)

Three examples of har- Examination of this equation suggests that a reasonable initial range for R is 0 to 400 S2 rnonic oscii'ators. The iwo-way (because 2000 - 0 . 0 1 ~ ~ must be greater than zero). Figure 8.5, a plot of Eq. (8.20), arrows illustrate the oscillations for each system. confirms this. Twenty-one iterations of the bisection method give R = 328.1515 a, with an

error of less than 0.0001 percent. Thus, you can specify a resistor with this rating for the circuit shown in Fig. 8.6 and

expect to achieve a dissipation performance that is consistent with the requirements of the problem. This design problem could not be solved efficiently without using the numerical methods in Chaps. 5 and 6.

8.4 VIBRATION ANALYSIS (MECHAIUICALlAEROSPACE ENGINEERING)

Background. Differential equations are often used to model the vibration of engineering systems. Some examples (Fig. 8.6) are a simple pendulum, a mass on a spring, and an inductance-capacitance electric circuit (recall Sec. 8.3). The vibration of these systems may be damped by some energy-absorbing mechanism. In addition, the vibration may be free or subject to some external periodic disturbance. In the latter case the motion is said to be forced. In this section, we will examine the free and forced vibration of the automo-

Page 95: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas
Page 96: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.4 VIBRATION ANALYSIS (MECHANICALIAEROSPACE ENGINEERING) 205

Notice the similarity with Eq. (8.18) that was developed in Sec. 8.3 for an electrical circuit. If we assume that the solution takes the form x(t) = el-', we can write the characteris-

tic equation

The unknown, r, is the solution of the quadratic characteristic equation that can be attained either analytically or numerically. In this design problem, we will first use the analytical so- lution to give us general insight into the way the system motion is affected by the model co- efficients-m, k, and c. We will also use various numerical methods to attain solutions and check the accuracy of the results using the analytical solution. Finally, we will set the stage for more complex problems to be described later in the text, where analytical results are difficult or impossible to obtain.

The solution of Eq. (8.21) for r is given by the quadratic formula

Note the significance of magnitude of c compared to 2&. If c > 2&, r, and r;! are negative real numbers, and the solution is of the form

where A and B = constants to be determined from the initial conditions of x and dx/dt. Such systems are called overdamped.

If c < 2&, the roots are complex,

where

and solution is of the form

x(t) = e-"(A cos p t + B sin p t ) (8.24)

Such systems are called underdamped. Finally, if c = 2&, the characteristic equation has a double root and the solution is

of the form

where

Such systems are called critically damped. In all three cases, x(t) approaches zero as t approaches infinity. This means that the car

always returns to the equilibrium position after encountering the pothole (although this may seem unlikely in some cities we've visited!). These cases are illustrated in Fig. 8.8.

Page 97: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

206 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

Overdamped

FIGURE 8.8 -. ' -.<]:]--,:.:? ,> 1-22, - < ., , ;; ;:<--r2.; ;I ,.; ; -. , . ,; :;.;I'-f:: 2 1:. !)' :r 5

The critical damping coefficient cc is the value of c that makes the radical in Eq. (8.22) equal to zero,

cc = 2 6 or c, = 2mp (8.26)

where

The ratio c/c, is called the damping factor and p is called the natural frequency of the un- damped free vibration.

Now, let us consider the case where the car is subject to a periodic force given by

P = P, sin wt or d = d, sin wt

where d, = P,/k = the static deflection of the car subject to a force P,. The governing differential equation for this case is

The general solution of this equation is obtained by adding a particular solution to the free vibration solution given by Eqs. (8.23) through (8.25). Let us consider the steady-state motion of the forced system where the initial transient motion has been damped out. If we assume that this steady-state solution has the form

x,,(t) = x, sin (wt - 4)

it can be shown that

The quantity, x,/d,, called the amplitude magnification factor, depends only on the ratio of the actual damping to the critical damping and the ratio of the forcing frequency to the nat- ural frequency. Note that when the forcing frequency w approaches zero, the magnification

Page 98: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.4 VIBRATION ANALYSIS (MECHANICAL/AEROSPACE ENGINEERING) 207

FIGURE 8.9 Plot of the amplitude magnifica- tion factor x,/x,j [Eq. 18.28)) versus the frequency o over the natural frequency p for various values of the damping coeffi- cient c over the critical damping coefficient c,.

factor approaches 1. Also if the system is lightly damped, that is, if c/c, is small, then the magnification factor becomes large if w is close top. If the damping is zero, then the mag- nification factor becomes infinite when w = p , and the forcing function is said to be in yes- onance with the system. Finally, as w/p becomes very large, the magnification factor ap- proaches zero. Figure 8.9 shows a plot of magnification factor as a function of w/p for various damping factors.

Observe that the magnification factor may be kept small by choosing a large damping factor or by keeping the natural and the forced frequencies far apart.

The design of the car suspension system involves a trade-off between comfort and stability for all driving conditions and speeds. You are asked to determine the stability of a proposed design that has good comfort on rough roads. The mass of the car is rn = 1.2 x lo6 g, and it has a shock system with a dampening coefficient of c = 1 x lo7 g/s.

Assume that the public's expectation of comfort is satisfied if the free vibration of the car is underdamped and the first crossing of the equilibrium position takes place in 0.05 s. If, at t = 0, the car is suddenly displaced, xo, from equilibrium and the velocity is zero (dxldt = 0) , the solution of the equation of motion is given by Eq. (8.24), with A = xo and B = xoh/p . Therefore,

h . x ( t ) = xoe-" (cos pt + - sin p t )

F

Our design conditions are met if

h x ( t ) = 0 = cos (0 .05,~) + - sin ( 0 . 0 5 ~ )

v-

Page 99: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

208 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

Since c and m are given, our design problem becomes finding an appropriate value of k that satisfies Eq. (8.29).

Solution. This can be done using the bisection, false-position, or secant methods because these methods do not require the evaluation of the derivative of Eq. (8.29), which might be considered a bit inconvenient for this problem. The solution is k = 1.397 x lo9, with 12 it- erations of the bisection method with an initial bracket from k = 1 x 109 to 2 x lo9 (E, = 0.07305%).

Although this design satisfies our free vibration requirements (after hitting the pot- hole), it must also be tested under rough road conditions. The surface of the road can be approximated as

ci = dm sin (g) where d is the deflection, dm is the maximum deflection of 0.1 m, and D is the distance be- tween peaks equal to 20 m. If the horizontal speed of the car (m/s) is v, then the overall equation of motion for the system can be written as

d 2 x d x m7 d t + c- d t + k x = kdm sin (%t )

where w = 2nuID is the forcing frequency. The stability of the car is considered satisfactory if at steady state the maximum dis-

tance x, is below 0.2 m for all driving speeds. The damping factor is calculated according to Eq. (8.26),

Now, we seek values w/p that satisfy Eq. (8.28),

When Eq. (8.30) is expressed as a roots problem,

We see that values of w/p can be determined by finding the roots of Eq. (8.31). A plot of Eq. (8.31) is shown in Fig. 8.10. This plot shows that Eq. (8.3 I) has two posi-

tive roots that can be determined with the bisection method using the TOOLKIT. The smaller value for wlp is found to equal 0.7300 in 18 iterations, with an estimated error of 0.000525% with upper and lower guesses of 0 and 1. The higher value of wip is found to be 1.1864 in 17 iterations, with an estimated error of 0.00064% with upper and lower guesses of 1 and 2.

It is also possible to express Eq. (8.30) as a polynomial,

and use MATLAB to determine the roots, as in the following:

Page 100: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

8.4 VIBRATION ANALYSIS (MECHANICAL/AEROSPACE ENGINEERING) 209

FIGURE 8.10 Plot of the amplitude magnifica- tion factor x,/xd versus the frequency w over the natural frequency p for various values of the damping coefficient c over the critical damping coeffl- cient c,.

>> a = C 1 0 - 1 . 9 4 0 4 0 . 7 5 1 ; >> r o o t s ( a ) a n s =

This confirms the result obtained with bisection. It also suggests that, although it superfi- cially appears to be a fourth-order equation in o / p , Eq. (8.32) is actually a quadratic equa- tion in

The value of the natural frequency p is given by Eq. (8.27),

The forcing frequencies, for which the maximum deflection is 0.2 m, is then calculated as

w = 0.7300(34.12) = 24.91 S - I

w = 1.1864(34.12) = 40.48 S-'

which yields

w D 24.91(20) m 3600 s km u = - = = 79.29 - x - ---- = 285 km/hr (= 177 mikr)

2n 2(3.14159) s hr 100Om

Page 101: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

210 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

Thus, using the above results and Fig. 8.10, it is found that the proposed car design will behave acceptably for common driving speeds. At this point, the designer must be aware that the design would not meet suitability requirements at extremely high speeds (e.g., racing).

This design problem has presented an extremely simple example that has allowed us to obtain some analytical results that were used to evaluate the accuracy o f our numerical methods for finding roots. Real cases can quickly become so complicated that solutions can be obtained only by using numerical methods.

PROBLEMS

Chemical Engineering 8.1 Perform the same computation as in Sec. 8.1, but for ethyl al- cohol (a = 12.02 and h = 0.08407) at a temperature of 375 K and p of 2.0 atm. Compare your results with the ideal gas law. If possi- ble, use your computer software to determine the molal volume. Otherwise, use any of the numerical methods discussed in Chaps. 5 and 6 to perform the computation. Justify your choice of technique. 8.2 In chemical engineering, plug flow reactors (that is, those in which fluid flows from one end to the other with minimal mixing along the longitudinal axis) are often used to convert reactants into products. It has been determined that the efficiency of the conver- sion can sometimes be improved by recycling a portion of the prod- uct stream so that it returns to the entrance for an additional pass through the reactor (Fig. P8.2). The recycle rate is defined as

volume of fluid returned to entrance R =

volume leaving the system

Suppose that we are processing a chemical A to generate a product B. For the case where A forms B according to an autocatalytic reaction (that is, in which one of the products acts as a catalyst or stimulus for the reaction), it can be shown that an optimal recycle rate must satisfy

where XA+ = the fraction of reactant A that is converted to product B. The optimal recycle rate corresponds to the minimum-sized re- actor needed to attain the desired level of conversion. Use a numer-

FIGURE P8.2 Schematic representation of a plug flow reactor with recycle.

Plug flow reactor

ical method to determine the recycle ratios needed to minimize re- actor size for a fractional conversion of XAf = 0.9. 8.3 In a chemical engineering process, water vapor (H20) is heated to sufficiently high temperatures that a significant portion of the water dissociates, or splits apart, to form oxygen (02) and hydrogen (Hz):

H20 + H2 + f 0 2

If it is assumed that this is the only reaction involved, the mole frac tion x of H 2 0 that dissociates can be represented by

where K = the reaction equilibrium constant and p, = the total pressure of the mixture. Ifp, = 3 atm and K = 0.05, determine the value of x that satisfies Eq. (P8.3). 8.4 The following equation pertains to the concentration of a chemical in a completely mixed reactor:

c = cin(l - e-" "4') + C"e-".04~

If the initial concentration co = 4 and the inflow concentration ci, = 10, compute the time required for c to be 93 percent of c,,. 8.5 A reversible chemical reaction

2 A + B + C

can be characterized by the equilibrium relationship

where the nomenclature c, represents the concentration of con- stituent N. Suppose that we define a variable x as representing the number of moles of C that are produced. Conservation of mass can be used to reformulate the equilibrium relationship as

where the subscript 0 designates the initial concentration of each constituent. If K = 0.015, c , , ~ = 42, ch.0 = 30, and c , , ~ = 4, com- pute x.

Page 102: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PROBLEMS 21 1

8.6 The following chemical reactions take place in a closed system

2 A + B + C

A + D + C

At equilibrium, they can be characterized by

K 2 = ('( ( 'a Cd

where the nomenclature c , represents the concentration of con- stituent N. If xi and x2 are the number of moles of C that are pro- duced due to the first and second reactions, respectively, use an ap- proach similar to that of Prob. 8.5 to reformulate the equilibrium relationships in terms of the initial concentrations of the con- stituents. Then, use the Newton-Raphson method to solve the pair of simultaneous nonlinear equations for x, and x2 if K l = 4 x lo-" KK2 = 3.7 x c,," = 50, ch,o = 20, c , , ~ = 5, and cd.0 = 10. Use a graphical approach to develop your initial guesses. 8.7 The Redlich-Kwong equation of state is given by

where R = the universal gas constant [= 0.518 kJ/(kg K)], T = absolute temperature (K), p = absolute pressure (kPa), and v = the volume of a kg of gas (m3/kg). The parameters a and b are calculated by

wherep, = 4600 kPa and T, = 191 K. As a chemical engineer, you are asked to determine the amount of methane fuel that can be held in a 3-m' tank at a temperature of -40°C with a pressure of 65,000 kPa. Use a root-locating method of your choice to calculate v and then determine the mass of methane contained in the tank. 8.8 The volume V of liquid, in a hollow horizontal cylinder of ra- dius r and length L is related to the depth of the liquid h by

Determine h given r = 2 m, L = 5 m3, and V = 8 m3. Note that if you are using a programming language or software tool that is not rich in trigonometric functions, the arc cosine can be computed with

8.9 The volume V of liquid in a spherical tank of radius r. is related to the depth h of the liquid by

Determine h given r = 1 m and V = 0.5 m3. 8.10 For the spherical tank in Prob. 8.9, it is possible to develop the following two fixed-point formulas:

and

If r = 1 m and V = 0.5 m3, determine whether either of these is sta- ble, and the range of initial guesses for which they are stable.

Civil and Environmental Engineering 8.11 The displacement of a structure is defined by the following equation for a damped oscillation:

y = 8eCkr cos ot

where k = 0.5 and w = 3. (a) Use the graphical method to make an initial estimate of the time required for the displacement to de- crease to 4. (b) Use the Newton-Raphson method to determine the root to E, = 0.01%. (c) Use the secant method to determine the root to E, = 0.01%. 8.12 The secant formula defines the force per unit area, P,A, that causes a maximum stress a , in a column of given slenderness ratio L, r:

P - - - an1

A I + (ec/r2) sec [0.5 J m j ( ~ , / r ) ]

If E = 200,000 kPa, ec;'r2 = 0.2, and a, = 250 kPa, compute P A for L, 'r = 100. Recall that sec x = l/cos x. 8.13 A catenary cable is one that is hung between two points not in the same vertical line. As depicted in Fig. P8.13a, it is subject to no loads other than its own weight. Thus, its weight w (N/m) acts as a uniform load per unit length along the cable. A free-body diagram of a section AB is depicted in Fig. P8.13b, where TA and TB are the tension forces at the end. Based on horizontal and vertical force balances, the following differential equation model of the cable can be derived:

Calculus can be employed to solve this equation for the height y of the cable as a function of distance x,

Page 103: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

212 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

FIGURE P8.13 (a) Forces acting on a sect~on AB of a flexible hanging cable. The load is un~form along the cable (but not uniform per the horizontal distance x ] . (b) A free-body diagram of section AB.

where the hyperbolic cosine can be computed by

cosh x = (eX + e-X)

(a) Use a numerical method to calculate a value for the parameter TA given values for the parameters w = 10 and yo = 5, such that the cable has a height of y = 15 at x = 50.

(b) Determine the location of the minimum height for the case de- scribed in (a).

8.14 Figure P8.14a shows a uniform beam subject to a linearly in- creasing distributed load. The equation for the resulting elastic curve is (see Fig. P8.14h)

Use bisection to determine the point of maximum deflection (that is, the value of x where dy,ldx = 0). Then substitute this value into Eq. (P8.14) to determine the value of the maximum deflection. Use the following parameter values in your computation: L = 450 cm, E = 50,000 k ~ / c m ~ , I = 30,000 cm4, and wo = 1.75 kN/cm. 8.15 In environmental engineering (a specialty area in civil engi- neering), the following equation can be used to compute the oxy- gen level in a river downstream from a sewage discharge:

c = 10 - 20(~-0 2~ - r - O 75" 1 where x is the distance downstream in kilometers. Determine the distance downstream where the oxygen level first falls to a reading of 5. (Hint: It is within 2 krn of the discharge.) Determine you an- swer to a 1 % error. 8.16 The concentration of pollutant bacteria c in a lake decreases according to

Determine the time required for the bacteria concentration to be re- duced to 9 using (a) the graphical method and (b) the Newton- Raphson method. 8.17 In ocean engineering, the equation for a reflected standing wave in a harbor is given by h = 16, t = 12, v = 48:

h = h0 [sin (F) con ($) + e-']

Solve for the lowest positive value of x if h = 0.4ho.

Page 104: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PROBLEMS 213

8.18 You buy a $20,000 piece of equipment for nothing down and $4000 per year for 6 years. What interest rate are you paying? The formula relating present worth P, annual payments A, number of years n, and interest rate i is

8.19 Many fields of engineering require accurate population esti- mates. For example, transportation engineers might find it neces- sary to determine separately the population growth trends of a city and adjacent suburb. The population of the urban area is declining with time according to

while the suburban population is growing, as in

where P ,,,,,,. k,,, P ,,,,,, Po, and k , = en~pirically derived parame- ters. Determine the time and corresponding values of P,,(t) and & ( t ) when the city is 20% larger than the suburban population. The parameter values are P ,,,,,, = 75,000, k , = 005/yr, P ,.,,, = 100,000 people, P ,.,,, = 300,000 people, Po = 5000 people, k , = 0.075Iyr. To obtain your solutions, use (a) graphical, (b) false- position, and (c) modified secant methods.

Electrical Engineering 8.20 Perform the same computation as in Sec. 8.3, but determine the value of L required for the circuit to dissipate to 1 % of its orig- inal value in t = 0.05 s, given R = 280 L2 and C = F. 8.21 An oscillating current in an electric circuit is described by I = 9e-' sin (2 nt), where t is in seconds. Determine all values o f t such that 1 = 3.5. 8.22 The resistivity p of doped silicon is based on the charge q on an electron, the electron density n, and the electron mobility p. The electron density is given in terms of the doping density N and the intrinsic carrier density rz , . The electron mobility is described by the temperature T, the reference temperature To, and the reference mo- bility w ~ . The equations required to compute the resistivity are

where

Determine N , given To = 300 K, T = 1000 K, = 1330 cm2/ (V s), q = 1.6 x C , n, = 6.21 x lo9 cmp3, and a desired p = 6 x 106 V s cm/C. Use (a) bisection and (b) the modified se- cant method.

8.23 A total charge Q is uniformly distributed around a ring- shaped conductor with radius a. A charge q is located at a distance x from the center of the ring (Fig. P8.23). The force exerted on the charge by the ring is given by

where eo = 8.85 x 1op12 c~/(N m2). Find the distance x where the force is 1 N if q and Q are 2 x C for a ring with a radius of 0.8 m. 8.24 Figure PX.24 shows a circuit with a resistor, an inductor, and a capacitor in parallel. Kirchhoff's rules can be used to express the impedance of the system as

where Z = impedance (R) and w = the angular frequency. Find the o that results in an impedance of 100 R using both bisection and false position with initial guesses of 1 and 1000 for the follow- ing parameters: R = 225 '2, C = 0.6 x F, and L = 0.5 H.

Mechanical and Aerospace Engineering 8.25 Repeat the calculations at the end of Sec. 8.4, but determine the speeds for which the maximum deflection is 0.15 m. 8.26 For fluid flow in pipes, friction is described by a dimension- less number, the Fanning friction factor f. The Fanning friction factor is dependent on a number of parameters related to the size of the pipe and the fluid, which can all be represented by another

Page 105: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

214 ENGINEERING APPLICATIONS: ROOTS OF EQUATIONS

dimensionless quantity, the Reynolds number Re. A formula that predicts f given Re is the von Karman equation,

1

47 - = 4 log,, ( n e f i ) - 0.4

Typical values for the Reynolds number for turbulent flow are 10,000 to 500,000 and for the Fanning friction factor are 0.001 to 0.01. Develop a subprogram that solves forf given a user-supplied value between 2500 and 1,000,000. 8.27 Real mechanical systems may involve the deflection of non- linear springs. In Fig. P8.27, a block of mass m is released a dis- tance h above a nonlinear spring. The resistance force F of the spring is given by

F = -(kid + k2d3I2)

Conservation of energy can be used to show that

Solve ford, given the following parameter values: kl = 40,000 g/s2, kZ = 40 g/(s2 m5), m = 95 g, g = 9.8 m/s2, and h = 0.43 m. 8.28 Mechanical engineers, as well as most other engineers, use thermodynamics extensively in their work. The following polyno- mial can be used to relate the zero-pressure specific heat of dry air, c, kJ/(kg K), to temperature:

c, = 0.99403 + 1.671 x ~ o - ~ T + 9.7215 x I O - ~ T '

-9.5838 x 1op"T3 + 1.9520 x 1 0 - l ~ ~ ~

Determine the temperature that corresponds to a specific heat of 1.2 kJ/(kg K ) . 8.29 Aerospace engineers sometimes compute the trajectories of projectiles like rockets. A related problem deals with the trajectory

of a thrown ball. The trajectory of a ball thrown by a right fielder is defined by the (x, y) coordinates, as displayed in Fig. P8.29. The trajectory can be modeled as

Find the appropriate initial angle & if uo = 20 m/s and the distance to second base is 40 m. Note that the throw leaves the right fielder's hand at an elevation of 1.8 m and the second baseman receives it at 1 m. 8.30 The upward velocity of a rocket can be computed by the fol- lowing formula:

where v = upward velocity, u = the velocity at which fuel is expelled relative to the rocket, mu = the initial mass of the rocket at time t = 0, q = the fuel consumption rate, and g = the down- ward acceleration of gravity (assumed constant = 9.8 m/s2). If u = 2200 m/s, mo = 160,000 kg, and q = 2680 kg/s, compute the time at which v = 1000 m/s. (Hint: t is somewhere between 10 and 50 s.) Determine your result so that it is within 1% of the true value. Check your answer. 8.31 In Sec. 8.4, the phase angle 4 between the forced vibration caused by the rough road and the motion of the car is given by

As a mechanical engineer, you would like to know if there are cases where 4 = wj2 + 1. Use the other parameters from the section to set up the equation as a roots problem and solve for w.

Page 106: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

LOGUE: PART TWO

PT2.4 TRADE-OFFS

Table PT2.3 provides a summary of the trade-offs involved in solving for roots of algebraic and transcendental equations. Although graphical methods are time-consuming, they pro- vide insight into the behavior of the function and are useful in identifying initial guesses and potential problems such as multiple roots. Therefore, if time permits, a quick sketch (or better yet, a computerized graph) can yield valuable information regarding the behavior of the function.

The numerical methods themselves are divided into two general categories: bracketing and open methods. The former requires two initial guesses that are on either side of a root.

TABLE PT2.3 Comparison of thecharacteristicsof alternative methods for finding roots of algebraic and transcendental equa- tions. The comparisons are based on general experience and do not account for the behavior of specific functions.

p P w - - m - - = - = -

initial Convergence Breadth of Programming Method Guesses Rate Stabiliv Accuracy Appiication EFfort Comments

Direct

Graphical

Modified Newton

Rauhson

Secant

Modified secant Muller Bairstow

2 Slow 2 Medium

1 Slow

1 Fast

1 Fast for rnulthpie roots;

medium for single

2 Med~um to fast

1 Medum to fast 2 Medium to fast 2 Fast

Always Always

Possibly divergent

Possibly divergent

Possibly divergent

Possibly divergent

Possibly divergent

Possibly divergent Possibly divergent

-

Poor

Good Good

Good

Good

Good

Good

Good Good

Good

limited

Real roots

Real roots

Real roots

General

General

General

General

General Polynomials

Polynomials

-

Easy Easy

Easy

Easy

Easy

Easy

Easy Moderate

Moderate

May take more tme than the

nurner~cal

method

Requires

Requires evauation of

i"[x] and f'[x) ln~tia guesses do not have to bracket the

root

Page 107: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

216 EPILOGUE: PART TWO

This "bracketing" is maintained as the solution proceeds, and thus, these techniques are al- ways convergent. However, a price is paid for this property in that the rate of convergence is relatively slow.

Open techniques differ from bracketing methods in that they use information at a sin- gle point (or two values that need not bracket the root to extrapolate to a new root estimate). This property is a double-edged sword. Although it leads to quicker convergence, it also al- lows the possibility that the solution may diverge. In general, the convergence of open techniques is partially dependent on the quality of the initial guess and the nature of the function. The closer the guess is to the true root, the more likely the methods will converge.

Of the open techniques, the standard Newton-Raphson method is often used because of its property of quadratic convergence. However, its major shortcoming is that it requires the derivative of the function be obtained analytically. For some functions this is impractical. In these cases, the secant method, which employs a finite-difference representation of the deriv- ative, provides a viable alternative. Because of the finite-difference approximation, the rate of convergence of the secant method is initially slower than for the Newton-Raphson method. However, as the root estimate is refined, the difference approximation becomes a better rep- resentation of the true derivative, and convergence accelerates rapidly. The modified New- ton-Raphson technique can be used to attain rapid convergence for multiple roots. However, this technique requires an analytical expression for both the first and second derivative.

All the numerical methods are easy to program on computers and require minimal time to determine a single root. On this basis, you might conclude that simple methods such as bisection would be good enough for practical purposes. This would be true if you were ex- clusively interested in determining the root of an equation once. However, there are many cases in engineering where numerous root locations are required and where speed becomes important. For these cases, slow methods are very time-consuming and, hence, costly. On the other hand, the fast open methods may diverge, and the accompanying delays can also be costly. Some computer algorithms attempt to capitalize on the strong points of both classes of techniques by initially employing a bracketing method to approach the root, then switching to an open method to rapidly refine the estimate. Whether a single approach or a combination is used, the trade-offs between convergence and speed are at the heart of the choice of a root-location technique.

PT2,5 IMPORTANT RELATIONSHIPS AND FORMULAS

Table PT2.4 summarizes important information that was presented in Part Two. This table can be consulted to quickly access important relationships and formulas.

PT2.6 ADVANCED METHODS AND ADDITIONAL REFERENCES

The methods in this text have focused on determining a single real root of an algebraic or transcendental equation based on foreknowledge of its approximate location. In addition, we have also described methods expressly designed to determine both the real and complex roots of polynomials. Additional references on the subject are Ralston and Rabinowitz (1978) and Carnahan, Luther, and Wilkes (1969).

In addition to Miiller's and Bairstow's methods, several techniques are available to determine all the roots of polynomials. In particular, the quotient difference (QD) algo- rithm (Henrici, 1964, and Gerald and Wheatley, 1984) determines all roots without initial

Page 108: Chapra & Canale 1998, Numerical methods for engineersmoodle.fct.unl.pt/.../0/...Chapra_Canale_1998_Roots_of_Equations.pdf · 116 ROOTS OF EQUATIONS open methods do not work. Formulas

PT2.6 ADVANCED METHODS AND ADDITIONAL REFERENCES 217

TABLE PT2, --- Graphical Errors and

Method Formulation Interpretation Stopping Criteria

Bracketng methods

False Post~on

If f[xr)f[x,) < 0, x,, = X:

f(x,]f(x,) > 0, x, = x,

Newton-Raphson

Secant f I x I x . ' - x,i

XI+ 1 = X - -- fix, 1 1 - fix)

Stoppng crteron

IXl'-" - x:lol100%

Slopping crterion:

Stopplng cr~ter~on

-l100% _c

Error. €,+I = o ( E , ~ )

Stoppng criter~on-

x,+ 1

guesses. Ralston and Rabinowitz (1978) and Carnahan, Luther, and Wilkes (1969) contain discussions of this method as well as of other techniques for locating roots of polynomials. As discussed in the text, the Jenkins-Traub and Laperre's methods are widely employed.

In summary, the foregoing is intended to provide you with avenues for deeper explo- ration of the subject. Additionally, all the above references provide descriptions of the basic techniques covered in Part Two. We urge you to consult these alternative sources to broad- en your understanding of numerical methods for root location.'

' ~ o o k s are referenced only by author here, a complete bibliography will be found at the back of this text.