Adding expectation values to a CHSH animation

Click For Summary

Discussion Overview

The discussion revolves around the CHSH experiment, specifically focusing on the calculation of expectation values for correlated photon detection and the implementation of these concepts in an animation. Participants explore the mathematical framework of the CHSH inequality and the coding aspects of simulating the experiment.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant shares an animation of the CHSH experiment and seeks assistance in calculating expectation values for the data presented.
  • Another participant explains the formula used for photon detection and its relation to the coincidence rate.
  • Several participants discuss the nature of the simulated photons, questioning whether they are independent or entangled, and clarify that the simulation uses qubits to represent polarization states.
  • There is a discussion about the implementation of functions within the simulation code, with participants seeking clarification on specific functions and their definitions.
  • One participant notes that the simulation's randomness does not reflect coincidence rates between two polarizers in a general sense, but matches in specific cases.

Areas of Agreement / Disagreement

Participants express differing views on the nature of the simulated photons and their entanglement, with no clear consensus reached on the interpretation of the simulation's mechanics or the implications of the formulas used.

Contextual Notes

Participants highlight potential misunderstandings regarding the entanglement of qubits in the simulation and the specific roles of variables in the code, indicating that the discussion involves nuanced technical details that remain unresolved.

Who May Find This Useful

This discussion may be of interest to those involved in quantum mechanics, particularly in the context of Bell's theorem and simulations of quantum experiments, as well as programmers looking to understand the implementation of quantum concepts in coding.

edguy99
Gold Member
Messages
449
Reaction score
28
An animation of the CHSH experiment to generate correlated photons is at: http://www.animatedphysics.com/games/photon_longdistance_chsh.htm

@georgir has a program to show the calculations using the formula for photon detection
return Math.random() < (Math.cos(r(p-a)*2)+1)/2;
yields the following for the coincident (same as the animation):

classic:
{
"0-22.5": {
"coincident": 1675,
"total": 2501,
"rate": 0.6697321071571372
},
"45-67.5": {
"coincident": 1671,
"total": 2468,
"rate": 0.6770664505672609
},
"45-22.5": {
"coincident": 1709,
"total": 2579,
"rate": 0.6626599457153936
},
"0-67.5": {
"coincident": 820,
"total": 2452,
"rate": 0.33442088091353994
}
}

I am looking for help in calculating the expectation values for the above data. I am interested in adding the expectation values into my animation. A brief explanation on how to do it I found at http://www.gutenberg.us/articles/CHSH_Bell_test:

Any help or checking would be appreciated.

The usual form of the CHSH inequality is:
(1) − 2 ≤ S ≤ 2,
where
(2) S = E(a, b) − E(a, b′) + E(a′, b) + E(ab′).

