Читать книгу Solutions Manual to Accompany An Introduction to Numerical Methods and Analysis - James F. Epperson - Страница 12

2.2 DIFFERENCE APPROXIMATIONS TO THE DERIVATIVE Exercises:

Оглавление

1 Use the methods of this section to show thatSolution: We have, for any , thatTherefore, taking ,

2 Compute, by hand, approximations to for each of the following functions, using and each of the derivative approximations contained in (2.1) and (2.5).;;;;.

3 Write a computer program which uses the same derivative approximations as in the previous problem to approximate the first derivative at for each of the following functions, using . Verify that the predicted theoretical accuracy is obtained.;;;;.Solution: I wrote a simple FORTRAN program to do this for the single case of (b). The results I got, using double precision, are in Table 2.1.Note that the error goes down by a factor of 2 for , and a factor of 4 for , thus confirming the theoretical accuracy.

4 Use the approximations from this section to fill in approximations to the missing values in Table 2.2 (Table 2.4 in the text).Table 2.1 Derivative Approximations.ErrorRatioErrorRatio40.442628880.0000.505108550.00080.470046581.9150.501295953.942160.484700161.9580.500325143.986320.492268861.9790.500081363.996640.496114091.9900.500020343.9991280.498051961.9950.500005094.0002560.499024711.9970.500001274.0005120.499512041.9990.500000324.00010240.499755941.9990.500000084.000Table 2.2 Table for Problem 4.1.001.00000000001.100.95135076991.200.91816874241.300.89747069631.400.88726381751.500.88622692551.600.89351534931.700.90863873291.800.93138377101.900.96176583192.001.0000000000

5 Use the error estimate (2.5) for the centered difference approximation to the first derivative to prove that this approximation will be exact for any quadratic polynomial.Solution: We have thatfor some between and . If is a quadratic, then it has the general formfor given constants , , and . But the third derivative of this kind of function will always be identically zero.

6 Find coefficients , , and so that;.Hint: Use Taylor's theorem.Solution: Write out Taylor expansions for and , thus:andMultiply the first one by 4, and subtract the two of them, to getsolve this for to getso that , , and . A similar approach works for (b), with , , and .

7 Fill in the data from Problem 4 using methods that are at each point. Hint: See the previous problem.

8 Use Taylor's Theorem to show that the approximationis .Solution: We haveandTherefore,andHence,so that, solving for , we get the desired result.

9 Use the derivative approximation from Problem 8 to approximate for the same functions as in Problem 3. Verify that the expected rate of decrease is observed for the error.

10 Use the derivative approximation from Problem 8 to fill in as much as possible of the table in Problem 4.Solution: Because this formula uses more points that are farther from the point of interest than did the previous formulas, we cannot do as much of the table as before. We get:

11 Let . Use the derivative approximation from Problem 8 to approximate using . Try to take small enough that the rounding error effect begins to dominate the mathematical error. For what value of does this begin to occur? (You may have to restrict yourself to working in single precision.)

12 Use Taylor expansions for to derive an accurate approximation to using and . Provide all the details of the error estimate. Hint: Go out as far as the fourth derivative term, and then add the two expansions.Solution: We haveandso thatThus, solving for the second derivative yields

13 Let and be given, where , for . Let be some smooth function. Use Taylor expansions for and in terms of and its derivatives at in order to construct an approximation to that depends on , , and , and which is accurate. Check your work by verifying that for you get the same results as in the text.Solution: We write the two Taylor expansionsandIf we simply subtract these, the second derivative terms will not cancel out (because ), so we have to multiply the first expansion by and the second one by to getandNow subtract to getSolve for to getBecause we assumed , there is substantial simplification that we can do to getwhich is sufficient to establish the estimate for the error.

14 Write a computer program to test the approximation to the second derivative from Problem 12 by applying it to estimate for each of the following functions, using . Verify that the predicted theoretical accuracy is obtained.;;;.

15 Define the following function:Compute values of over the range using two methods:Using the centered‐difference formula from (2.5);Using ordinary calculus to find the formula for .Comment.Solution: The function is designed to make direct computation of a difficult task for the average undergraduate student, thus highlighting that there are times when being able to approximate the derivative as was done in this section might be preferable to doing the exact computation.

16 Let , and consider the problem of approximating , as in the text. Let be the difference approximation in (2.1). Using the appropriate values in Table 2.1, compute the new approximationsand compare these values to the exact derivative value. Are they more or less accurate that the corresponding values of ? Try to deduce, from your calculations, how the error depends on .Solution: For the sake of completeness we have reproduced the table from the text. Using those values we can computeThe error appears to be going down by a factor of 4 as is cut in half.Table 2.3 (Table 2.1 in text.) Example of derivative approximation to at .23.5268144612.83296775843.0882444382.74668550582.8954811102.725366592162.8050270082.720052719322.7611999512.718723297642.7396392822.7183914181282.7289428712.718307495

17 Repeat the above idea for , (but this time you will have to compute the original values).

18 By keeping more terms in the Taylor expansion for , show that the error in the derivative approximation (2.1) can be written as(2.1) Use this to construct a derivative approximation involving , , and that is accurate. Hint: Use (2.6) to write down the error in the approximationand combine the two error expansions so that the terms that are are eliminated.Solution: We haveso that we can getor, equivalently,Therefore,Thus,so that

19 Apply the method derived above to the list of functions in Problem 3, and confirm that the method is as accurate in practice as is claimed.

20 Let , and consider the problem of approximating , as in the text. Let be the difference approximation in (2.5). Using the appropriate values in Table 2.3, compute the new approximationsand compare these values to the exact derivative value. Are they more or less accurate that the corresponding values of ? Try to deduce, from your calculations, how the error depends on .Solution: The values arefrom which we get thatThese values are, initially, much more accurate than , although rounding error begins to corrupt the computation. It can be shown that this approximation is .

21 Repeat the above idea for , (but this time you will have to compute the original values).

22 The same ideas as in Problem 18 can be applied to the centered difference approximation (2.5). Show that in this case the error satisfies(2.2) Use this to construct a derivative approximation involving , and that is accurate.Solution: Sinceandwe have thator,Therefore,so thatWe can manipulate with the left side to get thatso that finally we haveThis is simply an alternate derivation of the method from Exercise 8.

23 Apply the method derived above to the list of functions in Problem 3, and confirm that the method is as accurate in practice as is claimed.

24 What if the grid spacings are not equal? Suppose that we haveandCan you construct a weighted average of one‐sided approximations to that is second‐order accurate? (You will need to keep more terms in the Taylor expansion than we did in the text.)

Solutions Manual to Accompany An Introduction to Numerical Methods and Analysis

Подняться наверх