A code for free particle simulation
In this blog I am presenting a local and realistic model that simulates ensembles of similarly-prepared particles evolving on a discrete spacetime, with the aim of retrieving the results of Quantum Mechanics.
With the basic rules of motion described in this post and the source preparation in terms of momentum described in this post, we can already simulate an ensemble of particles for a very basic scenario. We assume that there are no external forces (including potential barriers), nor "quantum forces" acting. What the latter condition means, will be clarified in future posts. For the moment, it might be regarded as the scenario where there is only one location (one lattice node) possible as the source of the emitted particles.
In this scenario, a simple pseudocode implementing the 1D model can be written as follows:
%%% Simulate an ensemble of Np particles
for i = 1 to Np
%%% Attribute a random source momentum
v0 = rand[-1,1]
%%% Position the particle to be emitted at the source node s0
x[1] = x0
%%% Simulate Nt time steps
for t = 1 to Nt
%%% Attribute a momentum v that has the probability
%%% distribution described in this post
r = rand[0,1]
if r < (e+V)/2 then
vrand = -1
else if r < (e+V)/2+(1-e) then
vrand = 0
else
vrand = 1
end if
v[t] = vrand
%%% Increase the particle's position s according to momentum
x[t+1] = x[t]+v[t]
end for
%%% Record arrival node for further analysis
X[i] = x[t+1]
end for
An example of random trajectories with v0≈0.1 are shown in the figure below. Note the dispersion of these trajectories around the average (classical) trajectory x = v0t. Once averaging over the whole spectrum of v0, a probability mass function (pmf) for the final position emerges, that will be discussed in a future post.
With the basic rules of motion described in this post and the source preparation in terms of momentum described in this post, we can already simulate an ensemble of particles for a very basic scenario. We assume that there are no external forces (including potential barriers), nor "quantum forces" acting. What the latter condition means, will be clarified in future posts. For the moment, it might be regarded as the scenario where there is only one location (one lattice node) possible as the source of the emitted particles.
In this scenario, a simple pseudocode implementing the 1D model can be written as follows:
%%% Simulate an ensemble of Np particles
for i = 1 to Np
%%% Attribute a random source momentum
v0 = rand[-1,1]
%%% Position the particle to be emitted at the source node s0
x[1] = x0
%%% Simulate Nt time steps
for t = 1 to Nt
%%% Attribute a momentum v that has the probability
%%% distribution described in this post
r = rand[0,1]
if r < (e+V)/2 then
vrand = -1
else if r < (e+V)/2+(1-e) then
vrand = 0
else
vrand = 1
end if
v[t] = vrand
%%% Increase the particle's position s according to momentum
x[t+1] = x[t]+v[t]
end for
%%% Record arrival node for further analysis
X[i] = x[t+1]
end for
An example of random trajectories with v0≈0.1 are shown in the figure below. Note the dispersion of these trajectories around the average (classical) trajectory x = v0t. Once averaging over the whole spectrum of v0, a probability mass function (pmf) for the final position emerges, that will be discussed in a future post.
![]() |
Example of six 1D trajectories having v0≈0.1 (Nt=100, x0=0) |
Comments
Post a Comment