# Am I doing simulation the correct way?

The probability of finding a particle at a particular location $(x,y,z)$ and a particular time $t$ in a 3-D diffusion environment with drift $u,v,w$ and diffusion coefficient $D$ is given by: $$f(x,y,z,t)=\frac{1}{\sqrt{{(4\pi D t)}^3}}\exp\bigg(-\frac{{(x-ut)}^2+{(y-vt)}^2+{(z-wt)}^2}{4Dt}\bigg)$$ I want to simulate the motion of this particle. Can I simulate it by generating three Gaussian distributed random variables $x,y,z$ with mean $ut, vt,wt$ and variance $2Dt$ for a certain value of $t$.

Basically I want to decide whether at a given time the particle is inside a given spherical volume, located at $a=500\times 10^{-6} m$ in $x$ dimension, with radius $r=50\times 10^{-6} m$. Analytically the probability of being inside a spherical volume is given by :

$$P_s=\int_{-r}^{r}\int_{-\sqrt{r^2-x^2}}^{\sqrt{r^2-x^2}}\int_{-\sqrt{r^2-x^2-y^2}}^{\sqrt{r^2-x^2-y^2}}f(x-a,y,z,t) dz ~dy ~dx$$

For this I will simulate the particle motion in three dimensions using $x,y,z$ as randomly distributed and then will check: $$\sqrt{{(x-a)}^2+{y}^2+z^2}<=50\times 10^{-6} .$$ Am I doing simulation right?

• when u,v, w are zeros, $D$ and $t$ are $1$, the triple integral over $(x,y,z)$ is not equal to one – Canardini Jul 25 '18 at 18:20
• @Canardini I have corrected the expression, can you please check now? – Userhanu Jul 26 '18 at 5:45
• Why sum like that? The position is a 3D vector. Anyway, we usually want to simulate trajectories rather than single time snapshots... – Ian Jul 26 '18 at 5:49
• @Ian I have further elaborated my question, please check now? – Userhanu Jul 26 '18 at 6:13
• I think your desired integration can be done exactly in terms of error functions... – Ian Jul 26 '18 at 6:19