Under what conditions is integrating over a series expansion valid for an improper integral? On stackoverflow, a question was asked about getting Mathematica to evaluate the integral,
$$\int^\infty_0 \frac{e^{-x}}{\sin x} \, \mathrm{d}x$$
which we know is divergent.  In one of the answers, the integrand is replaced with its Taylor expansion, and integrated term by term, and in physics, it is often taken for granted that this works. But, under what circumstances is this valid for improper integrals, in general?  More precisely, what must be done to properly interchange the two limiting processes?
 A: Uniform convergence is often both too strong and too weak (it isn't sufficient for an improper integral over an infinite interval).  Better ones are dominated convergence and monotone convergence (see the Lebesgue dominated convergence theorem and the Lebesgue monotone convergence theorem).  
A: In some cases, a class of theorems called Tauberian theorems can help you to justify interchanging the order of two limiting operators. For example, if the improper integral $\int_{0}^{\infty} f(x) \, dx$ exists, then
$$\int_{0}^{\infty} \int_{0}^{\infty} x^{n} s^{n-1} f(x) \; e^{-xs} \, ds dx = \int_{0}^{\infty} \int_{0}^{\infty} x^{n} s^{n-1} f(x) \; e^{-xs} \, dx ds$$
holds for all $n$. (Of course, existence of both iterated integrals are also guaranteed.) Originally, Tauberian theorems are answers to the following question: For what condition (Tauberian condition) ensures that a stronger summability method implies a weaker summability? Since a stronger summability method often exploits a good approximation to the identity, these theorems may be regarded as a special kind of interchanging the order of limiting operators. For example, a function $f(x)$ is Abel-summable to $I$ if
$$\lim_{\delta \to 0+} \int_{0}^{\infty} f(x) e^{-\delta x} \, dx$$
exists with the value $I$. Then this reduces to the ordinary summability if we have
$$\lim_{\delta \to 0+} \int_{0}^{\infty} f(x) e^{-\delta x} \, dx = 
\int_{0}^{\infty} f(x) \, dx = \int_{0}^{\infty} \lim_{\delta \to 0+} f(x) e^{-\delta x} \, dx.$$
For the integral in question, we may understand it as the Cauchy principal value. That is, we identify this integral with
$$ \lim_{\epsilon \to 0+} \sum_{n=1}^{\infty} \int_{\pi(n-1) + \epsilon}^{ \pi n - \epsilon} \frac{e^{-x}}{\sin x} \, dx.$$
By circumventing poles, this integral can be managed by several techniques.
A: Here's a nice general treatment of the interchange of limiting processes using uniform convergence. It applies to integration, differentiation and series alike.
