A code for trained particles


The local-realistic model for quantum mechanics that we are presenting in this blog has the feature that quantum behavior (superposition) emerges after a large number of reproductions of the same system (e.g., a double-slit preparation). A Matlab code to simulate simple scenarios has been presented in this post, where the lattice is considered as already "trained".

In a previous post, we have discussed how particle boson momenta also converge to a steady-state average value. Here below is a further accelerated code that takes advantage of such property and considers particles already "trained" and their momenta already converged. In practice, the whole mechanism of quantum reset is ignored and replaced by the first line in bold. The probabilities of QR are precalculated.

Note also that a lag of several iterations has been introduced to avoid numerical oscillations and reproduce somehow the time scale of the training process.

%%% Simulate an ensemble of Np particles emitted at intervals Ti 
%%% from either of Ns distinct sources xs(1,...,Ns) having
%%% probability Ps(1,...,Ns). Evaluate the frequency of arrivals
%%% at a 'screen' after Nt iterations.
%%%
%%% Parameters: Np,Ns,Nt,xs,Ps.
%%%
%%% 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); 
      dd(iB) = abs(xs(i)-xs(j)); 
   end
end 

%%% Start simulating 

for i = 1:Np 
   
   %%% Attribute a random source momentum 

   v0 = -1+2*rand; 
   q = 0; 
  
   %%% Choose the source node according to probability vector 
  
   x0 = xs(find(rand<cumsum(Ps),1,'first'));

   %%% Position the particle to be emitted at the source node x0

   x = x0;

   %%% Simulate Nt time steps 

   for t = 1:Nt

      %%% Evaluate momentum and energy propensity

      w = sqrt(Pb/2).*sin(pi*dd*q-pi*ee)./(pi*dd);
      vQ = sum(w);
      V = v0-2*vQ;
      e = (1+V^2)/2;
      q = q*(lag-1)/lag+(x/t)*(1/lag);

      %%% Attribute a momentum v that has the probability
      %%% distribution described in this post

      v1 = [1,0,-1];
      v = v1(find(rand<[(e+V)/2,1-(e-V)/2,1],1,'first'));

      %%% Increase the particle's position s according to momentum

      x = x+v;

   end

   %%% Record arrival node for further analysis

   X(i) = x;

end

A further acceleration of convergence could be obtained by considering directly the average motion of the particle, that is, replacing the momentum v with its propensity V.

With these accelerated codes, the computational time is further reduced (particularly with the average motion code) and the convergence to the values that are theoretically calculated from the rules of motion is accelerated.

Below an example of result for a three-slit preparation (Ns = 3, xs = [-1,0,1], Ps = [1/3,1/3,1/3]). The red line is the theoretical QM probability density (scaled).



Comments

Popular posts from this blog

Quantum forces in a nutshell

The Nonergodic Interpretation of Quantum Mechanics

Coupling spin and momentum