- 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 a mapping of the quantum mechanics project to GA.
function getRandomLambda()
{
if( rand()>0.5) {return 1;} else {return -1;}
}
function getRandomUnitVector() //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 QM mapped to GA S^3 Model for the 2-particle correlation");
default_model(p3ga);
N=50000; //number of iterations (trials)
I=e1^e2^e3;
s=0;
t=0;
u=0;
for(nn=0;nn<N;nn=nn+1) //perform the experiment N times
{
a=getRandomUnitVector();
Da=I a;
b=getRandomUnitVector();
Db=I b;
lambda=getRandomLambda(); //lambda is a fair coin, giving the +1 or -1 choice
Sa=Da; //polarizer takes Sa to Da
Sb=Db; //polarizer takes Sb to Db
A=(Da)*(lambda*(-Sa)); //Measurement function
B=(lambda*Sb)*(Db); //Measurement function
LA=A/(-Sa);
LB=B/(Sb); //implements the twist in the Hopf bundle of S^3
q=0;
if(lambda==1) {q=(LA LB);} else {q=(LB LA);}
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/(e3^e1)), scalar(Db/(e2^e3))); //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"); //Output the angles
print(correlation=scalar(q), "f"); //Output the correlations
t=t+A;
u=u+B;
}
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
prompt();
}
And here is a plot of the data with 50K trials.
And here is a sample output of the data,
- Code: Select all
neg_adotb = 0.388081
theta = 112.835121
correlation = 0.388081
neg_adotb = 0.069717
theta = 266.002289
correlation = 0.069717
neg_adotb = 0.803799
theta = 216.505585
correlation = 0.803799
neg_adotb = 0.969949
theta = 194.081985
correlation = 0.969949
neg_adotb = -0.412260
theta = 65.653091
correlation = -0.412260
neg_adotb = 0.050439
theta = 92.891159
correlation = 0.050439
neg_adotb = 0.333078
theta = 109.455727
correlation = 0.333078
neg_adotb = -0.491393
theta = 299.432190
correlation = -0.491393
neg_adotb = -0.769292
theta = 39.709625
correlation = -0.769292
neg_adotb = -0.930731
theta = 21.451025
correlation = -0.930731
neg_adotb = 0.627474
theta = 128.864014
correlation = 0.627474
neg_adotb = 0.486190
theta = 240.909500
correlation = 0.486190
neg_adotb = 0.034357
theta = 91.968903
correlation = 0.034357
neg_adotb = -0.756540
theta = 40.839890
correlation = -0.756540
neg_adotb = -0.027154
theta = 88.444000
correlation = -0.027154
neg_adotb = -0.446383
theta = 296.511871
correlation = -0.446383
neg_adotb = -0.580410
theta = 54.520596
correlation = -0.580410
neg_adotb = 0.988030
theta = 171.125839
correlation = 0.988030
neg_adotb = 0.380612
theta = 112.371574
correlation = 0.380612
neg_adotb = -0.116122
theta = 83.331673
correlation = -0.116122
neg_adotb = -0.161629
theta = 80.698555
correlation = -0.161629
neg_adotb = 0.428098
theta = 244.653061
correlation = 0.428098
neg_adotb = -0.824326
theta = 325.520172
correlation = -0.824326
neg_adotb = -0.276965
theta = 286.079132
correlation = -0.276965
neg_adotb = 0.835168
theta = 146.633301
correlation = 0.835168
neg_adotb = 0.064757
theta = 266.287109
correlation = 0.064757
neg_adotb = 0.822519
theta = 214.662277
correlation = 0.822519
neg_adotb = -0.390839
theta = 293.006744
correlation = -0.390839
neg_adotb = -0.688184
theta = 46.513485
correlation = -0.688184
neg_adotb = 0.412694
theta = 114.374191
correlation = 0.412694
neg_adotb = 0.588540
theta = 233.946533
correlation = 0.588540
mean = -0.004767 + 0.004202*e2^e3 + -0.012679*e3^e1 + 0.000449*e1^e2
aveA = 0.011200
aveB = -0.011200
One can see that the correlations match -a.b exactly to 6 decimal places event by event. Scroll to the end and you will see the mean values and A and B averages.
.