# Simpson's rule failure on $\cos\pi x$

I think I know why but I can't represent this accurately with a graph.

I am supposed to show why Simpson's Rule is so far off for the integral $$\int_0^{20} \cos \pi x$$

I know that the answer should be zero because it repeats on that interval, 10 up and 10 down evenly.

I know that the antiderivative $\sin \pi x$ will be zero for any 0 or pi value so that evaluates to zero.

When I use Simpson's Rule I get

$$\frac{2}{2} (1 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 +1) = 9$$

I am pretty certain that the reason the numbers are so far off is because the interval is 2 and that will cover an up and down which Simpson's Rule will overestimate but I can not show this on a graph to equal 9.

-
Another way of describing what happens here is that you're sampling the function you integrate - looking at its values at a finite number of points - and that your samples aren't actually sufficient to reconstruct your function; in fact, they're not even sufficient to distinguish your function from a constant function! To understand why this happens, you might want to have a look at the concept of aliasing ( en.wikipedia.org/wiki/Aliasing#Sampling_sinusoidal_functions ) and the Nyquist limit. – Steven Stadnicki Jun 6 '12 at 2:14
You do notice the area is $0$ right? – Pedro Tamaroff Jun 6 '12 at 20:46
Yes that is why Simpson's Rule fails in this example. – user138246 Jun 6 '12 at 20:54