# How to use Mathematica to do a complex integrate with poles in real axis?

I want to use Mathematica to compute the following complex integral:

Integrate[Exp[I z ] 1/z, {z, -Infinity, Infinity}]


Mathematica reports that it does not converge on {-Infinity, Infinity}.

But, from the textbook, we know, the result is I Pi.

Of course, if I use NIntegrate, then, Mathematica will give 0. + 3.14 I.

## 3 Answers

Try

Integrate[Exp[I z] 1/z, {z, -Infinity, Infinity},PrincipalValue -> True]
(*I π*)


One can also consider using the residue theorem. The residue is readily obtained by

Residue[Exp[I z] 1/z, {z, 0}]


returning 1, which means that the integral is $$\mathrm i \pi$$.

• This for me is the most satisfactory solution. – J. M. is in limbo Mar 1 '19 at 9:32
• @J.M.iscomputer-less Thank you for your comment. – Αλέξανδρος Ζεγγ Mar 1 '19 at 11:37

If you are sure about your integral's behavior you can try

Integrate[Exp[I z] 1/z, {z, -Infinity, Infinity},
GenerateConditions -> False]
(* I π *)