# Thread: Approximating a difficult (or impossible?) integral

1. ## Approximating a difficult (or impossible?) integral

Hello!

I'd like to create a probability density function where the probability of observing a random variable is proportional to the distance from a circle.

Let the pair $(r, \theta)$ represent any location in polar coordinates and
let the pair $(r_1, \theta_1)$ be the centre of the circle of radius $R$.

The distance between any point and the centre of the circle can be found using the law of cosines: $d = \sqrt{r^2 + r_1^2 -2r r_1\cos(\theta - \theta_1)}$

Which means the distance to the closest point on the circle is $D = |d - R|$

Now the distribution is Gaussian shaped so I set the pdf as:
$p(r, \theta) = e^{(-\frac{D^2}{2 \sigma^2})}$

The probability of a random variable falling in a polar area $P_A$ is found by integration:

$P_A = \int_{r_a}^{r_b}\int_{\theta_a}^{\theta_b}p(r, \theta)rdr d \theta = \int_{r_a}^{r_b}\int_{\theta_a}^{\theta_b} e^{-\frac{(\sqrt{r^2 + r_1^2 - 2r r_1 \cos(\theta - \theta_1)} - R)^2}{2 \sigma^2}} rdr d \theta$

But neither Maxima nor Mathematica were able to solve that integral.

I started a Taylor expansion about a fixed point but it got ugly fast.

Any suggestions for another method of solving or approximating this integral are appreciated!

2. Originally Posted by jabernathy
Hello!

I'd like to create a probability density function where the probability of observing a random variable is proportional to the distance from a circle.

Let the pair $(r, \theta)$ represent any location in polar coordinates and
let the pair $(r_1, \theta_1)$ be the centre of the circle of radius $R$.

The distance between any point and the centre of the circle can be found using the law of cosines: $d = \sqrt{r^2 + r_1^2 -2r r_1\cos(\theta - \theta_1)}$

Which means the distance to the closest point on the circle is $D = |d - R|$

Now the distribution is Gaussian shaped so I set the pdf as:
$p(r, \theta) = e^{(-\frac{D^2}{2 \sigma^2})}$

The probability of a random variable falling in a polar area $P_A$ is found by integration:

$P_A = \int_{r_a}^{r_b}\int_{\theta_a}^{\theta_b}p(r, \theta)rdr d \theta = \int_{r_a}^{r_b}\int_{\theta_a}^{\theta_b} e^{-\frac{(\sqrt{r^2 + r_1^2 - 2r r_1 \cos(\theta - \theta_1)} - R)^2}{2 \sigma^2}} rdr d \theta$

But neither Maxima nor Mathematica were able to solve that integral.

I started a Taylor expansion about a fixed point but it got ugly fast.

Any suggestions for another method of solving or approximating this integral are appreciated!
I haven't tried this question out myself yet, but I do remember Rule Number 6... which is reverse the order of integration...

3. Changing the order of integration didn't improve the results.

$\int_{a}^{b}x\ \int_{\alpha}^{\beta}{e}^{-\frac{{\left( \sqrt{{y}^{2}-2\,cos\left( \theta-\phi\right) x y+{x}^{2}}-z\right) }^{2}}{2\,{\sigma}^{2}}}d\theta dx$
$\int_{\alpha}^{\beta}\int_{a}^{b}x\,{e}^{-\frac{{\left( \sqrt{{y}^{2}-2\ cos\left( \theta-\phi\right) x y+{x}^{2}}-z\right) }^{2}}{2\,{\sigma}^{2}}}dxd\theta$