348 11 Outline of the Monte Carlo Strategy
return0;
}// end main function
Figure 11.1 shows the development of this system as functionof time steps. We note that
forN= 1000 after roughly 2000 time steps, the system has reached the equilibrium state.
There are however noteworthy fluctuations around equilibrium.
If we denote〈nl〉as the number of particles in the left half as a time average afterequilib-
rium is reached, we can define the standard deviation as
σ=
√
〈n^2 l〉−〈nl〉^2. (11.6)
This problem has also an analytic solution to which we can compare our numerical simula-
tion. Ifnl(t)is the number of particles in the left half aftertmoves, the change innl(t)in the
time interval∆tis
∆n=
(
N−nl(t)
N
−nl(t)
N
)
∆t,
and assuming thatnlandtare continuous variables we arrive at
dnl(t)
dt
= 1 −
2 nl(t)
N
,
whose solution is
nl(t) =
N
2
(
1 +e−^2 t/N
)
,
with the initial conditionnl(t= 0 ) =N. Note that we have assumednto be a continuous
variable. Obviously, particles are discrete objects.
300
400
500
600
700
800
900
1000
0 500 1000 1500 2000 2500 3000 3500 4000
nl(∆t)
∆t
MC simulation with N=1000
Exact result
Fig. 11.1Number of particles in the left half of the container as function of the number of time steps. The
solution is compared with the analytic expression.N= 1000.