The correct formula is, for $\chi$ primitive of conductor $q$,
$$ \sum_{n\in\mathbb{Z}}\chi(n)f\left(\frac{nx}{\sqrt{q}}\right) =
\frac{A}{x}\sum_{n\in\mathbb{Z}}\bar\chi(n)\hat f\left(\frac{n/x}{\sqrt{q}}\right). $$
Here $A:=\sqrt{q}/\tau(\bar\chi)$ is the so-called root number, it is of modulus $1$.
This formula is essentially equivalent to the functional equation of $L(s,\chi)$, but let me provide a direct proof. We start from the well-known formula
$$ \chi(n) = \frac{1}{\tau(\bar\chi)}\sum_{m=1}^q\bar\chi(m)e\left(\frac{mn}{q}\right), $$
where $e(x)$ abbreviates $e^{2\pi i x}$. See
Davenport: Multiplicative number theory, Chapter IX, equation (6).
Then we can rewrite the left hand side in the formula as
$$ \sum_{n\in\mathbb{Z}}\chi(n)f\left(\frac{nx}{\sqrt{q}}\right) =
\frac{1}{\tau(\bar\chi)}\sum_{m=1}^q\bar\chi(m) \sum_{n\in\mathbb{Z}}
e\left(\frac{mn}{q}\right) f\left(\frac{nx}{\sqrt{q}}\right).$$
Applying the Poission summation formula for the inner sum on the right hand side,
$$ \sum_{n\in\mathbb{Z}}\chi(n)f\left(\frac{nx}{\sqrt{q}}\right) =
\frac{1}{\tau(\bar\chi)}\sum_{m=1}^q\bar\chi(m)
\sum_{k\in\mathbb{Z}}\int_{-\infty}^\infty e\left(\frac{mt}{q}+kt\right) f\left(\frac{tx}{\sqrt{q}}\right)\,dt. $$
Denoting $n:=m+qk$ on the right hand side, we obtain
$$ \sum_{n\in\mathbb{Z}}\chi(n)f\left(\frac{nx}{\sqrt{q}}\right) =
\frac{1}{\tau(\bar\chi)}\sum_{n\in\mathbb{Z}}\bar\chi(n)
\int_{-\infty}^\infty e\left(\frac{nt}{q}\right) f\left(\frac{tx}{\sqrt{q}}\right)\,dt. $$
By a change of variable,
$$ \sum_{n\in\mathbb{Z}}\chi(n)f\left(\frac{nx}{\sqrt{q}}\right) =
\frac{A}{x}\sum_{n\in\mathbb{Z}}\bar\chi(n)
\int_{-\infty}^\infty e\left(\frac{nt/x}{\sqrt{q}}\right) f(t)\,dt, $$
where $A$ is as above. This is the stated (corrected) formula.
Remark of 10/14/2013. The formula as proved above holds for integrable continuous functions satisfying $|f(t)|+|\hat f(t)|\ll (1+|t|)^{-1-\delta}$ for some $\delta>0$. I had an Addendum of 10/12/2013 here with a seemingly more relaxed condition for $q>1$, but this condition turned out to be equivalent to the original one by basic facts on the Fourier transform.
OK, Here's a simple example. Perform the sum:
$$
S = \sum_{n=1}^\infty \frac{(-1)^n}{2n-1}=-\frac{\pi}{4}
$$
using Poisson summation. Just summing terms in order is impractical; reaching machine precision would require summing $\sim$10$^{15}$ terms, requiring $\sim$4000 cpu years on my laptop.
Convergence for brute force summing (I didn't actually compute the last term in the graph [obviously!]---I just extrapolated.)
Here are the steps I followed to use Poisson summation for this sum.
- Extend the sum to "full range" ($n$ ranges from $-\infty$ to $+\infty$).
- Find a continuous function, $f(x)$ that matches the sum for integer arguments.
- "Periodize" $f(x)$ to make a function, $g(x)$, that is periodic from $0<x<1$ (and any other integer interval).
- Write $g(x)$ as a Fourier series.
- Evaluate at $x=0$ to recover a sum over integers.
- Evaluate the resulting sum in reciprocal space, rather than real space.
Here we go:
Step 1: Note that
$$
2S = 2\sum_{n=1}^\infty \frac{(-1)^n}{2n-1}=\sum_{n=-\infty}^\infty \frac{(-1)^n}{2n-1}=-\frac{\pi}{2}.
$$
(The sum is "symmetric" about $n=1/2$.)
Now we have a "full range" sum ($n$ ranges from $-\infty$ to $+\infty$) that we will replace with an $f(x)$ that matches the terms in the sum when $x\in\mathbb{Z}$.
Step 2: Find the matching function:
$f(x)=\frac{\cos(\pi x)}{(2x-1)}$
does the trick. It matches the terms of the sum at integer values of $x$.
Step 3: Periodize $f(x)$:
$$
g(x)=\sum_{n=-\infty}^{+\infty}f(x+n).
$$
This function is periodic over the interval $0\leq x<1$ (or any other unit interval).
Step 4: Write $g(x)$ as a Fourier series:
$$
g(x) = \sum_{k=-\infty}^{+\infty}a_k e^{2\pi i k x} =\sum_{k=-\infty}^{+\infty} e^{2\pi i k x}\int\limits_{0}^{1}g(x')e^{-2\pi i k x'}dx= \sum_{k=-\infty}^{+\infty} e^{2\pi i k x}\int\limits_{-\infty}^{+\infty}f(x')e^{-2\pi i k x'}dx'.
$$
(It might not be obvious that $\int\limits_{0}^{1}g(x')e^{-2\pi i k x'}dx= \int\limits_{-\infty}^{+\infty}f(x')e^{-2\pi i k x}dx'$ but remember that $g(x)$ is just a sum of shifted copies of $f(x)$. Adding up those shifted copies and integrating over the unit interval is the same thing as integrating $f(x)$ over the entire domain. Cute.)
Step 5: Evaluate the Fourier series at $x=0$ (and recover a sum over integers).
$$
g(0) = \sum_{n=-\infty}^{+\infty}f(n)= \sum_{k=-\infty}^{+\infty}\int\limits_{-\infty}^{+\infty}f(x')e^{-2\pi i k x'}dx'.
$$
$$
\sum_{n=-\infty}^{+\infty}f(n)= \sum_{k=-\infty}^{+\infty}a_k.
$$
Step 6: Instead of evaluating the LHS (we know that converges slowly), evaluate the RHS.
$$
{a_k = }\frac{1}{2} \left(2 \log (\left| 1-2 k\right| \left| 2 \pi k+\pi \right| )-\log \left((1-2 k)^2\right)-\log \left((2 \pi k+\pi )^2\right)-\Gamma \left(0,\frac{1}{4} (1-2 k)^2 \pi ^2\right)-\Gamma \left(0,\frac{1}{4} (2 \pi k+\pi )^2\right)\right)
$$
(I did the integral for $a_k$ with Mathematica. $\Gamma(a,z)$ is the incomplete Gamma function.)
$a_k=0$ for all $k$(!) except $k=0$ for which it is $-\frac{\pi}{2}$, the exact answer for $2S$.
The LHS requires $\sim$10$^{15}$ terms for machine precision. The RHS is exact using only the first term. Neat. That's fast convergence.
Best Answer
It is not possible to interchange integral and sum, but it seems possible to estimate the sum and define condition to have the integral null:
As by Poisson summation formula we have $\sum_{n=1}^{\infty} f(nx) \sim O(x^a)$ near zero we can split the integral in to:
$$\int_0^{\infty}\sum_{n=1}^{\infty} f(nx) dx= \int_0^{\epsilon}\sum_{n=1}^{\infty} f(nx) dx + \int_{\epsilon}^{\infty}\sum_{n=1}^{\infty} f(nx) dx$$
We can chose $\epsilon$ small to have first integral as small as we want, on the second one we can interchange sum and integral and if we note $F(x)$ the primitive of $f(x)$ such that $F(0)=0$ we have (as $\lim_{x \to 0} F(x)=0$ due to the condition imposedon $f(x)$: $\int_0^{\infty} f(x) dx=0$):
$$\int_{\epsilon}^{\infty}\sum_{n=1}^{\infty} f(nx) dx = -\sum_{n=1}^{\infty} \frac{1}{n} F(n \epsilon)$$
Now we can apply the Poisson summation formula (assuming $\lim_{x \to 0}\frac{F(x)}{x}=0$) to obtain (we note $\mathcal{F}$ the Fourier tansform):
$$ \sum_{n=1}^{\infty} \frac{1}{n \epsilon} F(n \epsilon) = \frac{1}{\epsilon} \sum_{n=1}^{\infty} \mathcal{F}(\frac{F(|x|)}{|x|})(\frac{n}{\epsilon})+\frac{1}{2 \epsilon} \mathcal{F}(\frac{F(|x|)}{|x|})(0)$$
And we see that, as the terms $\mathcal{F}(\frac{F(|x|)}{|x|})(\frac{n}{\epsilon})$ can be as small as we want for $\epsilon$ small, only one term remains and taking the limit with $\epsilon \to 0$:
$$\int_{0}^{\infty}\sum_{n=1}^{\infty} f(nx) dx = -\frac{1}{2} \mathcal{F}(\frac{F(|x|)}{|x|})(0) $$
So finally it seems the initial integral is zero only if:
$$\int_{0}^{\infty} \frac{F(x)}{x} dx=0$$
Comments are welcome, any reference for a similar treatment of a sum using Poisson summation formula ?