1. Introduction
Cellular automata (CA) are a powerful tool for modelling matter transport [
1]. The attractive feature of CA is that contemporary algorithms of parallel computing can be naturally embedded in them. Various cellular algorithms were successfully implemented on field-programmable gate arrays (FPGA) [
2,
3] and on graphic cards [
4,
5].
In the study of diffusion phenomena in physics, chemistry, and biology, CA are positioned as one of the effective tools for modelling systems of many particles. The simplest CA with boolean alphabet modelling the diffusion are the asynchronous CA with naive diffusion and the synchronous CA with Margolus neighbourhood [
6] or briefly Margolus CA (MCA). The last one is the object of our study. Exactly this type of the CA attracted our attention since synchronous CA are more advantageous in terms of the computing speed (see, e.g., comparison in [
7]). Note that the MCA is representative of partitioning CA.
The most common macroscopic characteristics of the diffusion transfer is the diffusion coefficient 
 that is defined as the proportionality factor in Fick’s law [
8,
9]. The diffusion coefficient is usually invariant when the movements of particles are caused just by random fluctuations rather than by any fields. Nevertheless, the processes with the time-dependent diffusion coefficient are also of interest, e.g., in the ambipolar diffusion phenomena [
10,
11,
12]. The most popular model of the diffusion is the kinetic model, which is based on a differential equations that can be solved, for example, using difference schemes [
13,
14,
15]. In such approach, the diffusion coefficient is an explicit parameter of the model. For cellular automata, the diffusion coefficient is not presented in the model explicitly. Calculating the diffusion coefficient for the CA with naive diffusion is a trivial task since it directly models the random walk of particles that is well-studied. However, it is not trivial for partitioning CA including MCA. We show here that the diffusion in the two-dimensional MCA can be described in terms of one two-dimensional Markov chain as opposed to the one-dimensional random walk. In our paper, we study the exact solution of this two-dimensional Markov chain whose characteristics are crucial for the mathematical description of the diffusion in MCA.
While multidimensional Markov chains arise in a number of applications in service theory [
16], genetic networks [
17], Gibbs sampling [
18], and other areas [
19], there are very few exactly solvable multidimensional Markov chains that do not degenerate to the one-dimensional one. Therefore, the exact solutions to the two-dimensional Markov chain under consideration can be of interest for specialists in applied mathematics and useful for applications other than cellular automaton theory.
The paper is organized as follows. In 
Section 2, we describe the diffusion model within the framework of the two-dimensional cellular automata with Margolus neighbourhood. Furthermore, we explain the way of obtaining the diffusion coefficient for this model based on the considering one-dimensional movement of a single particle. In 
Section 3, the stochastic process describing the one-dimensional movement of a single particle is given. The idea of introducing the auxiliary random variable associated with the direction of movement is proposed. This approach allows us to consider the process under consideration as the two-dimensional Markov chain. In 
Section 4, the formal mathematical definition of this chain and basic notations are given. In 
Section 5, we solve the master equation for the probability distribution of the particle coordinate using the probability generating function method. The moments of this distribution are derived. In 
Section 6, the obtained results are discussed within the framework of the diffusion model. The exact analytical formula for the diffusion coefficient is derived, and properties of the cellular automaton with the Margolus neighbourhood are discussed. In 
Section 7, we conclude with some remarks.
  2. Diffusion in the Margolus Cellular Automaton
In the two-dimensional cellular automata with Margolus neighbourhood, the diffusion is described based on the following algorithm [
6]:
(1) The plane is divided into identical square cells forming a cell grid. One cell contains a boolean variable that takes the value 0 or 1 corresponding to the absence or presence of a particle in the cell, respectively.
(2) The cell grid is divided into blocks of 
 cells. Such partition can be even or odd (see 
Figure 1). The even partition corresponds to the case when the left lower cell of each block has even vertical and horizontal numbers. The odd partition corresponds to the case when the left lower cell of each block has odd vertical and horizontal numbers.
(3) Beginning from an initial state, on each discrete time step the following rule is applied to each block independently. We rotate the block  clockwise or counterclockwise with the probability of  for each outcome. The rule is applied to blocks of the even partition on even time steps and it is applied to blocks of the odd partition on odd time steps. If each time step corresponds to the same time interval  and , then such MCA simulates the diffusion with the time independent diffusion coefficient .
The classic MCA uses 
, i.e., blocks always rotate. In such approach, the diffusion rate is controlled with the length of the time interval corresponding to one discrete time step and with the size of a cell. However, this model can be applied to the multicomponent diffusion problem. In this case, the cell contains few bits that correspond to 
particles of different substances. It can be treated as few layers of the cell grid. Then, we can not directly apply the described 
rule with 
 for every layer of 
