I have applied Richardson's formula to the composite trapezoidal rule, $I_h(f)=\frac{h}{2}(f(a)+\sum_{k=1}^{n-1}f(a+kh)+f(b))$, in an attempt to better approximate the integral $I(f)=\int_0^1 e^{-x}dx$. Here is my work:
Define $N_1(h)=\frac{h}{2}(f(a)+\sum_{k=1}^{n-1}f(a+kh)+f(b))$. Since Composite Trapezoidal rule is of degree of accuracy 1, we want to find $N_2(h)$ to approximate this integral.
$N_2(h)=2N_1(\frac{h}{2})-N_1(h)$ $=\frac{h}{2}[(f(a)+\sum_{k=1}^{n-1}f(a+\frac{kh}{2})+f(b))]-\frac{h}{2}[(f(a)+\sum_{k=1}^{n-1}f(a+kh)+f(b))]$ $=h\sum_{k=1}^{n-1}[f(a+\frac{kh}{2})-f(a+kh)]$.
However, using that the actual value of this integral is $0.63212$, no value of $h$ ranging from $2^{-1}$ to $2^{-8}$ ($n$ from $1$ to $255$, since $h=\frac{b-a}{n}$), results in anything close to this number. In fact, the original composite trapezoidal rule gives much better approximations. I have computed these summations using MatLab. Can anyone help me figure out what I did wrong?
The trapezoidal rule and thus also the composite variant are symmetric. Thus the error order is even, which means that it is $2$. Which implies that the extrapolated value is $$ N_2(h)=\frac13(4N_1(\tfrac h2)-N_1(h)) $$
Next, if $n·h=b-a$, then also $2n·\frac h2=b-a$, so that the explicit formulas are \begin{align} N_1(h)&=h·\left(\tfrac12 f(a)+\sum_{k=1}^{n-1}f(a+kh)+\tfrac12 f(b)\right) \\ N_1(\tfrac h2)&=\tfrac h2·\left(\tfrac12 f(a)+\sum_{k=1}^{2n-1}f(a+k\tfrac h2)+\tfrac12 f(b)\right) \\ N_2(h)&=\tfrac h6·\left(f(a)+4f(a+\tfrac h2)+\sum_{k=1}^{n-1}\left[2f(a+kh)+4f(a+(k+\tfrac12)h)\right]+f(b)\right) \end{align} which is the composite Simpson rule (also symmetric) of error order $4$.
To experiment one could use this python code
with output