a and a′ are detector settings on side A, b and b′ on side B, the four combinations being tested in separate subexperiments. The terms E(a, b) etc. are the quantum correlations of the particle pairs, where the quantum correlation is defined to be the expectation value of the product of the "outcomes" of the experiment, i.e. the statistical average of A(aB(b), where A and B are the separate outcomes, using the coding +1 for the '+' channel and −1 for the '−' channel.
 
Physics news on Phys.org
edguy99 said:
@georgir has a program to show the calculations using the formula for photon detection
return Math.random() < (Math.cos(r(p-a)*2)+1)/2;

Math.random returns a chosen uniformly random value between 0 and 1. The expression Math.random() < p will evaluate to true with probability p. So the coincidence rate for that particular expression is exactly (Math.cos(r(p-a)*2)+1)/2.

You may be interested in viewing an interactive widget I made to simulate the CHSH test as part of a blog post, to get ideas. You can view it directly on jsfiddle, or in the blog post (with explanation of how to use it). Also you can edit it on jsfiddle. Here's a screenshot:

README_screenshot.png
 
Strilanc said:
Math.random returns a chosen uniformly random value between 0 and 1. The expression Math.random() < p will evaluate to true with probability p. So the coincidence rate for that particular expression is exactly (Math.cos(r(p-a)*2)+1)/2.

You may be interested in viewing an interactive widget I made to simulate the CHSH test as part of a blog post, to get ideas. You can view it directly on jsfiddle, or in the blog post (with explanation of how to use it). Also you can edit it on jsfiddle. Here's a screenshot:

Nice animation, nice to be able to insert javascript. Never used fiddle, but was able to copy to what I am used to using and am able to work with it. Two quick questions:
1/ Your "photons" are shot with 2 independent random polarizations, rather then being split from a common photon and both photons having the same Jones vector?
2/ I could not find the turn(x,90) or the measure() functions, maybe I am looking in the wrong file?

Thanks, I hope to have fun and let you know.
 
edguy99 said:
Nice animation, nice to be able to insert javascript. Never used fiddle, but was able to copy to what I am used to using and am able to work with it. Two quick questions:
1/ Your "photons" are shot with 2 independent random polarizations, rather then being split from a common photon and both photons having the same Jones vector?
2/ I could not find the turn(x,90) or the measure() functions, maybe I am looking in the wrong file?

Thanks, I hope to have fun and let you know.

It would be more accurate to say that my simulation has two polarizations than to say it has whole photons. Polarization is a 2-level quantum system, a qubit, and the post is framed in terms of qubits. The qubits are entangled to have agreeing value and phase, which corresponds roughly to saying two polarizations will agree both horizontally and diagonally (whichever one you check first).

The measure function is defined at line 217 of src/Engine/ChSh.js; it's just a simple wrapper around code in src/Engine/Superposition.js.

They're written inside strings instead of directly in the code because the widget uses web workers to avoid blocking the browser while running simulations. There's also some string interpolation happening to make escaping the sandbox a bit harder. Also it's not using any math libraries or anything, just direct twiddling of numbers inside a buffer. And the code on jsfiddle has been transpiled by traceur into ES5. So I'm not too surprised you had trouble finding the measure function.
 
Strilanc said:
It would be more accurate to say that my simulation has two polarizations than to say it has whole photons. Polarization is a 2-level quantum system, a qubit, and the post is framed in terms of qubits. The qubits are entangled to have agreeing value and phase, which corresponds roughly to saying two polarizations will agree both horizontally and diagonally (whichever one you check first).

The measure function is defined at line 217 of src/Engine/ChSh.js; it's just a simple wrapper around code in src/Engine/Superposition.js...

Thanks, I will have a look.

WRT to polarizations, perhaps I am miss-reading, but you assign var refChoice = Math.random() < 0.5; to Alice, then a second var refChoice = Math.random() < 0.5; to Bob, I don't see how these are entangled? Here's where I would assign the same Jones vector to both.
 
The entanglement is in the fake `sharedQubits` variable, which is only worked with indirectly via `measure` and `turn`. In the code the entangled state is stored as a list of 8 floats representing 4 complex amplitudes, and Alice and Bob's operations fiddle with the list in the way described by the postulates of QM.

The 'refChoice' variable is the referee's choice, not the entangled qubit. Each player gets an independent random referee bit. The CHSH game is for two isolated players to pick bits satisfying ##a \oplus b = x \land y##, where ##a, b## are the players' respective chosen bits and ##x, y## are random bits (chosen by referee to prevent cheating) fed respectively to each player once they're isolated (and ideally at the last possible moment, to close the signalling loophole).
 
Strilanc said:
It would be more accurate to say that my simulation has two polarizations than to say it has whole photons ...

I like the wiki quote at https://en.wikipedia.org/wiki/Qubit:

A qubit is a two-state quantum-mechanical system, such as the polarization of a single photon: here the two states are vertical polarization and horizontal polarization.
 
Strilanc said:
The expression Math.random() < p will evaluate to true with probability p. So the coincidence rate for that particular expression is exactly (Math.cos(r(p-a)*2)+1)/2.
A bit confusing, but this formula is only used for deciding if a single photon passes a certain polarizer. So it does not reflect coincidence rates between two polarizers in any way in general.
Certainly not in the 'classical' simulation. But it does match coincidence rates in the special case of the "qm" simulation where the photon gets changed by the first measurement.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 63 ·
3
Replies
63
Views
10K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 18 ·
Replies
18
Views
6K
  • · Replies 45 ·
2
Replies
45
Views
7K
Replies
79
Views
10K
  • · Replies 99 ·
4
Replies
99
Views
17K