# Contour integral mystery: why is the answer different from Maple/Matlab?

The mystery is that here is a fairly standard contour integral which can be done by the residue theorem. Yet when I tried to evaluate it using numerical softwares like Maple or Matlab, the answer is different (in this case, by a factor of 2).

Even the lecturer doesn't know what's going on. Any explanation would be much appreciated.

The integral in question is:

$$\int_{-\infty}^\infty {\sin x \over x(\pi^2-x^2)}\textrm{d}x.$$

Here is the summary of the working the lecturer went through in class.

STEP 1) Consider this complex integral instead: $$\int_\Gamma {e^{iz}\over z(\pi^2-z^2)}\textrm{d}z,$$ where the integral is calculated using a upper-semicircular contour, indented at $0,\pm\pi$.

(sorry they won't let me post images).

Later on we will just take the imaginary part of the answer.

STEP 2) The poles at $\pm\pi, 0$ are all simple. The integral are the sum of those along the x axis, with the limit as the radii of the 3 indents $\to0$.

STEP 3) The integral along the big arc tends to $0$ by the ML inequality.

STEP 4) The residue at $\pm\pi$ are $$\mp {e^{\pm i\pi}\over 2\pi^2}=\pm{1\over2\pi^2}$$ The residue at $0$ is $${1\over \pi^2}$$

STEP 5) This implies that the sum of the 3 "indent" integrals is $$\sum_{k=1}^3 \int_{\text{indents}}f(z) d z=-i\pi\sum\text{residues}=-{i\over\pi}$$ (the minus sign comes from the fact that the indent integrals are oriented the 'wrong' way.)

STEP 6) Finally, equate the imaginary parts to get the answer

$$\int_{-\infty}^\infty {\sin x\over x(\pi^2-x^2)}\textrm{d}x={1\over \pi}.$$

All well and good, except that Matlab, Maple and Mathematica are all saying

$$\int_{-\infty}^\infty {\sin x\over x(\pi^2-x^2)}\textrm{d}x={2\over \pi}.$$

So what's going on??? I can't seem to find anything wrong with the working above.

Thanks.

• Looks to me like you got one of the residues wrong – David C. Ullrich Aug 20 '15 at 20:23
• The residues at $\pi$ and $-\pi$ are equal, $\frac{1}{2\pi^2}$. – Daniel Fischer Aug 20 '15 at 20:30
• Yes I see it now. The residues are the same at those places and they add up. Thank you! – Bacharach Aug 20 '15 at 21:09
• The integral diverges unless you are taking a Principal Value. – robjohn Aug 20 '15 at 21:39