2.(a) Let f(x) = x^11. Find the errors ME(n), TE(n) and SE(n) in the Midpoint, Trapezoid and Simpson's Rules for the interval [a,b] (explicitly as a function of n).
(b) Plot n^2 ME(n) and n^2 TE(n) (on the same graph) and n^4 SE(n) (on a different graph) as functions of n. What can you conclude?
(c) Show that ME(n), TE(n) and SE(n) are of the form
5 ----- (2 j) (2 j - 1) (2 j - 1) \ c[j] (b - a) (f (b) - f (a) ) ) ------------------------------------------------- / (2 j) ----- n j = 1where c[j] are constants (not involving a or b). The constants for ME, TE and SE are different. Hint: to find the coefficient of n^(-2j), you can use ``
coeff(expand(TE(n)),n,-2*j)
''.(d) Try it now for some other power x^m where m is an integer >= 5). Show that ME(n), TE(n) and SE(n) have the same form (with the same c[j]'s for j <= 5, but perhaps more terms). It turns out that for any function with at least 2m+2 derivatives on [a,b], each of these errors is
/ m \ |----- (2 j) (2 j - 1) (2 j - 1) | | \ c[j] (b - a) (f (b) - f (a) )| | ) -------------------------------------------------| | / (2 j) | |----- n | \j = 1 / (- 2 m - 2) + O(n )where c[j] are constants that don't depend on n, f, a or b.
(e) Compare the actual TE(n) to the sum from j=1 to 5
in the formula above, using f(x) = exp(x), a=0 and b=1.
Calculate n^12 times the difference, for n = 1 to 10.
Does this appear to approach a limit?
You should use ``Digits:=30
'' since
the differences get very small.
(f) What would the formula say about the error in using the Trapezoid Rule to approximate
2 Pi / | 1 | ---------- dx ? | 2 + cos(x) / 0How accurate are the Midpoint, Trapezoid and Simpson's Rule approximations for n=20 in this case? Note: make ``
Digits
'' at least 20.
Do you find the result surprising?3.(a) Find the Romberg approximations R[j,k] up to j=k=5 for
3 / | 1 | ------------ dx | 2 / x - 2 x + 5 1(b) Calculate the error in R[n,n] and compare to R[n,n-1] - R[n,n], for the integrals
1 1 / / | 11 | 41 | x dx and | x dx | | / / 0 0with n = 2, 3, 4 and 5.
(c) Is R[n,n-1] - R[n,n] a good estimate of the error in R[n,n] for int(x^k, x=0..1) when k is large?
(d) What n would be needed in order to have R[n,n] for int(x^41, x=0 .. 1) be exactly correct? Would it be practical to calculate this R[n]?