particles if the diffusion rates for these substances are not equal. The difference in diffusion rates can be realized using different 
p for different substances. The only drawback of such approach is that the diffusion coefficient 
 nonlinearly depends on 
p. The other way is using the same 
 for each layer but skip two consecutive time steps for one or few layers with a probability equal to 
 (the rotation 
rule is not applied to any blocks of the respective layer on the skipped time step). In this approach, the diffusion coefficient linearly depends on 
. The differences between these two approaches will be discussed in 
Section 6.
In order to model the diffusion using the MCA, the diffusion coefficient corresponding to the particular MCA must be determined. It can be shown (see, e.g., [
20]) that
      
      where 
 is the diffusion coefficient, 
 is the side length of the cell, 
 is the time interval corresponding to the discrete time step, and 
 is the proportionality factor. However, relation (
1) does not help to obtain the exact value of the multiplier 
k. Moreover, 
k nonlinearly depends on 
p as it was mentioned earlier. One way is to determine 
k is to compute the specific diffusion problem using the numerical realization of the MCA and to compare the result with the analytical or numerical solutions of the respective diffusion equation. Such approach allows one to find 
k approximately. However, it is hard to estimate the error of the obtained value. Moreover, this error depends on the choice of the specific diffusion problem. The other way is to obtain the distribution of the 
particle position in the MCA. Assuming that the correlation of these distributions for two 
particles tends to zero with the growth of time steps number, the distribution of the position of the single 
particle is equal to the Green function of the diffusion equation that is given by
      
      where 
 is the radius vector of the particle position at time 
 relative to the initial position at time 
, 
 is the diffusion coefficient. For the isotropic and homogeneous problem, one can consider the projection of the 
particle position on one axis (let it be 
x). As 
, the distribution of the 
particle position tends to the normal distribution with the probability density function given by
      
      where 
 is the random position of the 
particle at the 
n-th time step, 
 is the expectation of 
, and 
 is the dispersion of 
. Then, for 
, 
, we have
      
Hereinafter, 
 will be given for 
, 
 unless otherwise stated. The trick is to find the distribution 
 or its moments analytically. In [
21], the authors tried to obtain the diffusion coefficient using this approach for 
. However, they assumed that 
 is the one-dimensional Markov chain, i.e., the simplest random walk. Later on, using the software realization of MCA with higher number of cells and time steps, it was shown that this assumption led to the diffusion coefficient obtained in [
21] for 2D MCA is approximately three times higher than the real one (see, e.g., [
20,
22,
23]). However, the exact distribution of 
 and the diffusion coefficient of MCA were not obtained since then. In this work, we present the exact distribution of 
 in MCA and obtain the exact analytical formula of 
 for an arbitrary 
p including the special case 
.
  3. One-Dimensional Movement of a Single Particle
In this Section, we will describe the rules of the stochastic movement of a single 
particle in MCA. As it was mentioned in the previous Section, we consider the movement along the 
x-axis that is directed along the side of a cell. Notice that if a 
particle is in an odd column at an odd time step, then its 
x-coordinate can either increase by 1 or does not change according to the rotation 
rule of the MCA (see 
Figure 2). The same rule works for a 
particle in a even column at an even time step. Let the variable 
d show the direction of possible movement of the 
particle along the 
x-axis. If 
, then 
x can either increase by one or does not change. If 
, then 
x can either decrease by one or does not change. It is easy to see that 
 corresponds to a 
