0
$\begingroup$

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

  • 0
    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.$$2017-02-23

1 Answers 1

1

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.

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