The context of $$\int_{-\frac{\pi}{2}}^ {\frac{\pi}{2}}\text{erf}\left(\frac{\sqrt 2 R\cos\theta}{\sigma}\right)\text d\theta$$ is it came up whilst integrating the Rayleigh distribution function over an off-centered circle of radius $R$: $$\int_{-\frac{\pi}{2}}^ {\frac{\pi}{2}}\int_0^{2R\cos\theta}\frac{r}{\sigma^2}\exp\left(-\frac{r^2}{2\sigma^2}\right)r\text dr\text d\theta.$$ Since I’ve never worked with integrals of special functions such as the error function, I’d appreciate any help.
What's $\int_{-\frac{\pi}{2}}^ {\frac{\pi}{2}}\text{erf}\left(\frac{\sqrt 2 R\cos\theta}{\sigma}\right)\text d\theta$?
94 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
You can reduce this integral to an infinite sum but I'm not sure how enlightening the final result is...
$$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}erf\bigg(\frac{\sqrt{2}R\cos\theta}{\sigma}\bigg)d\theta=\frac{2}{\sqrt{\pi}}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\int _{0}^{\frac{\sqrt{2}R\cos\theta}{\sigma}}e^{-t^2}dtd\theta$$
$$=\frac{2}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n}{n!}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\int _{0}^{\frac{\sqrt{2}R\cos\theta}{\sigma}}t^{2n}dtd\theta$$
$$=\frac{2}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n\big(\sqrt{2}R\big)^{2n+1}}{\sigma^{2n+1}(2n+1)\cdot n!}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}(\cos(\theta))^{2n+1} d\theta$$
$$=\frac{2}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n\big(\sqrt{2}R\big)^{2n+1}}{\sigma^{2n+1}(2n+1)\cdot n!}2\int_{0}^{\frac{\pi}{2}}(\cos(\theta))^{2n+1} d\theta$$
$$=\frac{2}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n\big(\sqrt{2}R\big)^{2n+1}}{\sigma^{2n+1}(2n+1)\cdot n!}B\bigg(\frac{1}{2},(n+1) \bigg)$$
$$=2\sum_{n=0}^{\infty}\frac{(-1)^n\big(\sqrt{2}R\big)^{2n+1}}{\sigma^{2n+1}(2n+1)}\cdot\frac{1}{\Gamma\big(n+\frac{3}{2}\big)}$$
$$=\frac{2}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n\big(\sqrt{2}R\big)^{2n+1}}{\sigma^{2n+1}(2n+1)}\cdot\frac{4^{n+1}(n+1)!}{(2n+2)!}$$
So, after some rearranging, we arrive at;
$$=\frac{8R\sqrt{2}}{\sigma\sqrt{\pi}}\sum_{n=0}^{\infty}\bigg(\frac{-8R^2}{\sigma^{2}}\bigg)^{n}\frac{(n+1)!}{(2n+1)(2n+2)!}$$
On
Let $k=\frac{\sqrt{2} R}{\sigma }$ and use the series expansion of the error function $$\text{erf}(k \cos (\theta ))=\frac{2}{\sqrt{\pi }}\sum_{n=0}^\infty (-1)^n\, \frac{k^{2 n+1}}{(2 n+1)\,n!}\,\cos ^{2 n+1}(\theta )$$ $$\int_{-\frac{\pi}{2}}^ {+\frac{\pi}{2}}\cos ^{2 n+1}(\theta )\,d\theta=\sqrt{\pi }\,\frac{ \Gamma (n+1)}{\Gamma \left(n+\frac{3}{2}\right)}$$ $$I=\int_{-\frac{\pi }{2}}^{\frac{+\pi }{2}} \text{erf}(k \cos (\theta )) \, d\theta= \sum_{n=0}^\infty (-1)^n\, \frac{k^{2 n+1}}{\left(n+\frac{1}{2}\right) \Gamma \left(n+\frac{3}{2}\right)}$$ which, as already given in @Roland F's answer, is $$I=\frac{4 k}{\sqrt{\pi }}\, _2F_2\left(\frac{1}{2},1;\frac{3}{2},\frac{3}{2};-k^2\right)$$
If $a_n$ is the summand $$\frac {a_{n+1}}{a_{n}}=\frac{2 (2 n+1)}{(2 n+3)^2} k^2=\frac {k^2}n \left(1-\frac{5}{2 n}+O\left(\frac{1}{n^2}\right) \right)$$
If you write
$$I=\sum_{n=0}^p (-1)^n\, \frac{k^{2 n+1}}{\left(n+\frac{1}{2}\right) \Gamma \left(n+\frac{3}{2}\right)}+\sum_{n=p+1} ^\infty (-1)^n\, \frac{k^{2 n+1}}{\left(n+\frac{1}{2}\right) \Gamma \left(n+\frac{3}{2}\right)} $$ and you want to know what is $p$ such that $$\frac{k^{2 p+3}}{\left(p+\frac{3}{2}\right) \Gamma \left(p+\frac{5}{2}\right)} \leq \epsilon$$ let $m=p+\frac 3 2$ and solve $$(m+1)!> m (m!) \geq \frac{k^{2 m}}{\epsilon }$$
which gives $$p\sim k^2 \, e^{1+W(t)}-2 \qquad \text{where} \qquad t=-\frac{\log \left(2 \pi k^2 \epsilon ^2\right)}{2 e k^2}$$
Trying for $k=5$ and $\epsilon=10^{-16}$, this would give, as real, $p\sim 94.8502$ while the exact solution is $91.4596$
By differentiation wrt R, integration wrt $\theta$ $$\frac{2}{\sigma }\ \sqrt{\frac{2}{\pi }}\quad \int_{-\frac{\pi }{2}}^{\frac{\pi }{2}} \ \ e^{-\frac{2 R^2 \cos ^2(\theta )}{\sigma ^2}} \ \cos (\theta )\, d\theta $$
and integration wrt R Mathematica yields $$\int \frac{2}{R}\ e^{-\frac{2 R^2}{\sigma ^2}} \text{erfi}\left(\frac{\sqrt{2} R}{\sigma }\right) \, dR=\frac{4}{\sigma } \sqrt{\frac{2}{\pi }}\ R \ \, _2F_2\left(\frac{1}{2},1;\frac{3}{2},\frac{3}{2};-\frac{2 R^2}{\sigma ^2}\right)$$
confirmed numerically for $R=1, \sigma =1$