On Wednesday, June 13, 2012 9:57:39 AM UTC+1, Sebastian Meznaric wrote:
> The bug can be found in the following analytic integral:
> Integrate[
> EllipticTheta[3, \[Phi], \[Alpha]] Exp[I \[Phi]], {\[Phi], 0,
> 2 \[Pi]}]
>
> Mathematica evaluates the integral to 0, which is not correct, which can be seen considering that for small value of alpha, the elliptic theta is close to the delta function. Numerical integration also confirms that this integral is non-zero.
I was evaluating the integral of EllipticTheta[3, (\[Phi] - \[Pi])/2, E^(-(\[Sigma]^2/2))]/(2 \[Pi]) over 0 to 2Pi. You can show that this is equal to e^{-\sigma^2 / 2} as follows.
Start with the sum \sum_{k=-\infty}^{\infty} \int_0^{2\pi} \frac{1}{\sigma \sqrt{2 \pi}} e^{-(\phi+2\pi k)^2/2\sigma^2} e^{i \phi} d\phi.
You can exchange integral and sum by Weierstrass M-test of uniform convergence. Now the sum evaluates, according to Mathematica, to (EllipticTheta[3, \[Phi]/2,
E^(-(\[Sigma]^2/2))])/(2 \[Pi]) for positive \sigma. So the above is the same as the integral of the Elliptic Theta function. Now if you do the integration term by term, on the other hand, you get
\sum_{k=-\infty}^{\infty} \frac{1}{2} e^{-2i\pi i k - \sigma^2/2}((E_f(\frac{2(k+1)\pi - i \sigma^2}{\sqrt{2}\sigma}) - (E_f(\frac(2k\pi - i \sigma^2}{\sqrt{2}\sigma}), where E_f is the error function.
This is a cascading sum of the error functions that evaluates to e^{-\sigma^2/2}.
There are also physical reasons why the above integral should not vanish.