'numerically integrating singular function in python

I am dealing with integration over a rather singular function (such is the case in physics when dealing with Green's functions, see the attached figure) in python. What I did was the usual integration method:

quad(green_function,-cutoff,cutoff)

real and imaginary part of the typical green's function G(omega)

And the numerical integration is quite unsatisfying. I wonder if there is a better method in python other than quad that deals with this singular integration nicely?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source