A code for 2D particle motion
The local-realistic model for quantum mechanics that we are presenting in this blog is based on a set of rules for particles' motion and interactions in a discrete spatiotemporal lattice. In a previous post, we have introduced the 3D lattice and how the model rules (earlier described in a 1D space) are generalized to it.
It is time to present a Matlab code that implements the multi-dimensional model as a program. We start from the fully trained expected-motion program, where both the lattice and the particles are "trained" and in addition we simulate the expected values of momentum and position, not their actual values (this in order to limit the computing times; for a "realistic" simulation see this code instead). For the sake of clarity we limit the number of dimensions to two; adding the third is straightforward.
The main addition to the code concern the inclusion of polarization (below noted as px, py), as we have seen in the corresponding post.
%%% Simulate an ensemble of Np particles in a 2D space,
%%% emitted at intervals Ti from either of Ns distinct sources
%%% rs(1,...,Ns)={xs,ys} having probability Ps(1,...,Ns)
%%% and phase es(1,...Ns),
%%% in the presence of a constant force field f.
%%% Evaluate the frequency of arrivals at a 'screen'
%%% after Nt iterations.
%%%
%%% Parameters: Np,Ns,Nt,rs,Ps,es,f.
%%%
%%% Evaluate the number of possible bosons for this scenario
B = Ns*(Ns-1)/2;
%%% Evaluate the probability of each Quantum Reset
iB = 0;
for i = 1:Ns-1
for j = i+1:Ns
iB = iB+1;
Pb(iB) = 2*Ps(i)*Ps(j);
dx(iB) = abs(xs(i)-xs(j));
dy(iB) = abs(ys(i)-ys(j));
de(iB) = es(i)-es(j);
end
end
%%% Start simulating
for i = 1:Np
%%% Attribute a random source momentum
v0x = -1+2*rand;
v0y = -1+2*rand;
qx = 0;
qy = 0;
%%% Attribute a random polarization
px = rand;
py = rand;
%%% Check feasibility of the emission
if v0x^2+v0y^2 > 1 || px+py > 1
continue
end
%%% Choose the source node according to probability vector
r0 = rand;
x0 = xs(find(r0<cumsum(Ps),1,'first'));
y0 = ys(find(r0<cumsum(Ps),1,'first'));
%%% Position the particle to be emitted at the source node x0
x = x0;
y = y0;
%%% Simulate Nt time steps
vFx = 0;
vFy = 0;
for t = 1:Nt
%%% Evaluate momentum and energy propensity
w0 = sqrt(Pb/2);
w = w0.*sin(pi*dx*qx+pi*dy*qy-pi*de)./(pi*(px*dx+py*dy);
vQx = v0x-2*px*sum(w);
vQy = v0y-2*py*sum(w);
vFx = vFx+fx;
vFy = vFy+fy;
Vx = vQx+vFx;
Vy = vQy+vFy;
%%% Average motion only
qx = qx*(lag-1)/lag+(vQx)*(1/lag);
qy = qy*(lag-1)/lag+(vQy)*(1/lag);
vx = Vx;
vy = Vy;
%%% Increase the particle's position x according to momentum
x = x+vx;
y = y+vy;
end
%%% Record arrival node for further analysis
X(i) = x;
Y(i) = y;
end
We can use this code to simulate a scenario and we take a set of sources on a line without external forces. The scenario parameters are Ns = 5, xs = {-8,-4,0,4,8}, ys = {-4,-2,0,2,4}, Ps = 1/5, es = 0, f = 0. The simulation parameters are Np = 2e6, Nt = 300. Figures below show the calculated number of arrivals as a function of the lattice positions x and y, compared with the theoretical quantum mechanical result.
Apart from border effects, the two distributions are clearly overlapping, as they tend to concentrate around peak values such that
where n is any integer. Interestingly, if we observe the distribution of the combined momentum
we find (see the figure below) that this quantity peaks around the values n*Nt, as expected.
We can note that the same result would have been obtained if: (i) the line connecting the sources would have been rotated to the, say, x1 axis, and (ii) the component kV1 would have been observed, where k = √5 is the distance among sources on the line. This example shows also that the proposed model is globally invariant for rotations of the sources with respect to the lattice (which is supposed to be fixed).
It is time to present a Matlab code that implements the multi-dimensional model as a program. We start from the fully trained expected-motion program, where both the lattice and the particles are "trained" and in addition we simulate the expected values of momentum and position, not their actual values (this in order to limit the computing times; for a "realistic" simulation see this code instead). For the sake of clarity we limit the number of dimensions to two; adding the third is straightforward.
The main addition to the code concern the inclusion of polarization (below noted as px, py), as we have seen in the corresponding post.
%%% Simulate an ensemble of Np particles in a 2D space,
%%% emitted at intervals Ti from either of Ns distinct sources
%%% rs(1,...,Ns)={xs,ys} having probability Ps(1,...,Ns)
%%% and phase es(1,...Ns),
%%% in the presence of a constant force field f.
%%% Evaluate the frequency of arrivals at a 'screen'
%%% after Nt iterations.
%%%
%%% Parameters: Np,Ns,Nt,rs,Ps,es,f.
%%%
%%% Evaluate the number of possible bosons for this scenario
B = Ns*(Ns-1)/2;
%%% Evaluate the probability of each Quantum Reset
iB = 0;
for i = 1:Ns-1
for j = i+1:Ns
iB = iB+1;
Pb(iB) = 2*Ps(i)*Ps(j);
dx(iB) = abs(xs(i)-xs(j));
dy(iB) = abs(ys(i)-ys(j));
de(iB) = es(i)-es(j);
end
end
%%% Start simulating
for i = 1:Np
%%% Attribute a random source momentum
v0x = -1+2*rand;
v0y = -1+2*rand;
qx = 0;
qy = 0;
%%% Attribute a random polarization
px = rand;
py = rand;
%%% Check feasibility of the emission
if v0x^2+v0y^2 > 1 || px+py > 1
continue
end
%%% Choose the source node according to probability vector
r0 = rand;
x0 = xs(find(r0<cumsum(Ps),1,'first'));
y0 = ys(find(r0<cumsum(Ps),1,'first'));
x = x0;
y = y0;
vFx = 0;
vFy = 0;
%%% Evaluate momentum and energy propensity
w0 = sqrt(Pb/2);
w = w0.*sin(pi*dx*qx+pi*dy*qy-pi*de)./(pi*(px*dx+py*dy);
vQx = v0x-2*px*sum(w);
vQy = v0y-2*py*sum(w);
vFx = vFx+fx;
vFy = vFy+fy;
Vx = vQx+vFx;
Vy = vQy+vFy;
%%% Average motion only
qx = qx*(lag-1)/lag+(vQx)*(1/lag);
qy = qy*(lag-1)/lag+(vQy)*(1/lag);
vx = Vx;
vy = Vy;
x = x+vx;
y = y+vy;
%%% Record arrival node for further analysis
X(i) = x;
Y(i) = y;
end
We can use this code to simulate a scenario and we take a set of sources on a line without external forces. The scenario parameters are Ns = 5, xs = {-8,-4,0,4,8}, ys = {-4,-2,0,2,4}, Ps = 1/5, es = 0, f = 0. The simulation parameters are Np = 2e6, Nt = 300. Figures below show the calculated number of arrivals as a function of the lattice positions x and y, compared with the theoretical quantum mechanical result.
Apart from border effects, the two distributions are clearly overlapping, as they tend to concentrate around peak values such that
where n is any integer. Interestingly, if we observe the distribution of the combined momentum
we find (see the figure below) that this quantity peaks around the values n*Nt, as expected.
Comments
Post a Comment