MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

bug in complex integral?

Hi all.

I'm learning a bit of complex analysis (using the book Visual Complex
Analysis by Needham, which I think is great), so I turned to Mathematica to help
me come to grips with the material. The first thing I tried---just to
see that I was following the text at the most basic level---was to
integrate 1/z in a simple closed contour around the origin. Of course
the book says the integral is 2 Pi I (assuming a counter-clockwise
direction for integration). Imagine my surprise when I saw the result:

In[182]:= Integrate[1/z, {z, 1, I, -1, -I, 1}]

Out[182]= 0

By contrast, NIntegrate gets is right:

In[187]:= NIntegrate[1/z, {z, 1, I, -1, -I, 1}] // Chop

Out[187]= 6.28319 \[ImaginaryI]

Apparently, Integrate computes the answer from the Log function, which
has a branch cut along the negative real axis, thereby adding 2 Pi I to
the answer. Are there other complex booby traps lying around that I
should be aware of?

Just for a lark, I tried to integrate across the singularity at zero:
Integrate[1/z, {z, 1, 0, I}]. Well the kernel crashed, which in my
opinion is unnecessarily harsh punishment, but then I'm new to complex

BTW, I think Bernd Thaller's ComplexPlot package is great. I use it to
make plots to put on the refrigerator along side my kids' artwork. My
nine-year-old son lets out a loud shriek when he sees a new one. The
earlier version of the package (that came with the Mathematica Journal
article) has a mildly annoying bug with respect to Compile in version 4.
The latest version, which fixes the bug, can be downloaded from
Thaller's Visual Quantum Mechanics web page:


Mark Fisher
Economic Advisor
Research Department
Federal Reserve Bank of Atlanta
Atlanta, GA 30303
404-521-8757 (voice)
404-521-8810 (fax)
mark.fisher at

personal web page:

  • Prev by Date: Surface Graphics versus Graphics3D features
  • Next by Date: Re: Expanding a nested structure (pattern matching?)
  • Previous by thread: Re: Surface Graphics versus Graphics3D features
  • Next by thread: Re: bug in complex integral?