# 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. May 20, 2013 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.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 1, "x-ck12": 0, "texerror": 0, "math_score": 0.9723929166793823, "perplexity": 137.36220146329907}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-33/segments/1659882573104.24/warc/CC-MAIN-20220817183340-20220817213340-00615.warc.gz"}