While performing the following (presumably) correct manipulations in Mathematica, I obtain a result that is missing a sign function. Is there a mistake in my code, or is there some bug in Mathematica?

Let's say we want to reproduce the following Fourier transform in Mathematica:

$$\frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty dx \frac{e^{iwx}}{\sin(\pi x)}=\frac{i}{\sqrt{2\pi}}\text{sign}(w)\sum_{n=-\infty}^{\infty}e^{i n(\pi+w)}$$

The FourierTransform routine is hopeless here, since it never finishes evaluating. That's not surprising, since the result is an infinite sum without a closed form representation. So we have to try something else.

One way to proceed seems to be to take an anti-derivative

f = Exp[I x w]/(Sqrt[2 \[Pi]] Sin[\[Pi] x]);
F = Assuming[Element[w, Reals], Integrate[f, x]]

enter image description here

We can readily verify the anti-derivative to be correct:

D[F, x] // FullSimplify

(E^(I w x) Csc[\[Pi] x])/Sqrt[2 \[Pi]]

We know that anti-derivatives are only useful in analytic regions of functions. In the case of $e^{i wx}/\sin(\pi x)$ the function is analytic for $x\in\mathbb{R\backslash\mathbb{Z}}$, so that we will have to compute

$$\begin{align}\tilde{f}(w)&=\lim_{\epsilon\to0^+}\sum_{n\in\mathbb{Z}}(F(n+1-\epsilon)-F(n+\epsilon))\\ &=\lim_{\epsilon\to0^+}\sum_{n\in\mathbb{Z}}(F(n-\epsilon)-F(n+\epsilon))\end{align}$$ (where we shifted the infinite sum by one step in the first term for convenience).

For just a single summand we therefore calculate:

Assuming[Element[w, Reals] && Element[n, Integers] && 1/10 > \[Epsilon] > 0,
 Series[(F/.x->n-\[Epsilon]) - (F/.x->n+\[Epsilon]), {\[Epsilon], 0, 0}]//FullSimplify

enter image description here

This summand is almost the correct one! Just an overall factor $\text{sign}(w)$ is missing, which breaks the Fourier transform and makes our result wrong. I have been trying to find a mistake in my calculation, to see where the sign function was neglected. Unfortunately, it all looks correct to me. Therefore, I'd like to ask if I made a mistake somewhere, or if there is a bug in Mathematica? Thanks for any suggestion!

  • 1
    $\begingroup$ You should focus on the residuum theorem and Jordan's lemma. Perhaps the winding numbers of the residuals depend on sign[w] ... $\endgroup$ Dec 5, 2017 at 10:15
  • $\begingroup$ @UlrichNeumann Thanks for the hints, I'll look into it! $\endgroup$
    – Kagaratsch
    Dec 5, 2017 at 13:56
  • $\begingroup$ @UlrichNeumann OK, using Jordan's lemma gives the correct result very easily. But it is a math exercise, not Mathematica, so I wrote it up here: math.stackexchange.com/a/2551343/39367 $\endgroup$
    – Kagaratsch
    Dec 5, 2017 at 16:06
  • $\begingroup$ In your calculation with limit of the antiderivative function every thing seems to be ok. But doing so you neglect an infinite set of small deviations !!! $\endgroup$ Dec 5, 2017 at 21:44
  • $\begingroup$ @UlrichNeumann Interesting! Could you elaborate a bit on the nature of the neglected small deviations? $\endgroup$
    – Kagaratsch
    Dec 5, 2017 at 22:40

1 Answer 1


I assume you want to do the Fourier Transform of Csc[x]. Consider that:

$\csc x=\sum_{n=-\infty}^{\infty}\frac{(-1)^n}{x-n\pi}$

Thus, we have to do the Fourier Transform of $1/(\pi(x-n))$:

Assuming [n \[Element] Integers && \[Omega] \[Element] Reals,
FourierTransform[1/(\[Pi] (x - n)), x, \[Omega]]]

(* (I E^(I n \[Omega]) Sign[\[Omega]])/Sqrt[2 \[Pi]] *)

Therefore, you have your desired result:

$\frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty dx \frac{e^{iwx}}{\sin(\pi x)}=\frac{i (-1)^n}{\sqrt{2\pi}}\text{sign}(\omega)\sum_{n=-\infty}^{\infty}e^{i n \omega}$


$(-1)^n=\exp(i n \pi)$

  • $\begingroup$ Yeah, that is what I ended up doing in math.stackexchange.com/a/2551343/39367 . My beef here is more with Mathematica seemingly losing a sign function when trying to apply the anti-derivative approach. $\endgroup$
    – Kagaratsch
    Dec 5, 2017 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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