Given

you can evaluate the integral by first expanding

as a series, say

then interchange the order of integration/summation (provided Fubini's theorem holds; it usually will, so no need to worry greatly about this aspect) to write

Then evaluating the integral yields


Given an appropriate sequence

, you would then be able to evaluate the integral exactly, or at the very least find a partial sum that approximates the value of the integral to within a specified degree of accuracy.
Here's an example that demonstrates the procedure. Suppose we want to evaluate the definite integral

Recall that

so that we can write the definite integral as

Integrating yields

and so we're left with

The trick now is to evaluate the sum. Well, recall that

Our sum closely resembles this power series. In our sum, we have odd powers of

in the numerator, but even factorials in the denominator. We can adjust for this by simply multiplying by

:

Now, our denominators take the form

, while the cosine series proceeds with

- in other words, our sum skips the first term of the cosine series. We can adjust for this as well, by adding and subtracting the same term of

. In terms of our summand, we can get

by plugging in

, so we can write

Then shifting the index by 1 so that it starts at

gives

and now our sum exactly resembles to the negated cosine series evaluated at

.

We can verify that this result is correct:
