• Tidak ada hasil yang ditemukan

ROOTS OF EQUATIONS

6.6 SYSTEMS OF NONLINEAR EQUATIONS

6.6.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 variable—that is, the root (Fig. 6.5). This estimate was based on a first-order Taylor series expansion (recall Box 6.2),

f(xi+1)= f(xi)+(xi+1xi)f"(xi) (6.20)

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

xi+1=xif(xi)

f"(xi) (6.21)

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

ui+1 =ui+(xi+1xi)∂ui

x +(yi+1yi)∂ui

y (6.22a)

and

vi+1 =vi+(xi+1xi)∂vi

x +(yi+1yi)∂vi

y (6.22b)

Just as for the single-equation version, the root estimate corresponds to the values ofxandy, whereui+1andvi+1equal zero. For this situation, Eq. (6.22) can be rearranged to give

ui

xxi+1+∂ui

y yi+1=−ui+xiui

x +yiui

y (6.23a)

∂vi

xxi+1+∂vi

yyi+1=−vi+xi∂vi

x +yi∂vi

y (6.23b)

Because all values subscripted with i’s are known (they correspond to the latest guess or approximation), the only unknowns are xi+1and yi+1. Thus, Eq. (6.23) is a set of two linear equations with two unknowns [compare with Eq. (6.18)]. Consequently, algebraic manip- ulations (for example, Cramer’s rule) can be employed to solve for

xi+1 =xiui∂vi

y −viui

y

ui

x

∂vi

y −∂ui

y

∂vi

x

(6.24a)

yi+1 =yi− viui

xui∂vi

x

ui

x

∂vi

y −∂ui

y

∂vi

x

(6.24b)

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

Equation (6.24) 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.12 Newton-Raphson for a Nonlinear System

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

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

u0

x =2x+y=2(1.5)+3.5=6.5 ∂u0

y =x=1.5

PROBLEMS 171

∂v0

x =3y2=3(3.5)2=36.75 ∂v0

y =1+6x y=1+6(1.5)(3.5)=32.5 Thus, the determinant of the Jacobian for the first iteration is

6.5(32.5)−1.5(36.75)=156.125

The values of the functions can be evaluated at the initial guesses as u0=(1.5)2+1.5(3.5)−10=−2.5

v0=3.5+3(1.5)(3.5)2−57=1.625

These values can be substituted into Eq. (6.24) to give x=1.5−−2.5(32.5)−1.625(1.5)

156.125 =2.03603

y=3.5−1.625(6.5)−(−2.5)(36.75)

156.125 =2.84388

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 nsimulta- 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.

6.1 Use simple fixed-point iteration to locate the root of f(x)=2 sin(x)x

Use an initial guess of x0=0.5 and iterate until εa0.001%. Ver- ify that the process is linearly convergent as described in Box 6.1.

6.2 Determine the highest real root of f(x)=2x311.7x2+17.7x5 (a) Graphically.

(b) Fixed-point iteration method (three iterations, x0=3). Note:

Make certain that you develop a solution that converges on the root.

(c) Newton-Raphson method (three iterations, x0=3).

(d) Secant method (three iterations, x1=3, x0=4).

(e) Modified secant method (three iterations, x0=3, δ=0.01).

Compute the approximate percent relative errors for your solutions.

6.3 Use (a) fixed-point iteration and (b) the Newton-Raphson method to determine a root of f(x)=x2+1.8x+2.5 using x0=5. Perform the computation until εais less than εs=0.05%.

Also perform an error check of your final answer.

6.4 Determine the real roots of f(x)=1+5.5x4x2+0.5x3: (a) graphically and (b) using the Newton-Raphson method to within εs=0.01%.

6.5 Employ the Newton-Raphson method to determine a real root for f(x)=2+6x4x2+0.5x3using initial guesses of(a)4.2 and

PROBLEMS

(b)4.43. Discuss and use graphical and analytical methods to explain any peculiarities in your results.

6.6 Determine the lowest real root of f(x)=–1221x+ 18x22.4x3: (a)graphically and (b)using the secant method to a value of εscorresponding to three significant figures.

6.7 Locate the first positive root of f(x)=sinx+cos(1+x2)1

where xis in radians. Use four iterations of the secant method with initial guesses of (a)xi–1=1.0 and xi=3.0; (b) xi–1=1.5 and xi=2.5, and (c) xi–1=1.5 and xi=2.25 to locate the root.

(d)Use the graphical method to explain your results.

6.8 Determine the real root of x3.5=80, with the modified secant method to within εs=0.1% using an initial guess of x0=3.5 and δ=0.01.

6.9 Determine the highest real root of f(x)=0.95x35.9x2+ 10.9x6:

(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 xi=3.5).

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

6.10 Determine the lowest positive root of f(x)=8 sin(x)ex1:

(a) Graphically.

(b) Using the Newton-Raphson method (three iterations, xi=0.3).

(c) Using the secant method (five iterations, xi–1=0.5 and xi=0.4).

(d) Using the modified secant method (three iterations, xi=0.3, δ=0.01).

6.11 Use the Newton-Raphson method to find the root of f(x)=e0.5x(4x)2

Employ initial guesses of (a)2, (b) 6, and (c) 8. Explain your results.

6.12 Given

f(x)=2x61.5x4+10x+2

