Consider the midpoint rule for numerical integration:
$$\int_a^{a+h} f(x)\ dx \approx \int_a^{a+h} p_0(x)\ dx = \int_a^{a+h} f(a + \frac{h}{2})\ dx$$
I'm trying to evaluate the error of this numerical integration method:
We know the upper bound for the interpolation error ($a<\xi
$$f(x)-p_0(x) = \frac{f''(\xi)}{2} \left(x-a-\frac{h}{2} \right)$$ Therefore,
$$\int_a^{a+h} e(x)\ dx = \int_a^{a+h} f(x) - p_0(x)\ dx = \frac{f''(\xi)}{2} \int_a^{a+h} \left(x-a-\frac{h}{2}\right)\ dx \\ = \left[ s = x-a-\frac{h}{2}\right] = \color{red}{\frac{f''(\xi)}{2} \int_{-h/2}^{h/2} s\ ds = 0}$$ So I've got this weird result that the error is zero which seems odd for such a primitive numerical method (Obviously I'm wrong, but what is the mistake and what is the actual error?) I'd be glad for help! Thanks