# Calculate the diffusion coefficient from a random walk with stay.

I am working on a problem involving a random walk inspired by protein motion in biological cells. It is assumed that motion in time is a stochastic process. In this case, the simple 1D random walk evolving in time, $$t$$.

To avoid considering boundary conditions I establish an infinite domain and solve the following numerically. $$\mathrm{RW} = x_0 + \sum_{i=0}^T \Delta x s(r),$$ here $$x_0$$ is my initial location and has been simply $$x_0 = 0$$, $$T$$ represents the final time and is discredited by $$\Delta t$$, $$s$$ is a random function, $$r$$ is representing what I am calling the hopping rate, and $$\Delta x$$ is my spatial step size.

The random function goes like this

$$s(r) = \begin{cases} 1 & 0 \leq U < r\Delta t, \\ -1 & r \leq U < 2r\Delta t, \\ 0 & \mathrm{Otherwise}, \end{cases}$$ where $$U\sim{\sf U}(0,1)$$. So in this case, I have seen this type of RW called an RW with stay. I understand that if I simulate this $$N$$ times, where $$N$$ is large, and plot all random walks I should see the equivalent of a 1D diffusion equation. I know also that $$0 \leq r \leq 1$$ can change the overall variance of the RW process and that this can be evaluated by looking at the mean squared displacement.

Now I know there are similar posts here dealing with random walks and their respective diffusion coefficient.

1. Link 1
2. Link 2
3. More, etc...

I am having trouble being able to relate this so-called hopping rate to the diffusion coefficient at the time ($$Dt$$) in

$$\mathbb{P}(x,t) = \frac{1}{\sqrt{2\pi Dt}}\exp\left(\frac{-x^2}{Dt}\right),$$ for the 1D case that is. My actual problem is two or three dimensional. I have considered that $$D$$ is in length squared over time units and that my domain is in length units making $$r\Delta t = \frac{D \Delta t}{2 \Delta x^2}$$ seem reasonable. I have worked this out and I visually can see a similar spread between the distribution equation and simulating a million RWs, but the count in the RW is much higher than the solution function. I am currently working on just solving the diffusion equation with a forward Euler time explicit scheme, but I am just running into problems relating the $$D$$ to my $$r$$ values and $$t$$ in the distribution matching the right scale of T in the RW.

Any help would be welcomed. Please let me know if something is not clear.

## 2 Answers

The approach you have is covered as Position Jump Process II in

Erban, Radek, and S. Jonathan Chapman. "Reactive boundary conditions for stochastic simulations of reaction–diffusion processes." Physical Biology 4.1 (2007): 16.

One important thing, normal distribution approximation of Brownian Motion, i.e.,

$$P(x,t)=\frac{1}{\sqrt{2\pi Dt}}\exp(\frac{x^2}{4Dt})$$

is only valid for no stay cases. If you have a stay probability, depending on how large the stay probability is, you will observe deviations from that formula. The reason is that this formula is derived as a limiting case of a binomial distribution where there are only two outcomes at each step using the Stirling approximation.

Back to the question, $$D$$ for no stay case is defined as

$$D=\frac{l^2}{2\Delta{t}},$$ where $$l$$ is the jump length. As you said, you can use mean squared displacement to calculate $$D$$ and for your case, it looks like

$$D=\frac{\Delta{x}^2(1-2r\Delta{t})}{2\Delta{t}}.$$

PS: There are many other derivations of normal distribution, starting from binomial distribution is just one of them.

There is a derivation of the random walk with three different probabilities P-, P0 and P+ in this publication: Random walks Marc R. Roussel Department of Chemistry and Biochemistry University of Lethbridge (https://people.uleth.ca/~roussel/C4000statmech/random_walk.pdf).

But, in my case, working out the relation:

$$x(t+\Delta t) = x(t)+\Delta x ·\eta(t)$$ where $$\eta(t) = 1,0,-1$$ depending on if you move forward, stay or backward,

I found $$D=\frac{(P_{+}+P_{-})-(P_{+}+P_{-})^{2}}{2}·\frac{\Delta x ^2}{\Delta t}$$

(Where $$\Delta x$$ is the step size and $$\Delta t$$ is the simulation step time).