Use a root location technique to determine the maximum of this function. Perform iterations until the approximate relative error falls below 5%. If you use a bracketing method, use initial guesses of xl=0 and xu=1. If you use the Newton-Raphson or the modified secant method, use an initial guess of xi=1. If you use the secant method, use initial guesses of xi1=0 and xi=1. Assuming that convergence is not an issue, choose the technique that is best suited to this problem. Justify your choice.

6.13 You must determine the root of the following easily differen- tiable function,

e0.5x=55x

Pick the best numerical technique, justify your choice and then use that technique to determine the root. Note that it is known that for positive initial guesses, all techniques except fixed-point iteration will eventually converge. Perform iterations until the approximate relative error falls below 2%. If you use a bracketing method, use initial guesses of xl=0 and xu=2. If you use the Newton- Raphson or the modified secant method, use an initial guess of xi=0.7. If you use the secant method, use initial guesses of xi1=0 and xi=2.

6.14 The function x32x24x+8 has a double root at x=2.

Use (a)the standard Newton-Raphson [Eq. (6.6)], (b)the modified Newton-Raphson [Eq. (6.12)], and (c) the modified Newton- Raphson [Eq. (6.16)] to solve for the root at x=2. Compare and discuss the rate of convergence using an initial guess of x0=1.2.

6.15 Determine the roots of the following simultaneous nonlinear equations using (a) fixed-point iteration and (b) the Newton- Raphson method:

y=x2+x+0.75 y+5x y=x2

Employ initial guesses of x=y=1.2 and discuss the results.

6.16 Determine the roots of the simultaneous nonlinear equations (x4)2+(y4)2=5

x2+y2=16

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

6.17 Repeat Prob. 6.16 except determine the positive root of y=x2+1

y=2 cosx

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

Vdc

dt =WQckVc

Given the parameter values V =1×106m3, Q=1×105m3/yr, W =1×106 g/yr, and k=0.25 m0.5/g0.5/yr, use the modified secant method to solve for the steady-state concentration. Employ an initial guess of c=4 g/m3and δ=0.5. Perform three iterations and determine the percent relative error after the third iteration.

6.19 For Prob. 6.18, the root can be located with fixed-point iteration as

c=

'WQc kV

(2

or as

c=WkVc Q

PROBLEMS 173 Only one will converge for initial guesses of 2<c<6. Select the

correct one and demonstrate why it will always work.

6.20 Develop a user-friendly program 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.21 Develop a user-friendly program for the secant method based on Fig. 6.4 and Sec. 6.3.2. Test it by duplicating the computation from Example 6.6.

6.22 Develop a user-friendly program 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.23 Develop a user-friendly program for Brent’s root location method based on Fig. 6.12. Test it by solving Prob. 6.6.

6.24 Develop a user-friendly program for the two-equation Newton- Raphson method based on Sec. 6.6.2. Test it by solving Example 6.11.

6.25 Use the program you developed in Prob. 6.24 to solve Probs.

6.15 and 6.16 to within a tolerance of εs=0.01%.

6.26 The “divide and average” method, an old-time method for approximating the square root of any positive number a, can be for- mulated as

x=x+a/x 2

Prove that this is equivalent to the Newton-Raphson algorithm.

6.27 (a) Apply the Newton-Raphson method to the function f(x)=tanh(x29)to evaluate its known real root at x=3. Use an initial guess of x0=3.2 and take a minimum of four iterations.

(b)Did the method exhibit convergence onto its real root? Sketch the plot with the results for each iteration shown.

6.28 The polynomial f(x)=0.0074x40.284x3+3.355x2 12.183x+5 has a real root between 15 and 20. Apply the Newton- Raphson method to this function using an initial guess of x0=16.15. Explain your results.

6.29 Use the secant method on the circle function (x+1)2+ (y2)2=16 to find a positive real root. Set your initial guess to xi=3 and xi–1=0.5. Approach the solution from the first and fourth quadrants. When solving for f(x)in the fourth quadrant, be sure to take the negative value of the square root. Why does your solution diverge?

6.30 You are designing a spherical tank (Fig. P6.30) to hold water for a small village in a developing country. The volume of liquid it can hold can be computed as

V =πh2[3Rh]

3

where V =volume (m3), h=depth of water in tank (m), and R= the tank radius (m).

Figure P6.30

If R=3 m, what depth must the tank be filled to so that it holds 30 m3? Use three iterations of the Newton-Raphson method to determine your answer. Determine the approximate relative error after each iteration. Note that an initial guess of R will always converge.

6.31The Manning equation can be written for a rectangular open channel as

Q=

S(B H)5/3 n(B+2H)2/3

where Q=flow [m3/s], S=slope [m/m], H=depth [m], and n= the Manning roughness coefficient. Develop a fixed-point iteration scheme to solve this equation for H given Q=5, S=0.0002, B=20, and n=0.03. Prove that your scheme converges for all initial guesses greater than or equal to zero.

V h R

7

C H A P T E R 7

174

Roots of Polynomials

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

fn(x)=a0+a1x+a2x2+ · · · +anxn (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 nreal or complex roots. It should be noted that these roots will not necessarily be distinct.

2. If nis odd, there is at least one real root.

3. If complex roots exist, they exist in conjugate pairs (that is, λ+µiand λ−µi), where i=1.

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.