# Why does Integral with Term-By-Term expansion diverge?

I am trying to integrate this function:

$$I = \int_{-\infty }^0 \frac{e^u}{\left(\left(e^u (u-1)+1\right) \lambda -1\right){}^2} \, du$$

and I cannot do it.

So, what I want to try to do is to expand the numerator in its Taylor series and integrate term-by-term, I.e.,

$$I = \int_{-\infty }^0 \frac{1+u+\frac{u^2}{2}+\frac{u^3}{6}+\cdots}{\left(\left(e^u (u-1)+1\right) \lambda _R-1\right){}^2} \, du$$

$$= \int_{-\infty }^0 \frac{1}{\left(\left(e^u (u-1)+1\right) \lambda -1\right){}^2} \, du+\int_{-\infty }^0 \frac{u}{\left(\left(e^u (u-1)+1\right) \lambda-1\right){}^2} \, du\ + \cdots$$,

but each term individually diverges.

NOTE: $I$ does not diverge when $\lambda = 0.5$ - the value of the integral is 1.42537

How can this be?

That's like taking the integral of $e^x$ from $(-\infty,0)$ by using its Maclaurin expansion... It's just not going to work in general unless you justify the interchangeability of the series and integral. To put it short, you have three limits: the lower bound is a limit, the integral is a limit of a Riemann sum (by definition), and the series expansion is also a limit (a limit of partial sums). In general, limits are not interchangeable...