particle in an even column at an odd time step and to a 
particle in an odd column at an even time step.
Notice that the direction d does not change when the x-coordinate changes and the direction d reverts its sign when the coordinate x does not change. The first outcome is realized with the probability of p at every time step while the second outcome is realized with the probability . Note that the sequence of the x-coordinates of the single particle has a memory, i.e., the current x-coordinate of the particle depends the history of its movements. It the main issue in the analytical description of partitioning cellular automata.
  4. Master Equation
Next, we give the formal definition of the two-dimensional Markov chain described in 
Section 3.
Let 
 and 
 be sequences of random variables where 
 and 
 is a set of outcomes. We associate the values of 
 with the discrete 
x-coordinate of the 
particle on a discrete time step 
t, and 
 is associated with its direction. The probability of transitions for the chain under consideration, which were described in 
Section 3, are given by
      
The semicolon in (
5) implies the logical conjunction.
The transition rules (
5) in notations (
6) yield the following master equation:
Hereinafter, 
, 
, and 
. We consider the problem with the deterministic initial position of the 
particle, i.e., 
. Then, the initial condition for (
7) reads
      
      where 
 is the Kronecker delta.
Within the framework of the diffusion problem, it is natural to consider the symmetric case 
. Thus, the following initial condition will be considered:
Since the distribution over 
x is of primary interest to us, we will study the marginal distribution given by
      
In order to construct the analytical description of the two-dimensional Markov chain under consideration, we will solve the master Equation (
7) with the initial condition (
9) in the next Section.
  6. Discussion of the Results
Now, from (
4) and (
23), we can obtain the diffusion coefficient 
:
In 
Figure 3, 
Figure 4 and 
Figure 5, the probability distribution from (
24)–(27) (or (
29) for 
), and (28) is plotted along with the following normal probability distribution:
Note that in view of (
3), (
4) the distribution 
 tends to 
 as 
 at least for 
. The moments of the normal distribution (
31) are given by (
30), (
23).
From 
Figure 3 and 
Figure 4, it is clear that the distribution is very close the normal one even for small 
t.
Note that the probability 
 does not make sense for MCA. However, the definition (
5) of the two-dimensional Markov chain under consideration admits 
 (
 and 
 are trivial cases), and Theorem 1 holds for 
. For completeness, we have shown the probability distribution for 
 in 
Figure 5. Apart from the fact that 
 has no physical meaning regarding the diffusion, we can note that the probability distribution 
 is a nonmonotonic function with respect to 
 for 
.
Next, we will discuss the differences between the two types of MCA mentioned in 
Section 2. Let the MCA parameterized by 
p be termed the first type MCA. The second type MCA corresponds to the 
 but it is parameterized by 
. The parameter 
 determines the probability that the rotation 
rule does not applies to any block of the odd and even partition at the next two time steps. In 
Section 2, we described it as the probability of skipping two consecutive time steps. We will limit ourselves to the simple case when the probability 
 is checked only at odd time steps. Note that 
 corresponds to the global rule while the probability 
p corresponds to the local 
rule since it is checked for each individual block independently.
We have shown that the diffusion coefficient 
 (
30) in the first type MCA nonlinearly depends on 
p. On the other hand, the diffusion coefficient 
 in the second type MCA linearly depends on 
 and is given as follows:
Both of these MCA can be adjusted to the same diffusion coefficient by the appropriate choice of 
p and 
, i.e., they have the same macroscopic behaviour at large times. However, they behave differently at small times 
t. Since the first and the third moments of the distribution given by (
24)–(28) equal to zero, the core information about the process behaviour is carried by the dispersion. The behaviour of the first type MCA corresponds to the dispersion 
 given by (
23) while the behaviour of the second type MCA corresponds to the dispersion 
 given by
      
In 
Figure 6, the time dependence of 
 and 
 are shown.
