|
|||||
Use of the trapezoid rule, which is substantially better than use of the left
hand rule for approximating integrals numerically, can be applied here if you
can find a way to calculate f(x, y) at the right ends of the intervals when you
only have an estimate for y at the left end.
This rule consists of approximating the difference between the values of y at the ends of the interval by half of d times its derivative at the left end plus half of d times its derivative at the right end obtained using the linear approximation to y defined at the left end. When f does not depend on y we get the usual trapezoid rule. Another way to look at this for subinterval from x to x + d is by defining "iterations" of the left hand rule, as follows: In these terms the computation rule here is The left hand rule is off because y changes over the interval. The linear approximation to y applied here is off only because y's derivative changes, and this is a second derivative effect. Thus the error it causes is quadratic in the interval size, and is on a par with the error intrinsic to the trapezoid rule. We therefore expect this rule to give results that improve in accuracy by a factor of four when N is doubled. Again, there is no great complication in setting up a spreadsheet to compute
the predictions of this rule for any N and you can extrapolate as before with
it. It has the advantage that you can start with the factor 4 extrapolation because
accuracy improvement by a factor of 4 on doubling the number of points is built
into its structure.
Exercise 26.2 Compare the results obtained using the rule above, with those obtained using the left hand rule, upon the same problem. Here are results obtained using this trapezoid like method with various levels of extrapolation.
The accuracy of these calculations for this problem are shown in the following table:
You will note that the estimates here without extrapolation are a little better than those for the first iteration of the previous method, by a factor of 6 for N = 128. However, after extrapolation the results are more accurate by a factor of thousands than in the previous table. |