Incoherence of Fubini therorem with integral on Fourier series I ask this question because of the apparent incoherence of the value of following integral: 
$$I=\int_{0}^{1} \int_{0}^{\infty} \left|\sum_{n=1}^{\infty} f(nx) e^{2 i \pi n y} \right|^2  dx dy$$
Where $f(x)$ is such that $\int_{0}^{\infty} f(x)dx=0$, with near zero $f(x)=ax+o(x)$ and $f(x)$ exponentially decreasing at infinity (so that we have absolute convergence of the sums).
First, let's check that the integral is well defined. For this we need to understand behavior of $\sum_{n=1}^{\infty} f(nx) e^{2 i \pi n y} $ for $x$ near zero (near infinity there is no question thanks to the hypothesis of $f(x)$ exponential decrease). By Poisson summation formula we have:
$$ 2\sum_{n=1}^{\infty} f(nx) e^{2 i \pi n y} =\frac{1}{x} \sum_{n=-\infty}^{\infty} \int_{-\infty}^{\infty} f(|t|) e^{2 i \pi t \frac{n+y}{x}} dt$$
And using that $f(t)=at+o(t)$ near zero we deduce asymptotic of the Fourier transform of $f(|t|)$, so for $x$ near zero:
$$\int_{-\infty}^{\infty} f(|t|) e^{-2 i \pi \frac{t}{x}} dt = bx^2+o(x^2)$$
Using this result we deduce for $y$ fixed there exist a $c$ (depending on $y$) such that for $x$ near zero we have:
$$\sum_{n=1}^{\infty} f(nx) e^{2 i \pi n y} = cx + o(x)$$ 
So the initial integral is well defined (as once we integrate on $x$ we can easily integrate on $y$, the integral on $x$ beeing continuous on $y$).
But if then we use Fubini to interchange the integrals we find:
$$I= \int_{0}^{\infty} \int_{0}^{1} \sum_{n=1}^{\infty} f(nx) e^{2 i \pi n y}   \overline{\sum_{n=1}^{\infty} f(nx) e^{2 i \pi n y}}dx dy$$
$$I= \int_{0}^{\infty} \sum_{n=1}^{\infty} f(nx)  \overline{f(nx)}dx = \int_{0}^{\infty} \sum_{n=1}^{\infty} |f(nx)|^2 dx $$
Which is a non convergent integral as Poisson formula shows that for $x$ near zero :
$$\sum_{n=1}^{\infty} |f(nx)|^2 = \frac{1}{x} \int_{-\infty}^{\infty} |f(t)|^2 dt +o(\frac{1}{x}) $$
So on one side $I$ is defined on the other not, there is a mistake somewhere but where ? 
Note: I already posted a question connected to this one with a different formulation.
 A: The problem is not with Fubini's theorem (or more precisely, Tonelli's theorem), which is valid for any non-negative function measurable in the product sigma algebra.  The error instead lies in the claim "the integral on $x$ beeing [sic] continuous in $y$".  In fact it appears that the integral blows up like $1/y$ as $y \to 0$.  This is easier to see if one makes the change of variables $x = yt$, hence
$$ \int_0^\infty |\sum_{n=1}^\infty f(nx) e^{2i \pi n y}|^2\ dx = \frac{1}{y} \int_0^\infty \left|ty \sum_{n=1}^\infty f(nt y) e^{2i \pi n t y / t}\right|^2\ \frac{dt}{t^2}.$$
Riemann integration gives the limit
$$ \lim_{y \to 0^+} ty \sum_{n=1}^\infty f(nt y) e^{2i \pi n t y / t} = \int_0^\infty f(s) e^{2 \pi i s / t}\ ds$$
for any fixed $t$, hence by Fatou's lemma
$$ \liminf_{y \to 0^+} y \int_0^\infty |\sum_{n=1}^\infty f(nx) e^{2i \pi n y}|^2\ dx \geq \int_0^\infty \left|\int_0^\infty f(s) e^{2 \pi i s / t}\ ds\right|^2 \frac{dt}{t^2}.$$
The RHS is strictly positive (it's also finite by a change of variables $u =1/t$ and Plancherel, though I won't use this), so $\int_0^\infty |\sum_{n=1}^\infty f(nx) e^{2i \pi n y}|^2\ dx$ blows up at least as fast as $1/y$.  Indeed I suspect that this is the correct order of growth; one could presumably do some numerics (or a more refined version of the above analysis) to confirm this.
The above analysis also suggests that the contribution of the integrand is largest in the regime when $t = x/y$ is comparable to $1$, that is to say $x$ and $y$ are comparable in size.  In contrast, the analysis you provided is only valid in the regime when $x$ is much smaller than $y$, which is why the bulk of the divergent integral was missed.
