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.