Deriving Error for Trapezoid Rule. Question on book's answer (if it's correct or not).

470 Views Asked by At

This is the question given in the book and is related to the error associated with the trapezoidal rule: Consider the integral $I(h)=\int_{a}^{a+h} f(x) dx$. Establish an expression for the error term for each of the following rules:

a. $I(h) ~ hf(a+h)$

b. $I(h)$ ~ $hf(a+h)-1/2h^2f'(a)$

c. $I(h)$~$hf(a)$

d. $I(h)$~hf(a)+$1/2h^2f'(a)$.

For each, determine, the corresponding general rule and error terms for the integral: $\int_{a}^{b} f(x) dx$, where the partition is uniform; that is, $x_i=a+ih$ and $h=(b-a)/n$ for $0\leq i \leq n$.

Here's the book answer for parts a and b: enter image description here

Is the answer for part b incorrect? Shouldn't it be $I(h)=\int_{a}^{a+h} f(x) dx$-($hf(a+h)-1/2h^2f'(a)$) =$(1/6-1/2)h^3f''(c_i) $=$-1/3h^3f''(c_i)$, not $-1/6h^3f''(c_i)$, which the book has? Also isn't the answer for part c the same as the answer for part a? While the answer for part b should be the same answer as part b: $-1/3h^3f''(c_i)$?

1

There are 1 best solutions below

1
On BEST ANSWER

If you assume that for an $n$-point formula, the error is $Ch^{n+1}f^{(n)}(\xi)$, which isn't always true then we can plug in an $n^{\text{th}}$ degree polynomial for which the quadrature formula predicts a value of $0$ and so get the error directly. $$\int_a^{a+h}(x-a-h)dx=\left.\frac12(x-a-h)^2\right|_a^{a+h}=-\frac12h^2=hf(a+h)-\frac12h^2f^{\prime}(\xi)$$ $$\begin{align}\int_a^{a+h}\left[(x-a)^2-h^2\right]dx&=\left.\left[\frac13(x-a)^3-h^2x\right]\right|_a^{a+h}=\frac13h^3-h^3=-\frac23h^3\\ &=hf(a+h)-\frac12h^2f^{\prime}(a)-\frac13f^{\prime\prime}(\xi)\end{align}$$ $$\int_a^{a+h}(x-a)dx=\left.\frac12(x-a)^2\right|_a^{a+h}=\frac12h^2=hf(a)+\frac12h^2f^{\prime}(\xi)$$ $$\int_a^{a+h}(x-a)^2dx=\left.\frac13(x-a)^3\right|_a^{a+h}=\frac13h^3=hf(a)+\frac12h^2f^{\prime}(a)+\frac16f^{\prime\prime}(\xi)$$ So you weren't quite careful enough with parts $c)$ and $d)$, getting a sign and a factor of $2$ off. Actually we can show that the error formulas are correct here but it gets a little ugly, especially in part $b)$. We can start with $$q(x)=\frac{\left[(x-a)^2-(y-a)^2\right]f(a+h)+\left[h^2-(x-a)^2\right]f(y)+(a+h-y)(y-x)(x-a-h)f^{\prime}(a)}{\left[h^2-(y-a)^2\right]}$$ For which $q(y)=f(y)$, $q(a+h)=f(a+h)$, and $q^{\prime}(a)=f^{\prime}(a)$, and assuming $a<y<a+h$ we can apply Rolle's theorem twice to find that there is some $a<u<a+h$ such that $f^{\prime\prime}(u)-q^{\prime\prime}(u)=f^{\prime\prime}(u)+\frac{-2f(a+h)+2f(y)+2(a-h-y)f^{\prime}(a)}{h^2-(y-a)^2}=0$, then solve for $f(y)$ and integrate from $a$ to $a+h$ and we get our error formula. It only works because the denominator in the last expression has the same same for $a<y<a+h$... but that's probably more in depth than required today.