MathGroup Archive 2000

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

Search the Archive

Re: bug in complex integral?

  • To: mathgroup at
  • Subject: [mg24898] Re: bug in complex integral?
  • From: Hendrik van Hees <h.vanhees at>
  • Date: Sun, 20 Aug 2000 01:34:49 -0400 (EDT)
  • References: <8nli0k$>
  • Sender: owner-wri-mathgroup at

Mark Fisher wrote:
> 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
I'm not aware that this construction does what you like. I think you
have to parameterise the curve in the complex plane and integrate the
following integral

Integrate[f[z[t] D[z[t],t],{t,t0,t1}]

I did this with f[z]=1/z and z[t_]=a Exp[I t], t0=0 and t1=2 Pi and it
worked (result is of course 2 Pi I).

Mathematica did not warn me about what happens if a=0. So one has to be
very very careful when using Mathematica's integration routine,
especially when functions are involved which have branch cuts because
you never know exactly where Mathematica sends you on the Riemann
surface. You might land on a completely different sheet than you

Mathematica is quite buggy in this point. This is also true for the
FourierTransform and InverseFourierTransform routines.

The way you did it is a good test, namely trying to test the analytic
results of Integrate with numerical results from NIntegrate.

In more complicated problems it is also good to use Integrate for
calculating the indefinite integral and put in the boundaries at the

> By contrast, NIntegrate gets is right:
> In[187]:= NIntegrate[1/z, {z, 1, I, -1, -I, 1}] // Chop
> Out[187]= 6.28319 \[ImaginaryI]

Hendrik van Hees		Phone:  ++49 6159 71-2751
c/o GSI-Darmstadt SB3 3.183	Fax:    ++49 6159 71-2990
Planckstr. 1			mailto:h.vanhees at
D-64291 Darmstadt

  • Prev by Date: Re: functional routine for {a, b, c, ...} -> {a - b, b - c, c - ...}
  • Next by Date: Re: bug in complex integral?
  • Previous by thread: bug in complex integral?
  • Next by thread: Re: bug in complex integral?