# Negative result of a integral of positive function

Let's try this: I have a function of two arguments, $e$ and $\omega$.

First I integrate some function of $(e, \omega)$:

Integrate[
1/π (e + c)/(ω^2 + (e + c)^2), {ω, 0, Infinity}, Assumptions -> {c > 0, e > 0}]


$$\int \limits_0^{\infty} \frac{\mathrm{d} \omega}{\pi} \frac{e + c}{\omega^2 + \left( e + c \right)^2}$$

Of course, the result is 1/2. Then I proceed with:

res = Integrate[
1/(1 + (ϵ - e)^2/Λ^2) 1/2 , {e, 0,
Infinity},
Assumptions -> {c > 0, ϵ > c, Λ > 0}];


$$\text{res} = \int \limits_0^{\infty} \mathrm{d} e \frac{1}{1 + \left( \frac{\varepsilon - e}{\Lambda} \right)^2} \frac{1}{2}$$ (the 1/2 at the end is the result of previous integral)

and making the series of the resulting function at $\varepsilon = \infty$

Simplify[Series[res, {ϵ, Infinity, 1}],
Assumptions -> {c > 0, Λ > 0}]


and the result is:

(π Λ)/2 - Λ^2/(2 ϵ)


$$\frac{\pi}{2} \Lambda - \frac{\Lambda^2}{2 \varepsilon} + o (\varepsilon^{-2})$$

which is absolutely correct, I expected this. Now I slightly modify the very first function and find:

Integrate[
1/π (e + c)/((1 + 1/(1 + ω^2)) ω^2 + 1/(
1 + ω^2) + (e + c)^2), {ω, 0, Infinity},
Assumptions -> {c > 0, e > 0}]


$$\int \limits_0^{\infty} \frac{\mathrm{d} \omega}{\pi} \frac{e + c}{\left( 1 + \frac{1}{1 + \omega^2} \right) \omega^2 + \frac{1}{1+ \omega^2} + \left( e + c \right)^2}$$

This is a bit nastier and the result is:

(c + e)/(2 Sqrt[1 + (c + e)^2])


$$\frac{1}{2} \frac{e + c}{\sqrt{ 1 + (e+c)^2}}$$

Now I repeat the second step:

res = Integrate[
1/(1 + (ϵ - e)^2/Λ^2) 1/2 (c + e) Sqrt[1/(
1 + (c + e)^2)], {e, 0, Infinity},
Assumptions -> {c > 0, ϵ > c, Λ > 0}];


$$\text{res} = \int \limits_0^{\infty} \mathrm{d} e \frac{1}{1 + \left( \frac{\varepsilon - e}{\Lambda} \right)^2} \frac{1}{2} \frac{e + c}{\sqrt{ 1 + (e+c)^2}}$$

I won't copy the result here, but I want to have a series of this around $\varepsilon = \infty$:

Simplify[Series[res, {ϵ, Infinity, 1}],
Assumptions -> {c > 0, Λ > 0}]


Strangely enough, now the result is:

- (π Λ)/2 - Λ^2/(2 ϵ)


$$- \frac{\pi}{2} \Lambda - \frac{\Lambda^2}{2 \varepsilon} + o (\varepsilon^{-2})$$

How is this possible? I start with a function which is positive in the integration domain and I get a negative result. Of course, I expect the result to be the same as before, because slight change of function like this can only lead to the integral (although analytically very challenging) which has to have same asymptotic limit (the reason is that for very large $\varepsilon \gg \Lambda, c, 1, ...$, it doesn't really matter what happens near the origin). What I did not expect was change of the sign. Where did the minus come from? Thank you for the help.

• It wouldn't be the first bug in Integrate. I can't really confirm it because the integral takes way too long. Have you checked if the bug is in Integrate or in Series? – Felix Mar 11 '17 at 4:06
• The sign error seems to come from the calculation of the limits e->Infinity and e->0 in the definite integral, because the derivative of the indefinite integral is right. When calculating the limits of the indefinite integral with Limit you get the same sign error. When calculating the indefinite integral with the Rubi integral solver of Albert Rich you get an integral with ArcTan instead of Log's and then Limit gets the right limits withourt sign error and Series then yields the exspected positive result. – Akku14 Mar 11 '17 at 22:14