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;

return normalize(v);

}

batch test()

{

set_window_title("Test of Joy Christian's arXiv:1103.1879 paper");

N=20000; //number of iterations (trials)

I=e1^e2^e3;

s=0;

a=getRandomUnitVector();

b=getRandomUnitVector();

minus_cos_a_b=-1*(a.b);

for(nn=0;nn<N;nn=nn+1) //perform the experiment N times

{

lambda=getRandomLambda(); //lambda is a fair coin,

//resulting in +1 or -1

mu=lambda * I; //calculate the lambda dependent mu

C=-I.a; //C = {-a_j B_j}

D=I.b; //D = {b_k B_k}

E=mu.a; //E = {a_k B_k(L)}

F=mu.b; //F = {b_j B_j(L)}

A=C E; //eq. (1) of arXiv:1103.1879, A(a, L) = {-a_j B_j}{a_k B_k(L)}

B=F D; //eq. (2) of arXiv:1103.1879, B(b, L) = {b_j B_j(L)}{b_k B_k}

q=0;

if(lambda==1) {q=((-C) A B (-D));} else {q=((-D) B A (-C));} //eq. (6)

s=s+q; //summation of all terms.

}

mean_mu_a_mu_b=s/N;

print(mean_mu_a_mu_b); //print the result

print(minus_cos_a_b);

prompt();

}

//Typical result is:

//mean_mu_a_mu_b = 0.87 + 0.00*e2^e3 + 0.00*e3^e1 + 0.00*e1^e2

//minus_cos_a_b = 0.87

//The scalar parts match and others vanish! Proving the result is -a.b.

//Thus Dr. Christian's arXiv:1103.1879 paper is a classical local

//realistic counter-example that in fact contradicts Bell's theorem.

And equation (6).

What the "if else" line does for eq. (6) is to correct for GAViewer being in a fixed right handed bivector basis. And is also Joy's main physics' postulate. When lambda = 1, the particle pairs are in the right handed basis; when lambda = -1 (else), they are in the left handed basis. What do you see when looking at a left handed system from a right handed only perspective? The geometric order is reversed. Very simple.

More explanations for the GAViewer program and Joy's model can be found in previous threads on this blog.

And for further reading you may find some of the key papers by Joy at this
link: http://arxiv.org/find/all/1/au:+Christian_Joy/0/1/0/all/0/1.

Best regards,

Fred Diether

PS. Have a good day and have much fun!

#### Update 22-5-15:

G=

So the result now includes the scalar part that represents

Michel Fodje has translated the above GAViewer code to Python so here it is:

from __future__ import division

import numpy

from clifford import *

layout, blades = Cl(3,0)

e0, e1, e2 = [blades['e%i'%k] for k in range(3)]

I = (e0^e1^e2)

def randVec3d(lo=0, hi=2*numpy.pi):

theta = numpy.random.uniform(lo, hi)

z = numpy.random.uniform(-1, 1)

sn = numpy.sqrt(1-z**2)

y = sn*numpy.sin(theta)

x = sn*numpy.cos(theta)

return (x^e0) + (y^e1) + (z^e2)

N = 20000

s = 0

a = randVec3d()

b = randVec3d()

for i in range(N):

L = numpy.random.choice([-1., 1.])

mu = L&I

C = (-I)*a

D = I*b

E = mu*a

F = mu*b

A = C&E

B = F&D

q = ((-C)&A&B&(-D)) if L == 1 else ((-D)&B&A&(-C))

s = s+q

print s^(1./N)

print -(a*b)

# Typical Run

#

# 0.44353 - (0.00776^e01) - (0.0068^e02) + (0.00131^e12) # Model

# 0.44353 # -a.b

**a.b**was taken out of the script above as it has been pointed out to me that since**a**and**b**have the same values for each iteration in the loop there is no advantage to doing that part in the process.So the result now includes the scalar part that represents

**-a.b**and now we have added the result for the scalar part in the next line so that one can see that they match.Michel Fodje has translated the above GAViewer code to Python so here it is:

from __future__ import division

import numpy

from clifford import *

layout, blades = Cl(3,0)

e0, e1, e2 = [blades['e%i'%k] for k in range(3)]

I = (e0^e1^e2)

def randVec3d(lo=0, hi=2*numpy.pi):

theta = numpy.random.uniform(lo, hi)

z = numpy.random.uniform(-1, 1)

sn = numpy.sqrt(1-z**2)

y = sn*numpy.sin(theta)

x = sn*numpy.cos(theta)

return (x^e0) + (y^e1) + (z^e2)

N = 20000

s = 0

a = randVec3d()

b = randVec3d()

for i in range(N):

L = numpy.random.choice([-1., 1.])

mu = L&I

C = (-I)*a

D = I*b

E = mu*a

F = mu*b

A = C&E

B = F&D

q = ((-C)&A&B&(-D)) if L == 1 else ((-D)&B&A&(-C))

s = s+q

print s^(1./N)

print -(a*b)

# Typical Run

#

# 0.44353 - (0.00776^e01) - (0.0068^e02) + (0.00131^e12) # Model

# 0.44353 # -a.b