# Approximating integral of product of gaussian and cosines

I am trying to evaluate the following integral $$$$I=\int_{-\infty}^{\infty}\exp\left(-\frac{x^2}{b}\right)\prod_i^N\cos{\left(a_ix\right)}dx,$$$$

where $$b>0$$ and $$a_i$$ are integers between 1 and $$A$$ and $$A,N$$ are positive integers. I am looking for a way to approximate this integral. So far I have an approximation for small $$b$$. In this case the exponential dominates and the function is non-zero over a small window around zero. We Taylor expand the cosines to get

$$$$\int_{-\infty}^{\infty}\exp\left(-\frac{x^2}{b}\right)\prod_i^N\left(1-a_i^2x^2\right)dx,$$$$ then if we retain only terms up to $$x^2$$ we get $$$$\int_{-\infty}^{\infty}\exp\left(-\frac{x^2}{b}\right)\left(1-\frac{x^2}{2}\left(\sum_ia_i^2\right)\right)dx.$$$$

Evaluating this integral gives us the approximation $$$$I\approx\sqrt{\pi b}-\frac{\sqrt{\pi}b^{3/2}}{4}\left(\sum_ia_i^2\right).$$$$

Now I am at a loss for approximating this for large $$b$$. In this case the exponential will very slowly decay and getting rid of the product of cosines isn't as easy.

• Sure, I will edit the question. Commented Jun 5 at 9:06
• Would you mind to add pareentheses ? Commented Jun 5 at 9:13
• I believe an exact solution exists, I'm working on it.
– Zima
Commented Jun 5 at 9:45
• A product of cosines can be rewritten as a sum of trigonometric functions. Repeat this until $N=1$ and then you have integrals that can be evaluated in closed form. Commented Jun 5 at 9:50
• I know you can convert the product into a sum, but these sums quickly get out of hand. So I would be interested in a way around these. Commented Jun 5 at 10:34

There seems to be an exact formula. I am sharing it, both for fun and for you might find it helpful, but it gets pretty difficult to work with as $$n$$ gets larger, so your request for an approximation still remains reasonable. I will not provide the proof, since it takes a lot of time to write and this question was not about it.
If we set $$I(\beta,z_1,\dots,z_n)=\int_0^\infty e^{-\beta x^2}\cos(z_1x)\cdot\dots\cdot\cos(z_nx)dx$$ then we have $$I= \frac{1}{2^{n}}\sqrt\frac{\pi}{\beta}\cdot\sum_{k=1}^{2^{n-1}}\exp\left(-\frac{{\langle v_k,(z_1,\dots,z_n) \rangle}^2 }{4\beta}\right)$$ where the $$v_k$$ are identified by a choice of $$+1$$ and $$-1$$: $$v_k=(\pm1,\dots,\pm1)\in \{-1,+1\}^n$$, with the convenction that $$v_k=-v_k$$, so we only count one of the two in the sum.
I know the explanation is complicated, so here are some examples: \begin{align*} I(\beta,z_1)=& \frac12\sqrt\frac{\pi}{\beta}\cdot e^{\frac{z_1^2}{4\beta}} \\ I(\beta,z_1,z_2)=& \frac14\sqrt\frac{\pi}{\beta}\cdot\left(e^{\frac{(z_1+z_2)^2}{4\beta}}+e^{\frac{(-z_1+z_2)^2}{4\beta}} \right)\\ I(\beta,z_1,z_2,z_3)=& \frac18\sqrt\frac{\pi}{\beta}\cdot\left(e^{\frac{(z_1+z_2+z_3)^2}{4\beta}}+e^{\frac{(-z_1+z_2+z_3)^2}{4\beta}}+e^{\frac{(z_1-z_2+z_3)^2}{4\beta}}+e^{\frac{(z_1+z_2-z_3)^2}{4\beta}} \right) \end{align*} and so on.
• I agree with you, I posted it just for the fun of sharing a closed formula. An approximation is mandatory to calculate $I$ for large $n$.