Take the 2-minute tour ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

In my research I have come across the following integral

\begin{equation} 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\} \end{equation} 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

share|improve this question
    
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
add comment

2 Answers 2

up vote 4 down vote accepted

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)$$

share|improve this answer
    
This works. Awsome. Thanks! –  Gabriel Landi Nov 12 '12 at 16:40
add comment

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.

share|improve this answer
    
That's good advice. I'll work on it. Thank you very much. –  Gabriel Landi Nov 12 '12 at 0:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.