We see that the dispersion  tends to its large time asymptotic value faster than . Moreover, for small t, it is also much closer to this value that determines the diffusion coefficient in MCA especially for . It means that the first type MCA shows its macroscopic diffusion behaviour at smaller t. That can be treated as a better time resolution of such MCA. Note that the comparison of the dispersions yields a lower estimate for the time resolution since we do not take into account correlation between the movement of different particles in MCA. However, there is a reason to believe that this correlation is even higher for the second type MCA with  since the skipping of the two consecutive time steps is performed for the whole cellular grid as opposite to the first type MCA, where it is checked for the every block whether it rotates or not on the current time step. Hence, the difference mentioned above may be even greater than one obtained from our estimates.
Let us compare our analytical results with some empirical results of other authors.
In [
20], the author has compared the results of modelling with MCA and solutions of PDE numerically. The diffusion coefficient 
 was obtained. The error of 5% was declared in [
20]. Their numerical results agrees with the exact value of 
 obtained in this work.
In [
23], the authors have empirically obtained the dependence of 
 (in relative units) on 
p. They constructed the following regression model for this dependence:
Their experimental values for (
34) fit well to the curve (
30) taking into account the inaccuracy of their method of matching the solutions of MCA and PDE. Hence, they could obtain the regression model that is close to the exact formula if they would use the rational function approximation, which is widely used in many applications [
25], instead of the polynomial model.
Note that along with the MCA with the Boolean alphabet the one with the integer alphabet is also used [
7,
26]. Such approach allows one to lower the concentration noise [
27] when modelling reaction–diffusion systems. In order to control the diffusion coefficient independently of reaction rates in such MCA, the rotation 
rule applies not to the whole integer value but to its percentage. Applying the rotation 
rule to the percentage of 
particles is equivalent to the changing the block rotation probability 
p by the same factor in terms of the diffusion coefficient. Thus, the dependence of the diffusion coefficient on the percentage 
 of 
particles that are involved in the rotation has the same form as the dependence (
30) up to changing 
.
We should note that, in some works related to the multicomponent MCA, reseachers falsely suppose that the dependence 
 should be linear for a wide range of 
p. This assumption originates from the work [
28], where the authors claimed that 
 is linear on 
p even when the rotation probability is independent for each block. Our exact analytical Formula (
30) shows that the linear approximation is inaccurate when 
p is substantially lower than 
. Note that it also agrees with the cited numerical results [
23].
  7. Conclusions
We have considered the one-parameter stochastic process describing the one-dimensional movement (projection on the 
x-axis) of a single particle in two-dimensional MCA. In order to find the distribution of the 
x-coordinate of the particle at every discrete time step (the probability distribution of the random variable 
), we have introduced the additional random variable 
 associated with the direction of the movement of the particle. Using our approach, we have reduced this process to the two-dimensional Markov chain of 
 and 
 and have obtained the desired distribution by the probability generating function method. In particular, we have derived the analytic formula for the probability distribution (Theorem 1) and for two first moments (
23) of 
. The probability distribution is expressed in compact form in terms of Jacobi polynomials.
The primary results of this work are the Theorem 1 and Formula (
30). The Formula (
30) gives the diffusion coefficient of the one-parameter two-dimensional MCA. It establishes the correspondence between the cellular automaton model of the diffusion and the kinetic theory. Note that in our formalist diffusion coefficient is given by the asymptotic behaviour of the dispersion of 
 for the distribution under consideration. It is shown that the Formula (
30) agrees with earlier empirical results of other authors in the specified cases. Since the diffusion rate of real substances is usually given by their diffusion coefficient, the Formula (
30) is an important mathematical result for modelling the diffusion using MCA. Theorem 1 gives the probability distribution of a single particle in MCA that is given by the exact solutions to the two-dimensional Markov chain (
7), (
8), while (
30) is of main applied interest, Theorem 1 is a more general fundamental result. It allows us to study specific features of various realizations of MCA discussed in 
Section 6. Moreover, the exactly solvable two-dimensional Markov chain are also valuable for the fundamental mathematics. In view of Theorem 1, the empirically proven fact that MCA describes the diffusion can be presented as a specific property of Jacobi polynomials (see 
Figure 3 and 
Figure 4).
Due to the potential interest of Theorem 1 for other applications, it is worth studying other properties of the process under consideration. Note that the formulae derived in this work are valid for the range 
 while only 
 have a physical meaning in MCA. Therefore, the more detailed study of this process for the parameter 
 is planned in a separate future work. Furthermore, it is of interest to generalize our approach for the three-dimensional MCA, especially the Formula (
30).