integral of 3d gaussian with hollow integral space

643 Views Asked by At

I am trying compute the triple integral of a 3D Gaussian within a sphere hollow space. My questions are at the end.

You can think the problem in this manner. There is a very large ball whose center is hollow. The density follows 3D gaussian distribution, now I want to compute the mass of the hollow ball.

The 3D Gaussian is:

$$ f(x,y,z) = \frac{1}{(2 \pi)^{\frac{3}{2}} \sigma_x \sigma_y \sigma_z} \exp \left[ -\frac{(x-\mu_x)^2}{2\sigma_x^2} - \frac{(y-\mu_y)^2}{2\sigma_y^2} - \frac{(z-\mu_z)^2}{2\sigma_z^2} \right] , $$

where $$ \quad \Sigma = \begin{pmatrix} \sigma_x^2 & 0 & 0 \\ 0 & \sigma_y^2 & 0 \\ 0 & 0 & \sigma_z^2\end{pmatrix},$$

And the integral is $ \int \limits_{V} f(x,y,z)dv$, and $V$ is the area of $\sqrt{x^2 + y^2 + z^2} >= R$, $R \in [0, +\infty]$. After integration, it should be a function of $R$.

For further simplification, I treated $\mu_x = \mu_y = \mu_z = 0$, and $\sigma_z = \sigma_y = \sigma_z = \sigma$.

And the original equation became: $$ f(x,y,z) = \frac{1}{(2 \pi)^{\frac{3}{2}} \sigma^3} \exp \left[ -\frac{x^2 + y^2 + z^2}{2\sigma^2} \right]. $$

Followings are my integration process, and I am not sure whether I am correct or not.

$$ \int \limits_{V} f(x,y,z)dv = \int \limits_{V} f(x,y,z)dx dy dz $$

$$ = \int \limits_{V} \frac{1}{(2 \pi)^{\frac{3}{2}} \sigma^3} \exp \left( {- \frac{\rho^2}{2\sigma^2}}\right) \rho^2 \sin \phi d\rho d\phi d\theta $$

$$ = \frac{1}{(2 \pi)^{\frac{3}{2}} \sigma^3} \int \limits_{0}^{2\pi} d\theta \int \limits_{0}^{\pi} sin \phi d\phi \int \limits_{R}^{+\infty} \rho^2 \exp \left( {- \frac{\rho^2}{2\sigma^2}}\right) d\rho $$

$$ \int \limits_{0}^{2\pi} d\theta = 2\pi; \int \limits_{0}^{\pi} d\phi = -\cos(\pi) + \cos(0) = 2; $$

Thus, it becomes $$ = \frac{\sqrt{2}}{\sqrt{\pi}\sigma^3} \int \limits_{R}^{+\infty} \rho^2 \exp \left( {- \frac{\rho^2}{2\sigma^2}}\right) d\rho $$

$$ = \frac{\sqrt{2}}{\sqrt{\pi}\sigma} \int \limits_{R}^{+\infty} \rho \exp \left( {- \frac{\rho^2}{2\sigma^2}}\right) d{\left(\frac{\rho^2}{2\sigma^2}\right)} $$

$$ = \frac{\sqrt{2}}{\sqrt{\pi}\sigma} \int \limits_{R}^{+\infty} -\rho \cdot d \left( {\exp{\left[ -\frac{\rho^2}{2\sigma^2}\right]}} \right) $$

$$ = \frac{\sqrt{2}}{\sqrt{\pi}\sigma} \left[ {-\rho\exp{\left( -\frac{\rho^2}{2\sigma^2}\right)}} \Big|_R^{+\infty} + \int \limits_R^{+\infty} \exp \left({-\frac{\rho^2}{2\sigma^2} }\right) d\rho \right] $$

As $lim_{n\to\infty} \frac{x}{e^{x^2}} = lim_{n\to\infty} \frac{\frac{dx}{dx}}{d e^{x^2}} = lim_{n\to\infty} \frac{1}{2x e^{x^2}} = 0$

The original integration becomes $$ = \frac{\sqrt{2}}{\sqrt{\pi}\sigma} \left[ \left[ 0 + R\exp{\left( -\frac{R^2}{2\sigma^2}\right)}\right] + \int \limits_R^{+\infty} \exp \left({-\frac{\rho^2}{2\sigma^2} }\right) d\rho \right] $$

The integration in the equation can be calculated separately $$ \int \limits_R^{+\infty} \exp \left({-\frac{\rho^2}{2\sigma^2} }\right) d\rho $$ $$ = \sqrt{2\pi}\sigma \int \limits_R^{+\infty} \frac{1}{\sqrt{2\pi}\sigma }\exp \left({-\frac{\rho^2}{2\sigma^2} }\right) d\rho $$ This is the normal distribution function, which can be easily calculated as

$$ = \sqrt{2\pi}\sigma \left[ 1 - \int \limits_{-\infty}^R \frac{1}{\sqrt{2\pi}\sigma }\exp \left({-\frac{\rho^2}{2\sigma^2} }\right) d\rho \right] $$

$$ = \sqrt{2\pi}\sigma \left[ 1 - \frac{1}{2} \left[ 1 + erf \left( \frac{R}{\sqrt 2 \sigma} \right) \right] \right] $$

$$ = \frac{\sqrt\pi}{\sqrt2}\sigma \left[ 1 - erf \left( \frac{R}{\sqrt2 \sigma}\right) \right] $$ Plug the result in the original equation $$ \frac{\sqrt{2}}{\sqrt{\pi}\sigma} \left[ R\exp{\left( -\frac{R^2}{2\sigma^2}\right)} + \frac{\sqrt\pi}{\sqrt2}\sigma \left[ 1 - erf \left( \frac{R}{\sqrt2 \sigma}\right) \right] \right] $$ $$ = \frac{\sqrt{2}}{\sqrt{\pi}\sigma} \left[ R\exp{\left( -\frac{R^2}{2\sigma^2}\right)} + \frac{\sqrt\pi}{\sqrt2}\sigma \left[ 1 - erf \left( \frac{R}{\sqrt2 \sigma}\right) \right] \right] $$ $$ = 1 - erf{\left( \frac{R}{\sqrt2\sigma} \right)}+ \frac{\sqrt{2}}{\sqrt{\pi}\sigma} R\exp{\left( -\frac{R^2}{2\sigma^2}\right)} $$

  1. Is my calculation correct? I am not that confident of it, as have not been using this for a very long time.
  2. The problem has physical meaning when integral it from R to $\infty$. If I need to do the integral from $\infty$ to R, will the the sign be revised?
1

There are 1 best solutions below

1
On

When I typed

"1 - FunctionExpand[ CDF[ ChiSquareDistribution[3], x][[1, 1, 1]]] /. x -> (R/s)^2 // Simplify//PowerExpand//Simplify"

into Mathematica, Mathematica returns

$$1-\text{erf}\left(\frac{R}{\sqrt{2} s}\right)+\frac{\sqrt{\frac{2}{\pi }} R e^{-\frac{R^2}{2 s^2}}}{s}$$ which is exactly the same as your result.

I worked on the case where $\sigma_x\ne \sigma_y \ne \sigma_z$, but I did not make much progress.