To be written…
To be written…
# detach(data) ## Clean up from a previous R session (not needed here)
# rm(list = ls()) ## Clean up from a previous R session (not needed here)
# system("git pull") ## Do this in advance. Something goes wrong doing it here.
setwd("~/Documents/git/Eberhard/dist")
system("java -jar Simulation.jar")
I hope we now got to see the java output. No, it went to the console. I also failed in calling “git pull” from R, must remember to do it first of all.
I copy and paste it, instead. This is what it looks like today.
Please see the README.TXT for instructions
Date, Sun Jan 12 12:06:56 CET 2020
A1, 0.0, angle at detector A in degrees
A2, 45.0, angle at detector A in degrees
B1, -11.25, angle at detector B in degrees
B2, 11.25, angle at detector B in degrees
entanglementEfficiency, 0.7
Seed, 1234, the seed used in the random generator
Trials, 100000, the number of pairs that we have produced in total
Model, simulation.WangLHVModel, the name of the class that computes the measurement for a photon, an angle at a detector and a hidden variable
Inequality, simulation.CH, the name of the class that contains the inequality formula
Name, CH inequality, see https://www.slideshare.net/gill1109/yet-another-statistical-analysis-of-the-data-of-the-loophole-free-experiments-of-2015-revised
Formula, J = N11 – N12 + N21 + N22 - singleA(1) – singleB(2) <= 0
Explanation, if J >0 it agrees with QM and if J <= 0 it is a classical result
N11, 22691.0
N12, 22874.0
N21, 22822.0
N22, 22838.0
singleA(2) , 4407
singleB(1) , 0
J,41070.0
J/total,0.4107
% detected, 91.22%
Total count , 100000
Now we continue:
data <- read.csv("log.csv")
str(data)
## 'data.frame': 100000 obs. of 9 variables:
## $ Setting.A : int 1 1 0 0 1 0 0 1 0 1 ...
## $ Setting.B : int 0 0 0 0 0 0 0 0 1 1 ...
## $ Angle.A : num 45 45 0 0 45 0 0 45 0 45 ...
## $ Angle.B : num -11.2 -11.2 -11.2 -11.2 -11.2 ...
## $ Spin.A : int 0 1 1 0 0 1 1 1 1 0 ...
## $ Spin.B : int 0 1 1 0 -1 -1 1 1 1 1 ...
## $ A.Detected : int 1 1 1 1 1 1 1 1 1 1 ...
## $ B.Detected : int 1 1 1 1 0 0 1 1 1 1 ...
## $ Hidden.variable: num 171.24 82.48 36.7 111.12 2.86 ...
attach(data)
sum(A.Detected * B.Detected)
## [1] 91225
a <- Setting.A[(A.Detected * B.Detected) == 1] + 1
b <- Setting.B[(A.Detected * B.Detected) == 1] + 1
x <- 2 * Spin.A[(A.Detected * B.Detected) == 1] - 1
y <- 2 * Spin.B[(A.Detected * B.Detected) == 1] - 1
cor11 <- mean((x * y)[a == 1 & b == 1])
cor12 <- mean((x * y)[a == 1 & b == 2])
cor21 <- mean((x * y)[a == 2 & b == 1])
cor22 <- mean((x * y)[a == 2 & b == 2])
cor11; cor12; cor21; cor22
## [1] 0.8106738
## [1] 0.8092157
## [1] 0.2860398
## [1] 0.2941589
mean(x[a == 1 & b == 1]) - mean(x[a == 1 & b == 2])
## [1] -0.004029471
mean(x[a == 2 & b == 1]) - mean(x[a == 2 & b == 2])
## [1] 0.008300228
mean(y[a == 1 & b == 1]) - mean(y[a == 2 & b == 1])
## [1] -0.02070324
mean(y[a == 1 & b == 2]) - mean(y[a == 2 & b == 2])
## [1] 0.004744918
J <- sum((x == 1 & y == 1)[a == 1 & b == 1]) +
(- sum((x == 1 & y == -1)[a == 1 & b == 2])) +
(- sum((x == -1 & y == 1)[a == 2 & b == 1])) +
(- sum((x == 1 & y == 1)[a == 2 & b == 2]))
J ## Eberhard J, unnormalised
## [1] -2347
## Four different values of CHSH "S"
- cor11 + cor12 + cor21 + cor22 # compare cor11 to other three
## [1] 0.5787405
+ cor11 - cor12 + cor21 + cor22 # compare cor12 to other three
## [1] 0.5816568
+ cor11 + cor12 - cor21 + cor22 # compare cor21 to other three
## [1] 1.628009
+ cor11 + cor12 + cor21 - cor22 # compare cor22 to other three
## [1] 1.61177
A <- Setting.A + 1
B <- Setting.B + 1
X <- A.Detected * Spin.A
Y <- B.Detected * Spin.B
SA <- Spin.A
SB <- Spin.B
AD <- A.Detected
BD <- B.Detected
JJ <- mean((X == 1 & Y == 1) [A ==1 & B ==1]) +
(- mean((X == 1 & Y == 0)[A == 1 & B == 2])) +
(- mean((X == 0 & Y == 1)[A == 2 & B == 1])) +
(- mean((X == 1 & Y == 1)[A == 2 & B == 2]))
JJ ## Eberhard J, properly normalised
## [1] -0.1783274
CH <-sum(X == Y & AD & BD & A ==1 & B == 1) +
(- sum(X == Y & AD & BD & A ==1 & B == 2)) +
sum(X == Y & AD & BD & A == 2 & B == 1) +
sum(X == Y & AD & BD & A == 2 & B == 2) +
(- sum(X & A == 2) - sum(Y & B == 1))
CH ## Clauser Horne CH, unnormalised
## [1] -20824
CHnorm <-sum(X == Y & AD & BD & A ==1 & B == 1) / sum(AD & BD & A ==1 & B == 1) +
(- sum(X == Y & AD & BD & A ==1 & B == 2)) / sum(AD & BD & A ==1 & B == 2) +
sum(X == Y & AD & BD & A == 2 & B == 1) / sum(AD & BD & A == 2 & B == 1) +
sum(X == Y & AD & BD & A == 2 & B == 2) / sum(AD & BD & A == 2 & B == 2) +
(- sum(X & A == 2) / sum(AD & A == 2) - sum(Y & B == 1) / sum(BD & B == 1))
CHnorm # Clauser Horne CH, normalised
## [1] 0.2393156
save.image("~/Documents/git/Eberhard/dist/Untitled.RData")