In theoretical condensed matter physics, a very common integral that is repeatedly solved is of the following form: $$ \int\limits_{-\infty}^{+\infty}\text{d}\omega\frac{1}{i\omega + i\Omega-a}\frac{1}{i\omega-b}. $$ Here $a,b,\omega,\Omega$ are all real numbers. $a,b$ and $\Omega$ are not $0$. Solving this integral analytically using complex analysis we know the answer to be, $ \frac{\theta(a)-\theta(b)}{i\Omega-a+b} $ where $\theta(x)$ is the Heaviside step-function. This implies that when $a$ and $b$ have the same sign, the answer is zero and when they are of opposite signs the answer is non-zero. When I solve it using Mathematica as below

    Assuming[{a \[Element] Reals, b \[Element] Reals, \[CapitalOmega] \[Element] Reals},
Integrate[1/(I*\[Omega] + I*\[CapitalOmega] - a)*1/(I*\[Omega] - b), {\[Omega], -Infinity, Infinity}]]

I get the following result ConditionalExpression[0, a < 0 && b < 0].

As is obvious when comparing to the exact analytical result, this is only part of the solution i.e. when both $a$ and $b$ are negative we get $0$. Mathematica does not give a general result and ignores cases where $a$ and $b$ have different signs which give a non-zero result. How do I make it give a result for all the possible cases like in the analytical result above? I know that I can solve 4 different integrals by giving different arguments for the Assuming function, but that is tedious for me as I have about 100 such integrals. Thus, having a compact answer in terms of theta functions is what I am looking for.


  • $\begingroup$ It is much simpler to compute the lesser/greater components and then recover all other, like retarded/advanced, time-ordered. $\endgroup$
    – yarchik
    Commented Mar 24, 2021 at 21:29

2 Answers 2

Integrate[1/(I*w+I*Ω-a)*1/(I*w-b), {w,-Infinity,Infinity},

(π (Sign[a]-Sign[b]))/((a-b-I Ω) Sign[a] Sign[b])

  • $\begingroup$ Thank you! This is exactly what I was looking for! I didn't know that we can just "turn off" the generation of conditions. $\endgroup$
    – odomosis
    Commented Mar 17, 2021 at 17:43
  • $\begingroup$ If $a=0$, then the integral under consideration diverges for any real $\Omega$, but the above formula gives a wrong result $0$. $\endgroup$
    – user64494
    Commented Mar 17, 2021 at 18:06
  • $\begingroup$ Hi. In my analysis $a$ and $b$ are never zero. They are either positive or negative. So, it is fine. Let me edit the question to clarify this. $\endgroup$
    – odomosis
    Commented Mar 17, 2021 at 18:15
  • 1
    $\begingroup$ @user64494 does it though? Plugging a=0 into the formula above yields a division by zero and thus a divergence with an accompanied warning on my machine. $\endgroup$ Commented Mar 17, 2021 at 20:38
  • $\begingroup$ @JulienKluge: You are right. That was my fault and I am sorry for that. $\endgroup$
    – user64494
    Commented Mar 18, 2021 at 6:05

Another way is as follows.

Assuming[{a*b < 0, \[CapitalOmega] \[Element] Reals}, 
 Integrate[ 1/(I*\[Omega] + I*\[CapitalOmega] - a)*1/(I*\[Omega] - 
  b), {\[Omega], -Infinity, Infinity}]]

$\fbox{$-\frac{2 \pi }{a-b-i \Omega }\text{ if }a>0$}$

  • $\begingroup$ Thank you! This will be helpful in certain cases. 👍🏽 $\endgroup$
    – odomosis
    Commented Mar 17, 2021 at 17:43
  • $\begingroup$ @odomosis: We may assume $a>0$ without loss of generality: think of extracting $-1$ in both denominators out of the integral. $\endgroup$
    – user64494
    Commented Mar 17, 2021 at 17:52
  • $\begingroup$ True, but I'll have to be careful about that in each such integral that I have. I have 50-60 such integrals so being careful of the $-1$ sign is tedious. Thus, the general result is much easier to work with for my situation. But, yes, even for me, your method could be more useful than the general result in certain scenarios, so I'll keep it in mind. $\endgroup$
    – odomosis
    Commented Mar 17, 2021 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.