# Representing an integral as a special function

In my research I have come across the following integral

$$f = \int_0^{2\pi} \text{d}\theta \exp\left\{\frac{3}{2}(h_1 \cos^2\theta + h_2 \sin^2\theta + 2 h_{12} \sin\theta \cos\theta)\right\}$$ where $h_1$, $h_2$ and $h_{12}$ are constants of order unity, but which can be either positive or negative.

Eventually, I will have to evaluate this integral numerically a large number of times. Hence, it would be quite interesting if it could be written in terms of special functions (if $h_2 = h_{12} = 0$, for instance, it can be written in terms of Bessel Functions).

However, I was unable to figure out how.

Any suggestions?

More generally, do you have any tips on how to implement it numerically efficiently?

Thank you very much in advance. Best regards,

Gabriel

-
Just curious --- what research did you get this integral from? I am always interested how one obtains interesting analytical integrals in practice. – Ondřej Čertík May 20 '13 at 17:48

Using the half angle formulas you can convert the exponent into the form $$a + b \cos 2\theta + c \sin 2\theta$$ which then integrates nicely into Bessel functions. Mathematica gives $$\int_0^{2\pi}e^{a + b \cos 2\theta + c \sin 2\theta} d\theta = e^a \pi I_0\left(\sqrt{b^2 + c^2}\right)$$
Do you get anywhere by noticing that $h_1\cos^2\theta + h_2\sin^2\theta +2h_{12}\sin\theta\cos\theta$ can be written in the form $(h_1\cos(\theta)+a\sin\theta)(\cos(\theta)+b\sin\theta))$? A second step would be to realize that $h_1 \cos(\theta)+a\sin\theta = \cos(\theta-\psi)$ for some $\psi$. This helps you because the integral is over $\theta=0\ldots 2\pi$, so you can shift the entire integration interval by $\psi$ and hopefully come out with something that has a better structured exponent.