Shampine, Allen, Pruess - Fundamentals of Numerical Computing (523185), страница 51
Текст из файла (страница 51)
while= -10800.Because the relative error in s is related to therelative error in c by a factor that is the square ofthat arising for absolute errors, conclusions aboutthe usefulness of the scheme for the various θ areessentially the same as for absolute errors.1.9 In four-digit decimal chopped(0.8717 + 0.8719)/2 = 1.743/2 = 0.8715, infour-digit decimal rounded the midpoint is1.744/2 = 0.8720; neither of these is even insidethe desired interval.
A good alternative is tocompute h = b - a and then the midpoint isa + h/2. For this example, we get h = 0.0002000and the midpoint is 0.8718, the exact value.1.17 Usesin nx = sin(1 + n- 1)x= sin x cos(n - 1)x + cos x sin(n - 1)xandcos nx = cos(1 + n - 1)x= cos x cos(n - 1)x - sin x sin(n - 1)x.Then255Next256ANSWERS TO SELECTED EXERCISES2.5 (a)andHence,(c)Exercise Set 2.1 (Page 42)2.1 (a) nonsingular; x1 = -1, x2 = 1/2, x3 = 3(c) singular (but consistent)(e) singular (but consistent)2.3 RE = 223, RA = 177, Ch = 56.7607,Dh = -56.7607, Cv = 29.3397, Dv = -252.340,Bv = -147.660, Bh, = 56.7607Exercise Set 2.2 (Page 48)2.4 (a) x1 = 9, x2 = -36, x3 = 30(c)so x3 = 220, x2 = -230, and x1 = -37.(e) x1 = 500/9, x2 = -2500/9, x3 = 2300/9Exercise Set 2.3 (Page 61)2.7 r = (0.000772, 0.000350) ands = (0.000001, -0.000003), so the more accurateanswer has the larger residual.2.9 (a) The uncertainty in each xi is ± ||x| times theright side of the Condition Inequality, that is,±0.0075386.Exercise Set 2.4 (Page 63)2.11 Factor/Solve produces the exact answersR1 = 51.67, R2 = 26.66, and R3 = 31.67 withminor perturbations at the roundoff level.
Thevalue of COND is 1.50.2.13 COND = 1.438E+42.15 COND = 112.9; for V = 50 we havev = (35, 26, 20, 15.5, 11, 5) with minorperturbations at the roundoff level.ANSWERS TO SELECTED EXERCISES2.17 (a) COND = 6.44For exact data the answers are very reliable;however, if the entries in A are known only to±0.0005 and those in B to ±0.005, then from thecondition number inequalitywhere Xk is the kth column of X. For example,when k = 1 we have ||∆Xk||/||Xk|| < 0.018. Inparticular, x21 is probably incorrect; it certainlymakes no sense physically.(c) The analog of (2.27) here isFor this problem, α23 is much smaller than theother entries, but the rest are about the same.
Thex3 values are most sensitive to changes in b sincethe third row of A-1 contains the largest entries.When b11 is changed to 1.43, that is,∆ b11 = -0.01, then x21 = 0.016; hence,∆ x21 = 0.03 α21 ∆b11 as predicted by the theory.257Exercise Set 3.1 (Page 89)3.1 No, coefficients of higher degree terms may bezero. For example, for the dataxi = i, yi = 2i, 1 < i < 4, the interpolatingpolynomial is clearly P4(x) = 2x which has degreeonly 1.3.3interpolates (1,2), (2,4), and (3,c) for any c. Theformula for P3(x) simplifies toso that we get exact degree 2 as long as c 6. Thisdoes not contradict Theorem 3.1 since the degreeof P2 is too large for that theorem.3.5 The standard algorithm requires 1 + 2 + ··· + N - 1multiplications for a total of N( N - 1)/2.
Thenested version requires only N - 1.3.7Exercise Set 2.5 (Page 72)2.19 There are n - 1 divisions for the elimination and nfor each b; there are n - 1 multiplications for theelimination and 2n - 2 for each b. Hence, there is atotal of (m + 1)n - 1 divisions and (2m + l)(n - 1)multiplications. The number ofadditions/subtractions equals the number ofmultiplications.Miscellaneous Exercises for Chapter 2 (Page79)(0.5500E-5, -0.l653E-3, -0.3717E-5,-0.4737E-4, 0.3714E-4, -0.1212E-3,0.6434E-4, 0.6362E-4) and COND = 18.01.Then = (-0.6190, -0.9217E-l, 0.1202E-1,0.3714, 0.2720, -0.7209E-2, -0.1325, -0.4654,0.1656, -0.1421).2.23 (a) det A = 1,500,000Near the ends of the interpolating points w9(x) islarge in magnitude, for example,-w9(0) = w9(10) = 362,880.
In the middle, forexample, w(5.5) = 193.80, it is smaller.3.9 H(xn) = a = fn, H´(xn) = b = f´n,H(xn+l = a + bh + ch2+ dh3 =fn + hf´n + [3(fn+1 - fn) - 2hf´n - hf´n+1] + [hf´n +hf´n+1 - 2(fn+1 - fn)] = fn+l. Similarly,H´(xn+l) = f´n+1.2.21Exercise Set 3.2 (Page 93)3.11 The errors on [-5,5] are diverging, but they appearto be converging in [- 1,1]. These data came froma sample of 1001 points.258ANSWERS TO SELECTED EXERCISESX33753625387541254375462548753.13f(x)0.4000.4490.7690.7500.3150.1440.252S(x)0.4470.4240.7410.7410.3160.1370.2623.25Error increases as N does.Exercise Set 3.3 (Page 98)3.15 (a) P4(x) =f63200800200010000(a)SA(f)0.0700.0700.3590.3400.9350.9842.8702.79653.478 54.761(b)S0.0700.3430.9592.83554.343The results from (b) are better than those from (a)but neither is especially accurate (particularly forlarge f ) .3.27 Using all the data but those at{21, 22.6, 22.8, 23.0, 23.2, 23.4} produces an S(x)for whichHenceExercises for Section 3.5 (Page 115)3.17Henceas before.3.21 For S´´(x1) = f´´(x1) use c1 = f´´(x1); forS´´(xN) = f”(xN) use cN = f´´(xN).3.23 The results for S(x) are the same (to the displayeddigits) for the three different sets of {xi}.x21.022.622.823.023.223.4Exact503550565590860944S(x)500548570570767966This is good for small x, but deteriorateseventually.
For this choice of interpolating pointsthere are 10 sign changes in the {ci} sequenceindicating 10 inflection points, not 1. Hence, theremust be a lot of undesired oscillation; however, agraph of S(x) would show that, for the most part,the amplitudes of the oscillations are small enoughto not be visible.3.31 S´ = 0 in [xn,xn+I] if and only ifbn + 2c n( z - xn) + 3d n( z - xn)2 = 0 forxn < z < xn+1.
Using the quadratic formula thisreduces to the statement in the text. Checkingbnbn+1 < 0 will not detect all zeros of S´, since S´ANSWERS TO SELECTED EXERCISES259(a piecewise quadratic) may have two zeros in aparticular [x n ,x n +l] and consequentlyS´(xn)S´(xn+l) > 0.3.33 For the data used in Exercise 3.15, the resultingS(x) had a local maximum at (4001.3, 0.8360), andlocal minima at (3514.9, 0.3811) and(4602.5, 0.1353).3.35 For the choice of the 12 data points inExercise 3.20, there was one critical point atre = 5.5544 for which S(re) = -12.036; therewere two inflection points at (6.199, -8.979) and(9.685, -0.6798).
The second inflection point isspurious.Exercises for Section 3.6 (Page 127)3.37 The four coefficients are4.5 (a) There are many possible brackets; here π/2 andπ were used.(c) x3 = 1.928478 and x4 = 1.897313(e) B = 1.8954944.7 Let ε = max(ε0 ,ε 1) < 1. Then εi < εδi, whereFor i = 0, δ0 = 1, so ε0 = ε. Assume thatε n-1 < εn-1 ; thena = f11b = (f 2 1 - f 1 1 )/(x2 - x1)But, after some algebra,c = (f 1 2 - f 1 1)/( y2 - y1)d = (f 1 1 + f 2 2 - f 1 2 - f 2 l )/[(x2 - x1)(y 2 - y 1).Miscellaneous Exercises for Chapter 3 (Page132)3.39 {ti} = {0.00, 1.54, 2.81, 3.65, 4.49, 5.23, 5.78,6.13, 6.46, 6.76, 7.00}.
The graph is a spiral in thexy plane.hence εn < εδn, which, by induction, gives thedesired result.Exercise Set 4.2 (Page 152)4.9 (a) One step of the bisection method reduces thewidth of a bracket by a factor of 2, so n stepsreduce the width by 2N. To get from a width of1010 to one of 10-5 then requiresExercise Set 4.1 (Page 149)4.1 If a given F(x) has residual ε at x = r, then thescaled function f(x) = MF(x) has residual Mε atx = r. Hence, a small residual (ε) can be scaled upby a large M while a large residual can be scaleddown by a tiny M; consequently, a single residualtells us very little about accuracy.4.3 (a) The next bracket is [0.5, 1.0], the second is[0.75, 1.0], and the third is [0.75, 0.875].(c) Newton’s method:or N > 15 log 10 / log 2 = 49.8 50.
Technically,this is the number of midpoint evaluations required;you may want to add two more to get the functionvalues at the endpoints of the initial bracket.(b) The worst case for Zero is four wasted secantiterations for every three bisections. Hence260ANSWERS TO SELECTED EXERCISESExercise Set 4.3 (Page 155)There is also an answer (0.2114, -0.4293, 0.0623).4.10 (a) The output B = 0.7853982, Flag = 0, Residual= -2.1E - 11, and there were 7 calls to the ffunction. There was just one root in [0,1] whichZero found quickly and accurately.(d) The output B = 0.8000003, Flag = 0, Residual= 5.3E - 46, and there were 44 calls to the ffunction.
The high multiplicity root isill-conditioned, yet, with this form off, Zero wasable to compute it accurately after many functionevaluations. The small residual is in accord withthe flatness of the graph at the root.(h) There is no root in the input interval [0, 1]; Zerocorrectly reported the lack of a bracket through theFlag = -2 value.4.11 C = 633.162 and T = 353.8784.13 The three smallest positive roots are 1.30654,3.67319, and 6.58462.4.15 There are two roots: one at T = 456.9975, theother at T = 12,733.77 is physically dubious.4.17 With f(k) = ω0 ln(1 + k)/(1 - k) - 2k, it is easilyseen that f(-k) = -f(k), f(0) = 0, f(1-) =and f´´(k) > 0 on [0,l), so the mathematicalconclusions follow. The three k values are 0.99933,0.95750, and 0.77552.4.19 E = 1.1903E- 11Miscellaneous Exercises for Chapter 4 (Page167)4.27x0.10.20.30.40.5t0.6565781.2360001.9184482.6941803.5565554.31 (a) The expression for a0 follows from a0 = P(0)and the factorization of P(x).