bug in complex integral?
- To: mathgroup at smc.vnet.net
- Subject: [mg24890] bug in complex integral?
- From: Mark Fisher <mark.fisher at atl.frb.org>
- Date: Sat, 19 Aug 2000 04:46:06 -0400 (EDT)
- Organization: Federal Reserve Bank of Atlanta
- Sender: owner-wri-mathgroup at wolfram.com
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 analysis. 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: http://www.kfunigraz.ac.at/imawww/vqm/index.html --Mark. 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 atl.frb.org personal web page: www.markfisher.net