- Code: Select all
//Adaptation of Albert Jan Wonnink's original code based on GAViewer for Joy Christian's S^3 Model of the 2-particle
//This is NOT Joy Christian's S^3 model. It is a GA R^3 model that works.
function RandomUnitVector() //uniform random unit vector:
//http://mathworld.wolfram.com/SpherePointPicking.html
{
v=randGaussStd()*e1+randGaussStd()*e2+ randGaussStd()*e3; //3D Vectors
return normalize(v);
}
batch test()
{
set_window_title("3D Test of GA Model for the 2-particle correlation");
default_model(p3ga);
N=10000; //number of iterations (trials)
I=e1^e2^e3;
s=0;
t=0;
u=0;
nPP=0;
nNN=0;
nPN=0;
nPN=0;
for(mm=0;mm<N;mm=mm+1) //perform the experiment N times
{
a=RandomUnitVector();
Da=I a;
b=RandomUnitVector();
Db=I b;
c=RandomUnitVector(); //singlet vector
//Sa=I c; //singlet bivector
//Sa=Sb;
if((a.c)>0) {Sa=Da;} else {Sa=-Da;} //polarizer takes Sa to +/-Da
if((b.c)>0) {Sb=Db;} else {Sb=-Db;} //polarizer takes Sb to +/-Db
A=-Da*Sa; //Measurement function
B=Sb*Db; //Measurement function
q=0;
//Since Sa*Sb = -1 the product calculation reduces to A B = -Da Sa Sb Db = Da Db.
q=(Da Db); //Product calculation
s=s+q;
p_a=atan2(scalar(Da/(e3^e1)), scalar(Da/(e2^e3))); //Get angle for a vector in x-y plane
p_b=atan2(scalar(Db/(e2^e3)), scalar(Db/(e3^e1))); //Get angle for b vector in x-y plane
neg_adotb=-(a.b);
print(neg_adotb, "f"); //Outputs -a.b event by event
if(p_a*p_b>0) {theta=acos(a.b)*180/pi;} else {theta=-acos(a.b)*180/pi+360;}
print(theta, "f"); //Outputs the angles
print(correlation=scalar(q), "f"); //Outputs the correlations event by event
t=t+A;
u=u+B;
pp=0;
nn=0;
pn=0;
np=0;
if(A>0&&B>0) {pp=1;}
if(A<0&&B<0) {nn=1;}
if(A>0&&B<0) {pn=1;}
if(A<0&&B>0) {np=1;}
nPP=nPP+pp;
nNN=nNN+nn;
nPN=nPN+pn;
nNP=nNP+np;
}
mean=s/N;
print(mean, "f"); //shows the vanishing of the non-scalar part
aveA=t/N;
print(aveA, "f"); //verifies that individual average < A > = 0
aveB=u/N;
print(aveB, "f"); //verifies that individual average < B > = 0
avePP=nPP/N;
print(avePP, "f"); //verifies plus-plus outcome prediction
aveNN=nNN/N;
print(aveNN, "f");
avePN=nPN/N;
print(avePN, "f");
aveNP=nNP/N;
print(aveNP, "f");
prompt();
}
Here is a plot of the product calculation for 100K trials.
However, it is easy to see from the product calculation in the code script that it will be exactly -a.b.
Here is the overall average of the +/-1 outcomes where you can see the vanishing of the cross products. However, in this R^3 model, the cross products are mathematical artifacts and don't exist since a and b are physically separated. The program simply does not know that fact.
mean = -0.001382 + 0.002110*e2^e3 + -0.000940*e3^e1 + 0.001990*e1^e2
Here are the A and B individual averages which are also vanishing.
aveA = -0.002780
aveB = 0.003240
And finally, here are the probability results for the ++, --, +-, and -+ outcome sets.
avePP = 0.249260
aveNN = 0.249030
avePN = 0.249350
aveNP = 0.252360
We can see that they are approaching 1/4 as should be.
.