1
$\begingroup$

I've tried to calculate the integral

integral of z^2/(Exp[z] - 1)^2 around the 3pi complex circle.

And I got the result $16i \pi ^3$.

I wanted to check my calculation, so I ran this code in Mathematica:

With[{z = 3 π Exp[I th]}, NIntegrate[z^2/(Exp[z] - 1)^2, {th, 0, 2 π}]]

which gave me the answer $18.8496$ (Which is $6\pi$).

I couldn't find any mistakes in my calculation, so I gave Wolfram the following code which calculates the integral with the residue theorem and with poles at $\pm 2\pi i$

N[2 π I 
   (Residue[z^2/(Exp[z] - 1)^2, {z, 2 Pi I}] + 
    Residue[z^2/(Exp[z] - 1)^2, {z, -2 Pi I}])]

And that code gave me $0. + 496.1 i$, which is the numerical representation of my result for the integral.

Does someone know why do the straight forward approach didn't work?

$\endgroup$

closed as off-topic by Artes, MarcoB, Coolwater, Henrik Schumacher, C. E. Feb 1 '18 at 17:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Artes, MarcoB, Coolwater, Henrik Schumacher, C. E.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Isn't there a pole at $z = 0$? $\endgroup$ – David G. Stork Jan 22 '18 at 21:50
  • $\begingroup$ The pole at $z=0$ isn't really a pole - It's a removable singularity so it doesn't add to the residue $\endgroup$ – DeadlosZ Jan 22 '18 at 21:51
  • 4
    $\begingroup$ You forgot dz = 3 Pi I Exp[I th] dth $\endgroup$ – Carl Woll Jan 22 '18 at 21:54
  • $\begingroup$ Why are right, but adding * 3 Pi I z still doesn't give the correct answer $\endgroup$ – DeadlosZ Jan 22 '18 at 21:56
  • $\begingroup$ nevermind. no need for another 3 Pi there. problem solved! $\endgroup$ – DeadlosZ Jan 22 '18 at 21:57
6
$\begingroup$

You forgot the integration measure:

With[{z=3 π Exp[I θ]},
    NIntegrate[z^2/(Exp[z]-1)^2 D[z, θ], {θ, 0, 2 π}]
]

2.27374*10^-13 + 496.1 I

An alternate approach is to just give NIntegrate a contour:

NIntegrate[z^2/(Exp[z]-1)^2, {z, 1, 3 π I, -1, -3 π I, 1}]

1.32365*10^-11 + 496.1 I

$\endgroup$
  • $\begingroup$ Yap. that solved it. Thank you very much! $\endgroup$ – DeadlosZ Jan 22 '18 at 21:58
6
$\begingroup$

Appropriate parametrization involves $\;dz=\frac{d z(\phi)}{d \phi} d \phi = 3\pi i \exp(i \phi) d \phi$ which has been omitted in the original post. Numeric calculation yields a correct result, while the system can't integrate it symbolically with such a parametrization. Using Residue we can find an exact symbolic result. In the comments there were some imprecise statements so we demonstrate the full reasoning. There is a beautiful result in complex analysis: Residue theorem being a simple consequence of the Cauchy integral theorem, i.e. for e meromorphic function in a simply connected open subset $U$ of the complex plane we have $$\int_{\gamma} f(z)dz=2 \pi i \sum_{a \in A} Res_{z=a}(f(z))$$ where $A$ denotes the set of residual points in a region enclosed by $\gamma$.

For the problem at hand: $f(z)=\frac{z^2}{(\exp(z)-1)^2}$ and $\gamma=\{x \in U: |x|=3\pi \}$

Let's find all residual points:

A = z/.{ToRules @ Reduce[(Exp[z] - 1)^2 == 0 && Abs[z] <= 3 π , z]} // Flatten
{0, -2 I π , 2 I π }

and finally the contour integral is

Total[2π I Residue[z^2/(Exp[z] - 1)^2, {z, #}] & /@ A] // Simplify
16 I π^3  

With another approach which uses symbolic calculation, Mathematica 11.2 takes a bit (~10 sec.) to yield a silightly involved expression:

int = Integrate[ z^2/(Exp[z] - 1)^2, {z, 3π , 3I π , -3π , -3I π , 3π }];

which can be approximated (simplified) (as observed by Bob Hanlon) with

RootApproximant[int/π^3] π^3
 16 I π^3

Here we demonstrate different contours of integration we've discussed

ContourPlot[{Re[(Exp[z] - 1)^2] == 0, Im[(Exp[z] - 1)^2] == 0, 
             Abs[z] - 3 Pi == 0} /. z -> x + I y // Evaluate,
    {x, -3.5 π, 3.5 π}, {y, -3.5 π, 3.5 π}, 
    Epilog -> {Red, PointSize[0.02], Point[ReIm[A]], Dashed, Thick, 
    Purple, Line[{{3π, 0}, {0, 3π}, {-3π, 0}, {0, -3π}, {3π, 0}}]}, 
    PlotLegends -> Placed["Expressions", Right], 
    ContourStyle -> {{Thick, Darker@Green}, {Thick, Cyan}, {Dashed, Thick, Orange}}]

enter image description here

For various examples of appropriate parametrizations, see e.g.

Paths integrals in the complex plane

How do I find line integrals?

How to calculate contour integrals with Mathematica?

There were many different helpful posts on this site, however such an amazing subject as complex analysis deserves repetitions, since repetitio est mater studiorum.

$\endgroup$
  • 1
    $\begingroup$ +1. Your definition of A should include A = z /. ... to convert the rules to values. int can be simplified with RootApproximant[int/Pi^3] Pi^3 $\endgroup$ – Bob Hanlon Jan 24 '18 at 13:56
  • $\begingroup$ @BobHanlon Thanks, formerly I've written in the notebook something different than in the post. $\endgroup$ – Artes Jan 24 '18 at 15:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.