Re: bug in complex integral?
- To: mathgroup at smc.vnet.net
- Subject: [mg24898] Re: bug in complex integral?
- From: Hendrik van Hees <h.vanhees at gsi.de>
- Date: Sun, 20 Aug 2000 01:34:49 -0400 (EDT)
- References: <8nli0k$9er@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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 expected! 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 end. > 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 gsi.de D-64291 Darmstadt http://theory.gsi.de/~vanhees/index.html