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](https://mathoverflow.net/questions/282978/fubini-can-we-interchange-integration-order-on-this-double-integral-with-fouri).



Incoherence of Fubini therorem with integral on Fourier series
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.


