# College Math Teaching

## April 7, 2014

### Numerical integration: why the brain is still required…

Filed under: class room experiment, integrals, numerical methods, pedagogy — Tags: — collegemathteaching @ 4:59 pm

I gave the following demonstration in class today: $\int^1_0 sin^2(512 \pi x) dx =$

Now, of course, even a C student in calculus II would be able to solve this exactly using $sin^2(u) = \frac{1}{2} - \frac{1}{2}cos(2u)$ to obtain: $\int^1_0 sin^2(512 \pi x) dx=\frac{1}{2}$

But what about the “just bully” numerical methods we’ve learned?

Romberg integration fails miserably, at least at first:

(for those who don’t know about Romberg integration: the first column gives trapezoid rule approximations, the second gives Simpson’s rule approximations and the third gives Boole’s rule; the value of $\Delta x$ gets cut in half as the rows go down).

I said “at first” as if one goes to, say, 20 rows, one can start to get near the correct answer.

The problem here is that this routine quits when the refined Simpson’s rule approximation agrees with the less refined approximation (to within a certain tolerance), and here, the approximations are both zero, hence there is perfect agreement, very early in the process.

So, what to do?

One should note, of course, that the integrand is positive except for a finite number of points where it is zero. Hence one knows right away that the results are bogus.

One quick way to get closer: just tweak the limits of integration by a tiny amount and calculate, say, $\int^{.999}_{.001} sin(512*\pi *x) dx$ and do some mathematics!

The point: the integration routines cannot replace thinking.