Analytical Evaluation to this multidimensional integral? I am benchmarking a sparse quadrature (Smolyak algorithm
) routine and wondered if the following had an analytical Evaluation
$$\int^{+\infty}_{-\infty}\dots\int^{+\infty}_{-\infty} \cos\left(\sum^M_{i=1} x^2_i\right) \exp\left(-\sum^M_{i=1} x^2_i\right)dx_1\dots dx_M $$
For M = 2
$$\int^{+\infty}_{-\infty}\int^{+\infty}_{-\infty} \cos\left( x^2_1+x^2_2\right) \exp\left(-x^2_1-x^2_2\right)dx_1dx_2 $$
but
$$ \cos(x+y) = \cos(x)\cos(y)-\sin(x)\sin(y) $$
So the above becomes
$$\int^{+\infty}_{-\infty}\int^{+\infty}_{-\infty} \cos(x_1^2)\cos(x_2^2) \exp\left(-x^2_1-x^2_2\right)dx_1dx_2\\ - \int^{+\infty}_{-\infty}\int^{+\infty}_{-\infty} \sin(x_1^2)\sin(x_2^2) \exp\left(-x^2_1-x^2_2\right)dx_1dx_2 \\
= {\pi\over\sqrt{2}} \cos^2\left({\pi\over8}\right) - {\pi\over\sqrt{2}} \sin^2\left({\pi\over8}\right)\\
= {\pi\over\sqrt{2}}\cos\left({\pi\over4}\right)\\
= {\pi\over2}
$$
I was hoping there was a general expression. Does anyone know of any expression where the dimensions are mixed that leads to a nice solution for testing purposes?
 A: Write $\cos(t) \exp(-t) = \text{Re}\; \exp((-1+i) t)$.  Thus with $\lambda = -1 + i = \sqrt{2} e^{3 \pi i/4}$, you want to look at 
$$ \int_{\mathbb R^M} \exp\left(\lambda \sum_{j=1}^M x_j^2\right)\; dx  = \prod_{j=1}^M \int_{\mathbb R} \exp(\lambda x_j^2)\; dx_j = \left(\dfrac{\pi}{-\lambda}\right)^{M/2} = \dfrac{\pi^{M/2}}{2^{M/4}} \exp(M \pi i/8)$$ 
and its real part is $$ \dfrac{\pi^{M/2}}{2^{M/4}} \cos(M \pi/8)$$
A: Consider a change to n-dimensional spherical coordinates
Now radial and polar contributions seperate:
$$
I_m = \int d\Omega_m \int_0^{\infty} dr r^{m-1}\cos(r^2)e^{-r^2}
$$
where $d\Omega_m$ is the Haussdorf measure of the m-unit sphere so
the polar part is just the surface of a unit m-sphere (see link above) $S_m$.Therefore
$$
I_m = S_m \left(\Re\int_0^{\infty} dr r^{m-1}e^{-(1-i)r^2}\right)
$$
The last integral can be done in various ways, most easily maybe by differentiating the two standard integrals
$$
\int_0^{\infty} dr r^{m}e^{-a r^2}=\begin{cases}
    (-1)^{m/2}\partial^{m/2}_a\int_0^{\infty}e^{-ar^2} & \text{for } m \text { even} \\
      (-1)^{(m-1)/2}\partial^{(m-1)/2}_a\int_0^{\infty}re^{-ar^2} & \text{for } m \text { odd}
   \end{cases}
$$
setting $a =1-i$ in the end
