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.)
2.3 APPLICATION: EULER'S METHOD FOR INITIAL VALUE PROBLEMS
Exercises:
1 Use Euler's method with to compute approximate solution values for the initial value problemYou should get (be sure your calculator is set in radians).Solution:
2 Repeat the above with . What value do you now get for ?
3 Repeat the above with . What value do you now get for ?Solution:
4 Use Euler's method with to compute approximate solution values forWhat approximate value do you get for ?
5 Repeat the above with . What value do you now get for ?Solution: We have the computationwhere , , and . Hence
6 Repeat the above with . What value do you now get for ?
7 Use Euler's method with to compute approximate solution values over the interval for the initial value problemwhich has exact solution . Plot your approximate solution as a function of , and plot the error as a function of .Solution: The plots are given in Figures 2.1 and 2.2.
8 Repeat the above for the equationwhich has exact solution .
9 Repeat the above for the equationwhich has exact solution .Solution: The plots are given in Figures 2.3 and 2.4.Figure 2.1 Exact solution for Exercise 2.3.7.Figure 2.2 Error plot for Exercise 2.3.7.Figure 2.3 Exact solution for Exercise 2.3.9.Figure 2.4 Error plot for Exercise 2.3.9.
10 Use Euler's method to compute approximate solutions to each of the initial value problems below, using . Compute the maximum error over the interval for each value of . Plot your approximate solutions for the case. Hint: Verify that your code works by using it to reproduce the results given for the examples in the text., ; ;, ; ;, ; .
11 Consider the approximate values in Tables 2.5 and 2.6 in the text. Let denote the approximate values for , and denote the approximate values for . Note thatandthus and are both approximations to the same value. Compute the set of new approximationsand compare these to the corresponding exact solution values. Are they better or worse as an approximation?Solution: Table 2.4 shows the new solution and the error, which is much smaller than that obtained using Euler's method directly.Table 2.4 Solution values for Exercise 2.3.11.0.00000.1250.2500.3750.5000.6250.7500.8751.000
12 Apply the basic idea from the previous problem to the approximation of solutions towhich has exact solution .
13 Assume that the function satisfiesfor some constant . Use this and (2.9)‐(2.10) to show that the error satisfies the recursion,whereSolution: If we take and subtract (2.10) from (2.9) we getfrom which we haveand the desired result follows immediately.
2.4 LINEAR INTERPOLATION
Exercises:
1 Use linear interpolation to find approximations to the following values of the error function, using the table in the text. For each case, give an upper bound on the error in the approximation:;;;;.Solution For Part (a), we have and , sothusThe upper bound on the error comes straight from Theorem 2.1. We havewhere the maximum of the second derivative is computed over the interval . We haveso thatHence the error satisfies
2 The gamma function, denoted by , occurs in a number of applications, most notably probability theory and the solution of certain differential equations. It is basically the generalization of the factorial function to non‐integer values, in that . Table 2.5 (Table 2.8 in the text) gives values of for between 1 and 2. Use linear interpolation to approximate values of as given below:;;;.Table 2.5 (Table 2.8 in the text) Table of values.1.001.00000000001.100.95135076991.200.91816874241.300.89747069631.400.88726381751.500.88622692551.600.89351534931.700.90863873291.800.93138377101.900.96176583192.001.0000000000
3 Theorem 2.1 requires an upper bound on the second derivative of the function being interpolated, and this is not always available as a practical matter. However, if a table of values is available, we can use a difference approximation to the second derivative to estimate the upper bound on the derivative and hence the error. Recall, from Problem 12 of §2.2,Assume the function values are given at the equally spaced grid points for some grid spacing, . Using the estimateto approximate the derivative upper bound, estimate the error made in using linear interpolation to approximate each of the following values of , based on the same table as in the previous problem:;;;;.Solution We do Part (d), only. This is a “two‐stage” problem. First, we compute an approximate value for using linear interpolation. Then we estimate the error using the suggested device for approximating the second derivative.The interpolation is straight‐forward:so thatNow, the error is bounded according towhere the maximum is taken over the interval . We don't have a formula for , so we can't get one for the second derivative.