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<a+h$):

$$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!


  • $\begingroup$ Where do you get the second derivative? $f(x)-f(a+\frac h2)=f'(ξ_x)(x-a-\frac h2)$ by the mean value theorem, there is no second derivative in this form. You can use Taylor second order, then $$f(x)-f(a+\frac h2)=f'(a+\frac h2)(x-a-\frac h2)+\frac12f''(ξ_x)(x-a-\frac h2)^2.$$ $\endgroup$ – LutzL Feb 23 '17 at 16:37

The proof you have is wrong. The thing is that the equation $$f(x)-p_0(x) = \frac{f''(\xi)}{2} (x-a-\frac{h}{2})$$ is a little vague. It doesn't mean that the equation is true for all values of $x$ in the sense:

There exists $\xi$ such that for all $x$, the equation $f(x)-p_0(x) = \frac{f''(\xi)}{2} (x-a-\frac{h}{2})$ holds.

Rather, the equation tells you

For each $x$, there exists some $\xi\in[a, a+h]$ such that the equation $f(x)-p_0(x) = \frac{f''(\xi)}{2} (x-a-\frac{h}{2})$ holds.

So, your mistake is in the equality $$\int_a^{a+h} f(x) - p_0(x)\ dx = \frac{f''(\xi)}{2} \int_a^{a+h} (x-a-\frac{h}{2})\ dx$$ because $\xi$ is not a constant.

  • $\begingroup$ I understand, but isn't $\int_a^{a+h} e(x)\ dx$ what I want? (it should be the integration error) $\endgroup$ – blueplusgreen Feb 23 '17 at 11:24
  • $\begingroup$ @blueplusgreen Ah, yes, sorry. Then the bottom part (now deleted) of my answer is wrong, but the top is still true. $\endgroup$ – 5xum Feb 23 '17 at 11:24
  • $\begingroup$ I've edited my question (denoted $\xi(x)$), and as far as I can tell, the problem remains (the error is vanished) $\endgroup$ – blueplusgreen Feb 23 '17 at 11:29
  • $\begingroup$ @blueplusgreen But if $\xi(x)$ is not constant in $x$, you cannot push it out of the integral! $\endgroup$ – 5xum Feb 23 '17 at 11:30
  • $\begingroup$ Oh right right.. silly me. $\endgroup$ – blueplusgreen Feb 23 '17 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.