I want to integrate an off-center guassian distribtuion function over the surface of a sphere with radius of R. Here is the function: $$ f(x,y,z) = A \exp(-\frac{(x-x_{s})^2+(y-y_{s})^2}{d^2})$$ $x_s, y_s, R, d$ and $A$ are all constant paramaters, and I can't replace them with numbers. The goal is to have a function based on all these parameters, that I can later use in my model.

In Mathemtica. I can solve a centric gussian but as it gets off-center(as I put $x_s$ and $y_s$) it can not be sovled. To be able to easily integrate over surface of sphere I transform the equations to spherical coordinates and I have: $$ \int_{0}^{2\pi} \int_{0}^{\pi} A R^2 \sin(\phi)\exp( -2 \frac{ (R \sin(\phi) \cos(\theta)-X_s)^2 + (R \sin(\phi) \sin(\theta)-Y_s)^2 }{d^2}) d\phi d\theta$$ But still I can not sovle this with MATLAB or Mathematica.

And I believe I can't solve it numerically because since I have parameters in there, solving it numerically would mean that for each element of integration I will have a different exp term. So I will just have a function with 1000 exponential terms (assuming I divide surface to 1000 elements) and that would be not practically useful.

Am I doing sth wrong? Any suggestions please?


1 Answer 1


$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ $\left\{\begin{array}{l} \ds{\on{f}\pars{x,y,z} \equiv A \exp\pars{-\,{\bracks{x - x_{s}}^{2} + \bracks{y - y_{s}}^{2} \over d^{2}}}} \\[1mm] \ds{\bbox[5px,#ffd]{\iint_{\mathcal{S}}\on{f}\pars{x,y,z} \,\dd S}:\ {\LARGE ?}}. \\[1mm] \mathcal{S} \equiv \braces{\pars{x,y,z}\ \mid\ x^{2} + y^{2} + z^{2} = R^{2}\,,\ R > 0} \end{array}\right.$

Lets $\ds{\vec{r} \equiv x\,\hat{x} + y\,\hat{y} + z\,\hat{z}\quad}$ and $\ds{\quad\vec{r}_{s} \equiv x_{s}\,\hat{x} + y_{s}\,\hat{y} + 0\,\hat{z}}$. Then, \begin{align} &\bbox[5px,#ffd]{\iint_{\mathcal{S}}\on{f}\pars{x,y,z} \,\dd S} = \iint_{S}A\exp\pars{-\,{\verts{\vec{r} - \vec{r}_{s}}^{2} - z^{2} \over d^{2}}}\,\dd S \\[5mm] = &\ A\int_{0}^{2\pi} \\ &\ \!\!\!\!\!\int_{0}^{\pi}\!\!\!\!\! \exp\pars{-\,{\bracks{R^{2} -2Rr_{s}\cos\pars{\theta} + r_{s}^{2}} - R^{2}\cos^{2}\pars{\theta} \over d^{2}}}\ \times \\ &\ \phantom{\int_{0}^{2\pi}\int_{0}^{\pi}} R^{2}\sin\pars{\theta}\,\dd\theta\,\dd\phi \\[5mm] = &\ 2\pi AR^{2}\exp\pars{-\,{R^{2} + r_{s}^{2} \over d^{2}}}\ \times \\ &\ \int_{-1}^{1} \exp\pars{-\,{-2Rr_{s}\,\xi - R^{2}\xi^{2} \over d^{2}}} \,\dd\xi \\[5mm] = &\ \left.2\pi ARd \exp\pars{-\,{R^{2} + r_{s}^{2} \over d^{2}}} \int_{-d/R}^{d/R} \expo{\xi^{2}\ +\ 2\overline{r}_{s}\,\xi} \,\dd\xi\,\right\vert_{\ \overline{r}_{s}\ =\ r_{s}\,/d} \\[5mm] = &\ 2\pi ARd \exp\pars{-\,{R^{2} + r_{s}^{2} \over d^{2}}}\ \times \\ &\ \braces{% {1 \over 2}\expo{-\overline{r}_{s}^{2}}\root{\pi} \bracks{\on{erfi}\pars{{d \over R} - \overline{r}_{s}} + \on{erfi}\pars{{d \over R} + \overline{r}_{s}}}} \\[5mm] = &\ \pi^{3/2}ARd \exp\pars{-\,{R^{2} + 2r_{s}^{2} \over d^{2}}}\ \times \\ &\ \bracks{\on{erfi}\pars{{d \over R} - {r_{s} \over d}} + \on{erfi}\pars{{d \over R} + {r_{s} \over d}}} \end{align} whith $\ds{r_{s} = \root{x_{s}^{2} + y_{s}^{2}}\quad}$ and $\ds{\quad\on{erfi}\pars{z} \equiv -\ic\on{erf}\pars{\ic z}}$.

$\ds{\overline{\underline{\mbox{Note that}}}}$ $\ds{\ \color{red}{\on{erfi}\pars{z} \in \mathbb{R}}}$ when $\ds{\color{red}{z \in \mathbb{R}}}$.

$\ds{\on{\large erfi}\quad\mbox{and}\quad\on{\large erf}\quad}$ belong to the Error Function Family.

  • $\begingroup$ Thanks a lot for your reply. It looks very well. It seems that the answer would include imagnary number, right? because I don't expect my result to be a complex number. $\endgroup$
    – NavidAmin
    Oct 28, 2020 at 14:07
  • $\begingroup$ @NavidAmin $\color{red}{\operatorname{erfi}\left(z\right) \in \mathbb{R}}$ when $z \in \mathbb{R}$. Don’t worry about it. See this link. Thanks. $\endgroup$ Oct 28, 2020 at 17:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .