Simulation of CHSH inequality experiment in Excel

In summary, the "Simulation of CHSH inequality experiment in Excel" demonstrates how to model and analyze the CHSH inequality, a fundamental concept in quantum mechanics and Bell's theorem, using Excel. The simulation allows users to generate random pairs of binary outcomes, calculate the CHSH parameter, and visualize results to understand the violation of classical correlations. By manipulating variables and repeating trials, one can observe the statistical properties of quantum entanglement and its implications for local realism.
  • #36
lostinmygarden said:
A photon that is mostly vertically aligned to a polarizer, will/should be detected as vertically polarized.
Not 100% of the time, no. For example, if you have photons coming out of one polarizer at an angle of 30 degrees, and they encounter a second polarizer at an angle of 0 degrees, not all of them will get through. That is what happens in actual experiments. Note that we are not talking here about pairs of entangled photons, just about single photons going through polarizers. If your model cannot reproduce the correct experimentally observed behavior for single photons going through polarizers, it is of no use in trying to simulate the behavior of entangled photon pairs.
 
  • Like
Likes PeroK
Physics news on Phys.org
  • #37
lostinmygarden said:
This is why detection on a single detector is 50%.
The probability of passing through a single polarizer will not always be 50%. It depends on how the photons are prepared and how the polarizer is aligned. If you are talking about "unpolarized" photons, then yes, the probability of passing through a single polarizer will be 50%, but that will be true for any angle of the polarizer, not just 0 degrees. And once photons have passed through one polarizer, they are no longer "unpolarized".
 
  • Like
Likes PeroK
  • #38
lostinmygarden said:
real world testing cannot actually detect both
It can if you use a polarizing beam splitter (where one output beam is H polarized and the other is V polarized) with detectors in each output beam.
 
  • #39
lostinmygarden said:
You may have quoted, but you are wrong in your conclusions.
What "conclusions"? I'm just pointing out things about what you have posted.

lostinmygarden said:
I clearly state measurement criteria in my document
And you also stated them clearly in posts in this thread. I suppose I am indeed making an assumption, that your posts in this thread accurately describe what is in your Excel document. Are you saying I should not be making that assumption?
 
  • #40
PeterDonis said:
Not 100% of the time, no. For example, if you have photons coming out of one polarizer at an angle of 30 degrees, and they encounter a second polarizer at an angle of 0 degrees, not all of them will get through. That is what happens in actual experiments. Note that we are not talking here about pairs of entangled photons, just about single photons going through polarizers. If your model cannot reproduce the correct experimentally observed behavior for single photons going through polarizers, it is of no use in trying to simulate the behavior of entangled photon pairs.
Again, you have not read my document. Experiments do not know polarization of photons. My test says these are determined at creation and generates results based on the criteria I have written. It may go against what you are saying, this is the point, it is another view. Doing what I suggest will generate S value that exceeds 2, around 50% of the time.
I do not really subscribe to this blocking of photons, that is, all would effectively pass through/ re-emitted (near 100%), but detection of these is 50%.
If you take my suggestions, then telhe simulation and my criteria wouls make more sense. It is not based off of the blocked/not blocked model.
 
  • #41
PeterDonis said:
What "conclusions"? I'm just pointing out things about what you have posted.


And you also stated them clearly in posts in this thread. I suppose I am indeed making an assumption, that your posts in this thread accurately describe what is in your Excel document. Are you saying I should not be making that assumption?
I will include the python code I have updated, if you would like to run it yourself.
Code:
import numpy as np
import pandas as pd

# Step 1: Create a list of 360 values with random angles between 0 and 89
# reducing from 359 to 89 for easier testing of detection
# reducing photons for easier readout
# NoOfPhotons must be a whole number when divided by 90
# photon angles are adjusted to make easier detection criteria.
# this adjustment does not impact detection results, they would be the same, regardless.
# ShowTests is either 1 (output test results) or 0 (just give a value)

NoOfPhotons = 720
photonAngles = 359
ShowTests = 1
L1 = round(NoOfPhotons/4)
L2 = L1 + L1
L3 = L2 + L1
L4 = L3 + L1

angles = np.random.randint(0, photonAngles, NoOfPhotons)

# Step 2: Add a random number between 0 and 1 to each angle
polarizations = angles + np.random.rand(NoOfPhotons)

# Step 3: Create a new column with the same value as the first column (entangled photons)
photon_pairs = pd.DataFrame({'Photon 1': polarizations, 'Photon 2': polarizations.copy()})

# Step 4: Divide the list into 4 separate lists
list_1 = photon_pairs.iloc[:L1]
list_2 = photon_pairs.iloc[L1:L2]
list_3 = photon_pairs.iloc[L2:L3]
list_4 = photon_pairs.iloc[L3:L4]

# Step 5: Detector combinations and angle thresholds for CHSH experiment
# A1 = 0°, A2 = 45°, B1 = 22.5°, B2 = 67.5°

def detector_response(photon_angle, detector_angle):
    """
    Function to simulate detector response
    """
    detectFrom = detector_angle-45
    detectTo = detector_angle+45
    ogPhotonAngle = photon_angle

    # fix photon_angle to fit measurement criteria 
    if photon_angle > 180:
        photon_angle = photon_angle-180
    if photon_angle > 90:
        photon_angle = 180-photon_angle

    if ShowTests == 1:
        print("unmodified photon angle: ", ogPhotonAngle)
        print("1. Photon: ",photon_angle)
        print("2. Detector angle: ",detector_angle)
        print("3. Detection range: ",detectFrom," to ",detectTo)
        print("4. Result: ",photon_angle % 360 <=detectTo and photon_angle % 360 >=detectFrom)
        print("")
    return photon_angle % 360<=detectTo and photon_angle % 360>=detectFrom


# Detector responses for each list
results_A1B1 = list_1.apply(lambda row: detector_response(row['Photon 1'], 0) == detector_response(row['Photon 2'], 22.5), axis=1)
results_A1B2 = list_2.apply(lambda row: detector_response(row['Photon 1'], 0) == detector_response(row['Photon 2'], 67.5), axis=1)
results_A2B1 = list_3.apply(lambda row: detector_response(row['Photon 1'], 45) == detector_response(row['Photon 2'], 22.5), axis=1)
results_A2B2 = list_4.apply(lambda row: detector_response(row['Photon 1'], 45) == detector_response(row['Photon 2'], 67.5), axis=1)

# Step 6: Calculate the S value using the standard CHSH formula
# S = |E(A1,B1) - E(A1,B2) + E(A2,B1) + E(A2,B2)|

def expectation_value(results):
    """
    Function to calculate the expectation value from the detector results.
    """
    return 2 * np.mean(results) - 1

E_A1B1 = expectation_value(results_A1B1)
E_A1B2 = expectation_value(results_A1B2)
E_A2B1 = expectation_value(results_A2B1)
E_A2B2 = expectation_value(results_A2B2)

S_value = abs(E_A1B1 - E_A1B2 + E_A2B1 + E_A2B2)
print("S value: ",S_value)
 
  • #42
lostinmygarden said:
Experiments do not know polarization of photons.
Um, what? Experimenters measure photon polarizations all the time.

lostinmygarden said:
I do not really subscribe to this blocking of photons
Again, what? It happens in experiments with photons and polarizers all the time.

At this point I simply can't make sense of what you are saying so I'll bow out and let someone else attempt it if they want to.
 
  • #43
PeterDonis said:
Um, what? Experimenters measure photon polarizations all the time.

At this point I simply can't make sense of what you are saying so I'll bow out and let someone else attempt it if they want to.
Please show me an experiment which tells you the exact polarization of a photon, prior to it being modified by a polarizer.
 
  • #44
lostinmygarden said:
Please show me an experiment which tells you the exact polarization of a photon, prior to it being modified by a polarizer.
PeterDonis said:
At this point I simply can't make sense of what you are saying so I'll bow out
Read what you quoted from me (which I just re-quoted above) again.
 
  • #45
lostinmygarden said:
Please show me an experiment which tells you the exact polarization of a photon, prior to it being modified by a polarizer.
And I mean the exact angle, not a yes/no answer
 
  • #46
PeterDonis said:
Read what you quoted from me (which I just re-quoted above) again.
Yes, I think it is a good time for you to do so.
 
  • #47
lostinmygarden said:
I appreciate any constructive feedback on this.
Two more things you may want to consider:

First, 1440 pairs may not be enough (and because of the issue below in fact you only have 360, repeated four times.) The simulation here (uses spin-1/2 particles and the original form of Bell's inequality, pedagogically better and experimentally worse than CHSH with photons) routinely finds inequality violations just from statistical variance across a thousand test cases. See how it works with, say 10,000 pairs.

Second, your input angles are not randomly distributed across the range from 0 to ##2\pi##, the distribution is too flat. It may be that this doesn't matter, but it is silly to develop a simulation with the wrong probability distribution and then develop an argument that it won't matter when you could use the right distribution from the start.
 
  • Like
Likes lostinmygarden
  • #48
Nugatory said:
Two more things you may want to consider:

First, 1440 pairs may not be enough (and because of the issue below in fact you only have 360, repeated four times.) The simulation here (uses spin-1/2 particles and the original form of Bell's inequality, pedagogically better and experimentally worse than CHSH with photons) routinely finds inequality violations just from statistical variance across a thousand test cases. See how it works with, say 10,000 pairs.

Second, your input angles are not randomly distributed across the range from 0 to ##2\pi##, the distribution is too flat. It may be that this doesn't matter, but it is silly to develop a simulation with the wrong probability distribution and then develop an argument that it won't matter when you could use the right distribution from the start.
Thanks. Yes, I didn't go too large in excel as it doesn't like it much. It gives the general idea, but it is limited. I will try my python equivalent. I wasn't intending on using python, but I have made it scalable. I'll ensure it just generates a random distribution too.
 
  • #49
Nugatory said:
Two more things you may want to consider:

First, 1440 pairs may not be enough (and because of the issue below in fact you only have 360, repeated four times.) The simulation here (uses spin-1/2 particles and the original form of Bell's inequality, pedagogically better and experimentally worse than CHSH with photons) routinely finds inequality violations just from statistical variance across a thousand test cases. See how it works with, say 10,000 pairs.

Second, your input angles are not randomly distributed across the range from 0 to ##2\pi##, the distribution is too flat. It may be that this doesn't matter, but it is silly to develop a simulation with the wrong probability distribution and then develop an argument that it won't matter when you could use the right distribution from the start.
The code randomly generates angles between 0 and 359, then adds a random number between 0 and 1. This is to ensure values are between 0 and 360, also ensures that angles can vary, very slightly. It does this for each photon generated.

I ran with 10800 photons in python and on first run got S = 2.0370370370370368. This can always vary, as does real world testing results.
 
  • #50
lostinmygarden said:
I will try my python equivalent.
Python will minimize another concern, namely the quality of the random number generator, but still sanity check your generated data and that the raw measurement results pass minimal sanity tests.
And to avoid possible floating point arithmetic artifacts do everything from the start in radians.
 
  • Like
Likes lostinmygarden
  • #51
Nugatory said:
Python will minimize another concern, namely the quality of the random number generator, but still sanity check your generated data and that the raw measurement results pass minimal sanity tests.
And to avoid possible floating point arithmetic artifacts do everything from the start in radians.
I have added a flag to enable and disable test output. The logic passes sanity checks.
Nugatory said:
Python will minimize another concern, namely the quality of the random number generator, but still sanity check your generated data and that the raw measurement results pass minimal sanity tests.
And to avoid possible floating point arithmetic artifacts do everything from the start in radians.
There is a flag to enable and disable test output. The logic passes sanity checks. I'll look into adapting this to radians too. Pass my bedtime here now. Thank you for your feedback ☺️
 
  • #52
Nugatory said:
Python will minimize another concern, namely the quality of the random number generator, but still sanity check your generated data and that the raw measurement results pass minimal sanity tests.
And to avoid possible floating point arithmetic artifacts do everything from the start in radians.
I have added a flag to enable and disable test output. The logic passes sanity checks.
lostinmygarden said:
TL;DR Summary: I have tried to create a simulation of CHSH experiment in Excel. I am assuming photons have a set polarization after creation and the entangled pairs have the same polarization. I would like feedback on this.

I would like reviews of the CHSH inequality experiment simulation, that I have created in excel.

This is an open share, you can access anonymously in a private browser session.

https://1drv.ms/x/s!Arfr_5NFNXw8aPC38X3LUGQI7oU?e=hDQTof

The simulation follows setup as per those listed here -

https://en.m.wikipedia.org/wiki/CHSH_inequality

My simulation is set to test photons with fixed polarization after creation, also the entangled photons would have identical polarization. This is a Local hidden variables simulation.

In running this simulation, CHSH values for S can exceed 2 around 50% of the time, as per real world tests (in real world tests, false negatives and positives suggest that this can impact results, these of course are not possible in the simulation).

The simulation creates 1440 (2880 if you account for the partner photon that is identical) photons with random polarization angles between 0 and 360, ensuring an even distribution. 360 was chosen for ease of measurements; for example, 45 degree polarization is detected the same as 225 degrees, as they have the same polarization.

These photons are then randomly ordered and assigned for measurement, evenly, across the 4 detector combinations (a,b a1,b a,b1 a1,b1), ensuring photons from the ones created, are only measured once.

I was under the impression that if you assume fixed polarization prior to measurement (LHV), then simulations cannot achieve value S>2.

My thinking here is that, due to the combination of separate measurements for detector combinations, can lead to a result where value S>2.

This is an early version of my test simulation in excel (it works well for it and it is quite visual, in that you can see how everything is set up and where results come from. Hopefully not many errors in it, if so, I will correct them following feedback from here).

I appreciate any constructive feedback on this.

Thanks

This isPython code to simulate same as excel document, with some adjustments.
S value can be achieved around 50% of the time, simply re-run simulation.

In this code, you can amend NoOfPhotons to create a set amount of randomly generated photon pairs (given by their polarization).
ShowTests will output the results of individual photons measurements when set to 1, otherwise just S value will be given.

Code:
import numpy as np
import pandas as pd

# NoOfPhotons must be a whole number when divided by 90

NoOfPhotons = 720
photonAngles = 359
ShowTests = 1
L1 = round(NoOfPhotons/4)
L2 = L1 + L1
L3 = L2 + L1
L4 = L3 + L1

angles = np.random.randint(0, photonAngles, NoOfPhotons)

# Step 2: Add a random number between 0 and 1 to each angle
polarizations = angles + np.random.rand(NoOfPhotons)

# Step 3: Create a new column with the same value as the first column (entangled photons)
photon_pairs = pd.DataFrame({'Photon 1': polarizations, 'Photon 2': polarizations.copy()})

# Step 4: Divide the list into 4 separate lists
list_1 = photon_pairs.iloc[:L1]
list_2 = photon_pairs.iloc[L1:L2]
list_3 = photon_pairs.iloc[L2:L3]
list_4 = photon_pairs.iloc[L3:L4]

# Step 5: Detector combinations and angle thresholds for CHSH experiment
# A1 = 0°, A2 = 45°, B1 = 22.5°, B2 = 67.5°

def detector_response(photon_angle, detector_angle):
    """
    Function to simulate detector response
    """
    detectFrom = detector_angle-45
    detectTo = detector_angle+45
    ogPhotonAngle = photon_angle

    # fix photon_angle to fit measurement criteria 
    if photon_angle > 180:
        photon_angle = photon_angle-180
    if photon_angle > 90:
        photon_angle = 180-photon_angle

    if ShowTests == 1:
        print("unmodified photon angle: ", ogPhotonAngle)
        print("1. Photon: ",photon_angle)
        print("2. Detector angle: ",detector_angle)
        print("3. Detection range: ",detectFrom," to ",detectTo)
        print("4. Result: ",photon_angle % 360 <=detectTo and photon_angle % 360 >=detectFrom)
        print("")
    return photon_angle % 360<=detectTo and photon_angle % 360>=detectFrom


# Detector responses for each list
results_A1B1 = list_1.apply(lambda row: detector_response(row['Photon 1'], 0) == detector_response(row['Photon 2'], 22.5), axis=1)
results_A1B2 = list_2.apply(lambda row: detector_response(row['Photon 1'], 0) == detector_response(row['Photon 2'], 67.5), axis=1)
results_A2B1 = list_3.apply(lambda row: detector_response(row['Photon 1'], 45) == detector_response(row['Photon 2'], 22.5), axis=1)
results_A2B2 = list_4.apply(lambda row: detector_response(row['Photon 1'], 45) == detector_response(row['Photon 2'], 67.5), axis=1)

# Step 6: Calculate the S value using the standard CHSH formula
# S = |E(A1,B1) - E(A1,B2) + E(A2,B1) + E(A2,B2)|

def expectation_value(results):
    """
    Function to calculate the expectation value from the detector results.
    """
    return 2 * np.mean(results) - 1

E_A1B1 = expectation_value(results_A1B1)
E_A1B2 = expectation_value(results_A1B2)
E_A2B1 = expectation_value(results_A2B1)
E_A2B2 = expectation_value(results_A2B2)

S_value = abs(E_A1B1 - E_A1B2 + E_A2B1 + E_A2B2)
print("S value: ",S_value)
 
  • #53
lostinmygarden said:
Again, you have not read my document. Experiments do not know polarization of photons. My test says these are determined at creation and generates results based on the criteria I have written. It may go against what you are saying, this is the point, it is another view. Doing what I suggest will generate S value that exceeds 2, around 50% of the time.
I do not really subscribe to this blocking of photons, that is, all would effectively pass through/ re-emitted (near 100%), but detection of these is 50%.
If you take my suggestions, then telhe simulation and my criteria wouls make more sense. It is not based off of the blocked/not blocked model.
Bell's theorem proves mathematically that this cannot reproduce the predictions of QM. Your model must be wrong in some way.
 
  • Like
Likes DrChinese and Lord Jestocost
  • #54
Nugatory said:
Python will minimize another concern, namely the quality of the random number generator, but still sanity check your generated data and that the raw measurement results pass minimal sanity tests.
And to avoid possible floating point arithmetic artifacts do everything from the start in radians.
I have added a flag to enable and disable test output. The logic passes sanity checks.
lostinmygarden said:
TL;DR Summary: I have tried to create a simulation of CHSH experiment in Excel. I am assuming photons have a set polarization after creation and the entangled pairs have the same polarization. I would like feedback on this.

I would like reviews of the CHSH inequality experiment simulation, that I have created in excel.

This is an open share, you can access anonymously in a private browser session.

https://1drv.ms/x/s!Arfr_5NFNXw8aPC38X3LUGQI7oU?e=hDQTof

The simulation follows setup as per those listed here -

https://en.m.wikipedia.org/wiki/CHSH_inequality

My simulation is set to test photons with fixed polarization after creation, also the entangled photons would have identical polarization. This is a Local hidden variables simulation.

In running this simulation, CHSH values for S can exceed 2 around 50% of the time, as per real world tests (in real world tests, false negatives and positives suggest that this can impact results, these of course are not possible in the simulation).

The simulation creates 1440 (2880 if you account for the partner photon that is identical) photons with random polarization angles between 0 and 360, ensuring an even distribution. 360 was chosen for ease of measurements; for example, 45 degree polarization is detected the same as 225 degrees, as they have the same polarization.

These photons are then randomly ordered and assigned for measurement, evenly, across the 4 detector combinations (a,b a1,b a,b1 a1,b1), ensuring photons from the ones created, are only measured once.

I was under the impression that if you assume fixed polarization prior to measurement (LHV), then simulations cannot achieve value S>2.

My thinking here is that, due to the combination of separate measurements for detector combinations, can lead to a result where value S>2.

This is an early version of my test simulation in excel (it works well for it and it is quite visual, in that you can see how everything is set up and where results come from. Hopefully not many errors in it, if so, I will correct them following feedback from here).

I appreciate any constructive feedback on this.

Thanks

This isPython code to simulate same as excel document, with some adjustments.
S value can be achieved around 50% of the time, simply re-run simulation.
In this code, you can amend NoOfPhotons to create a set amount of randomly generated photon pairs (given by their polarization).
ShowTests will output the results of individual photons measurements when set to 1, otherwise just S value will be given.

Code:
import numpy as np
import pandas as pd

# NoOfPhotons must be a whole number when divided by 90

NoOfPhotons = 720
photonAngles = 359
ShowTests = 1
L1 = round(NoOfPhotons/4)
L2 = L1 + L1
L3 = L2 + L1
L4 = L3 + L1

angles = np.random.randint(0, photonAngles, NoOfPhotons)

# Step 2: Add a random number between 0 and 1 to each angle
polarizations = angles + np.random.rand(NoOfPhotons)

# Step 3: Create a new column with the same value as the first column (entangled photons)
photon_pairs = pd.DataFrame({'Photon 1': polarizations, 'Photon 2': polarizations.copy()})

# Step 4: Divide the list into 4 separate lists
list_1 = photon_pairs.iloc[:L1]
list_2 = photon_pairs.iloc[L1:L2]
list_3 = photon_pairs.iloc[L2:L3]
list_4 = photon_pairs.iloc[L3:L4]

# Step 5: Detector combinations and angle thresholds for CHSH experiment
# A1 = 0°, A2 = 45°, B1 = 22.5°, B2 = 67.5°

def detector_response(photon_angle, detector_angle):
    """
    Function to simulate detector response
    """
    detectFrom = detector_angle-45
    detectTo = detector_angle+45
    ogPhotonAngle = photon_angle

    # fix photon_angle to fit measurement criteria
    if photon_angle > 180:
        photon_angle = photon_angle-180
    if photon_angle > 90:
        photon_angle = 180-photon_angle

    if ShowTests == 1:
        print("unmodified photon angle: ", ogPhotonAngle)
        print("1. Photon: ",photon_angle)
        print("2. Detector angle: ",detector_angle)
        print("3. Detection range: ",detectFrom," to ",detectTo)
        print("4. Result: ",photon_angle % 360 <=detectTo and photon_angle % 360 >=detectFrom)
        print("")
    return photon_angle % 360<=detectTo and photon_angle % 360>=detectFrom


# Detector responses for each list
results_A1B1 = list_1.apply(lambda row: detector_response(row['Photon 1'], 0) == detector_response(row['Photon 2'], 22.5), axis=1)
results_A1B2 = list_2.apply(lambda row: detector_response(row['Photon 1'], 0) == detector_response(row['Photon 2'], 67.5), axis=1)
results_A2B1 = list_3.apply(lambda row: detector_response(row['Photon 1'], 45) == detector_response(row['Photon 2'], 22.5), axis=1)
results_A2B2 = list_4.apply(lambda row: detector_response(row['Photon 1'], 45) == detector_response(row['Photon 2'], 67.5), axis=1)

# Step 6: Calculate the S value using the standard CHSH formula
# S = |E(A1,B1) - E(A1,B2) + E(A2,B1) + E(A2,B2)|

def expectation_value(results):
    """
    Function to calculate the expectation value from the detector results.
    """
    return 2 * np.mean(results) - 1

E_A1B1 = expectation_value(results_A1B1)
E_A1B2 = expectation_value(results_A1B2)
E_A2B1 = expectation_value(results_A2B1)
E_A2B2 = expectation_value(results_A2B2)

S_value = abs(E_A1B1 - E_A1B2 + E_A2B1 + E_A2B2)
print("S value: ",S_value)
PeroK said:
Bell's theorem proves mathematically that this cannot reproduce the predictions of QM. Your model must be wrong in some way.
If you run a single list against all detector combinations, you reach the S=2 value, constantly. This is supposedly the LHV limit and probably derived from that thinking. The tests that show S>2 are all independent, separate tests, that are combined at the end. This seemingly allows S>2. My approach gives photons definitive polarization at creation and detection is set within boundaries that would be typical for vertical and horizontal detection. There certainly could be mistakes, but the math is relatively simple as you can see in the code. Th excel document is more visual and contains, essentially, the same calculations.
 
  • #56
lostinmygarden said:
There certainly could be mistakes
I added one of the sanity tests suggested in post #14:
Code:
raw = {0.0:[0,0,0], 22.5:[0,0,0], 45.0:[0,0,0], 67.5:[0,0,0]}
.................
def detector_response(photon_angle, detector_angle):
    ........
    r = photon_angle % 360<=detectTo and photon_angle % 360>=detectFrom
    if r:
      raw[detector_angle][0] += 1
    else:
      raw[detector_angle][1] += 1
    raw[detector_angle][2] += 1
    return r
...........
S_value = abs(E_A1B1 - E_A1B2 + E_A2B1 + E_A2B2)
print("S value: ",S_value)

print(raw)
to get the output
Code:
python orig
S value:  1.9555555555555557
{0.0: [189, 171, 360], 22.5 :[286, 74, 360], 45.0: [360, 0, 360], 67.5: [265, 95, 360]}
so something seems wrong with either the data distribution or the detector_response function.

I am also somewhat perplexed by the definition of the expectation_value function. Why not do the calculation directly from the simulated results as is usually done:$$E=\frac{N_{++}+N_{+-}-N_{-+}+N_{--}}{N_{++}+N_{+-}+N_{-+}+N_{--}}$$
 
  • #57
Nugatory said:
I added one of the sanity tests suggested in post #14:
Code:
raw = {0.0:[0,0,0], 22.5:[0,0,0], 45.0:[0,0,0], 67.5:[0,0,0]}
.................
def detector_response(photon_angle, detector_angle):
    ........
    r = photon_angle % 360<=detectTo and photon_angle % 360>=detectFrom
    if r:
      raw[detector_angle][0] += 1
    else:
      raw[detector_angle][1] += 1
    raw[detector_angle][2] += 1
    return r
...........
S_value = abs(E_A1B1 - E_A1B2 + E_A2B1 + E_A2B2)
print("S value: ",S_value)

print(raw)
to get the output
Code:
python orig
S value:  1.9555555555555557
{0.0: [189, 171, 360], 22.5 :[286, 74, 360], 45.0: [360, 0, 360], 67.5: [265, 95, 360]}
so something seems wrong with either the data distribution or the detector_response function.

I am also somewhat perplexed by the definition of the expectation_value function. Why not do the calculation directly from the simulated results as is usually done:$$E=\frac{N_{++}+N_{+-}-N_{-+}+N_{--}}{N_{++}+N_{+-}+N_{-+}+N_{--}}$$
Feel free to make amendments, I really appreciate it. I haven't done programming in years, so bit slow. If you enable the output of test data, you will see how it handles the angles and how it checks if detected or not.
I'm probably not going to be able to do much this evening, but will try and recreate it another way.
 
  • #58
lostinmygarden said:
but will try and recreate it another way.
Your best bet may be to discard the current implementation - which looks as if it is an attempt to apply a spreadsheet model to a problem for which it is grossly unsuited - and start over from scratch. Something along the lines of
Code:
for each of four combinations of angles (two at A, two at B)
  for however many trials you want:
    randomly generate an angle between zero and 2pi
    apply the detector function at both sides  to that angle to get one of ++,+-,-+,--
    update counter corresponding to result
 calculate E value for that combination from counters
Calculate S value from E values
will be way easier to understand and to instrument, and will avoid the silly problem with the input distribution and the sillier problem with the current detector function.
 
  • Like
Likes Vanadium 50 and berkeman
  • #59
Nugatory said:
Your best bet may be to discard the current implementation - which looks as if it is an attempt to apply a spreadsheet model to a problem for which it is grossly unsuited - and start over from scratch. Something along the lines of
Code:
for each of four combinations of angles (two at A, two at B)
  for however many trials you want:
    randomly generate an angle between zero and 2pi
    apply the detector function at both sides  to that angle to get one of ++,+-,-+,--
    update counter corresponding to result
 calculate E value for that combination from counters
Calculate S value from E values
will be way easier to understand and to instrument, and will avoid the silly problem with the input distribution and the sillier problem with the current detector function.
I updated the python code to extract data necessary to calculate E, these results are identical to the current method. So that was good to see. I think it was too obscure, so can't be broken out to make more sense.

As for updating the current processes, the angle recalculation is messy, but works. Definitely needs a tidy up. The code was a rush job.
Totally agree it needs a tidy up and genuinely, thank you for taking your time on this. I'll hopefully revisit it tomorrow and bring something improved back to show.
And yes, it was a hack job to fit the excel version, good eye :)
 
  • #60
lostinmygarden said:
My approach gives photons definitive polarization at creation and detection is set within boundaries that would be typical for vertical and horizontal detection. There certainly could be mistakes, but the math is relatively simple as you can see in the code. Th excel document is more visual and contains, essentially, the same calculations.
You don't need any code to see how far off your concept is. And the usage of the CHSH just covers up the issues by making the problems unnecessarily complicated. Some of your key hypotheses are:

i) That there is a predetermined polarization for entangled photons when they are created. (Of course, simply following the Bell argument should be enough to convince you this cannot be correct - that specific scenario is discussed.)
ii) That if a polarizer is set within 45 degrees of that value, the photon will pass through it 100% of the time (you do that to get the perfect correlations, see for example Nugatory's post #14 and your response in #15).

But hey, let's analyze this as it pertains to your specific approach.

a) Your entangled pairs produce 100% correlation at any identical angle. You satisfy this experimental requirement.
b) Photons produced by PDC pass through a polarizer if they within 45 degrees of the orientation value at creation. Oops! That is known to be false!

A single Type I PDC crystal produces pairs of entangled photons at KNOWN angles. And those photons do NOT all go through a polarizer set at any different angle, regardless of whether it is within 45 degrees or not. Instead, they pass through at the usual cos^2(theta) formula. That is completely in opposition to your b).

Note that these photons are entangled, but they are NOT polarization entangled. To get polarization entanglement, you need TWO such crystals oriented 90 degrees apart and placed very close together. By your logic, the output photons must come from one or the other of the two crystals. Either one individually ONLY produces pairs that fail your test. Keep in mind that these photons (from either crystal alone) are entangled, just not polarization entangled. So why would you need two crystals to cause them to become polarization entangled when they were already entangled on all other bases?

The answer is strictly quantum: The polarization entanglement comes from them being indistinguishable as to which of the two is the source crystal. This quantum element cannot properly be represented in any code. Your code will always produce the wrong results when you attempt to model a single Type I crystal output (making it compatible with experiment) and then attempting to model two Type I crystals as I described. Here is a link to a full description of Type I crystals (theory and experiment), which are used in about half of all entanglement experiments. (Note that Type II crystals, while seemingly avoiding this issue, actually exhibit an exactly identical problem. But explaining why is more complicated.)

Ultra-bright source of polarization-entangled photons (Kwiat et al, 1998)

If you cannot model the quantum element of indistinguishability*, which determines whether polarization entanglement occurs, your entire premise fails. Good luck modeling the real world!


*And in fact every single source of quantum entangled particles includes this critical requirement. It is actually possible to intentionally vary the amount of indistinguishability from 100% down to 0%, and the resulting spin/polarization entanglement varies precisely along with it. If your concept were correct, once the photon pair is created (from the mother photon), it already has a specific angle for each of the daughter photons.
 
  • Informative
  • Like
Likes Vanadium 50, PeroK, Lord Jestocost and 1 other person
  • #61
DrChinese said:
You don't need any code to see how far off your concept is. And the usage of the CHSH just covers up the issues by making the problems unnecessarily complicated. Some of your key hypotheses are:

i) That there is a predetermined polarization for entangled photons when they are created. (Of course, simply following the Bell argument should be enough to convince you this cannot be correct - that specific scenario is discussed.)
ii) That if a polarizer is set within 45 degrees of that value, the photon will pass through it 100% of the time (you do that to get the perfect correlations, see for example Nugatory's post #14 and your response in #15).

But hey, let's analyze this as it pertains to your specific approach.

a) Your entangled pairs produce 100% correlation at any identical angle. You satisfy this experimental requirement.
b) Photons produced by PDC pass through a polarizer if they within 45 degrees of the orientation value at creation. Oops! That is known to be false!

A single Type I PDC crystal produces pairs of entangled photons at KNOWN angles. And those photons do NOT all go through a polarizer set at any different angle, regardless of whether it is within 45 degrees or not. Instead, they pass through at the usual cos^2(theta) formula. That is completely in opposition to your b).

Note that these photons are entangled, but they are NOT polarization entangled. To get polarization entanglement, you need TWO such crystals oriented 90 degrees apart and placed very close together. By your logic, the output photons must come from one or the other of the two crystals. Either one individually ONLY produces pairs that fail your test. Keep in mind that these photons (from either crystal alone) are entangled, just not polarization entangled. So why would you need two crystals to cause them to become polarization entangled when they were already entangled on all other bases?

The answer is strictly quantum: The polarization entanglement comes from them being indistinguishable as to which of the two is the source crystal. This quantum element cannot properly be represented in any code. Your code will always produce the wrong results when you attempt to model a single Type I crystal output (making it compatible with experiment) and then attempting to model two Type I crystals as I described. Here is a link to a full description of Type I crystals (theory and experiment), which are used in about half of all entanglement experiments. (Note that Type II crystals, while seemingly avoiding this issue, actually exhibit an exactly identical problem. But explaining why is more complicated.)

Ultra-bright source of polarization-entangled photons (Kwiat et al, 1998)

If you cannot model the quantum element of indistinguishability*, which determines whether polarization entanglement occurs, your entire premise fails. Good luck modeling the real world!


*And in fact every single source of quantum entangled particles includes this critical requirement. It is actually possible to intentionally vary the amount of indistinguishability from 100% down to 0%, and the resulting spin/polarization entanglement varies precisely along with it. If your concept were correct, once the photon pair is created (from the mother photon), it already has a specific angle for each of the daughter photons.
Hi. It is important to note, I am suggesting something different to what you understand to be correct. This is the point of the simulation. What if......?

Aren't photons, that are created with entangled polarizations, correlated? So they either have the same or opposite polarization? My simulation is for same polarization.

They are randomly generated photon pairs (angles) and just a copy of each other, 1 sent to each detector for measurement.

In Clauser-Horne-Shimony-Holt (chsh) experiments, isn't polarization entanglement mostly used? And it's it mostly same polarization? This is what I have read thus far and using as a basis for this. The correlation is the important part.

With regards to the version of single photon detection I mentioned, take a look here -

https://demonstrations.wolfram.com/AModelForPhotonPolarizationAndDetection/

This relates to single photon detection with +-45 degrees from a detector polarizer angle.

And so, making the assumptions I have made, for the purpose of the simulation; Why would the simulation produce similar end results as real-world tests? It wasn't necessarily aiming to do, but it has with those two assumptions made earlier.

You raised some other items which are out of scope for my post. Hope you understand.

Thanks for your comment.
 
  • Skeptical
Likes Motore
  • #62
lostinmygarden said:
Hi. It is important to note, I am suggesting something different to what you understand to be correct. This is the point of the simulation. What if......?
Perhaps I have misunderstood. When I read the opening post of this thread it seemed that you had a simulation that seemed to show a hidden variable model that violated the CHSH inequality and wanted feedback on it. We all agree that the simulation has to be wrong somehow (compare with someone asking for feedback on their perpetual motion machine - the question isn't whether they've invented a PMM, it's where the mistake is).
Aren't photons, that are created with entangled polarizations, correlated?
Yes, but...
So they either have the same or opposite polarization?
No. The correlation tells us that if we measure one member of the pair on a given axis we know what the result will be if and when we measure the polarization of the other member on the same axis. Bell's Theorem and the CHSH inequality show that this is not the same thing as "them having the same or opposite polarization"; that's the whole point of the observed violations of the inequalities.
They are randomly generated photon pairs (angles) and just a copy of each other, 1 sent to each detector for measurement.
The pairs in your simulation are not randomly distributed, that is obvious from inspection of the source code (both python and excel) and was pointed out in post #47. And the fact that the plus and minus counts are not roughly the same across both detectors at both angles (the sanity test suggested in post #14 that you ignored so that I had to do it for you) shows that there is something bad wrong in the internal logic of your simulation.
In Clauser-Horne-Shimony-Holt (chsh) experiments, isn't polarization entanglement mostly used? And it's it mostly same polarization? This is what I have read thus far and using as a basis for this. The correlation is the important part.
Yes, these experiments are all based on polarization entanglement. The problem is that your simulation does not accurately model the observed behavior.
I have an old CHSH simulation somewhere back in my cyber boneyard and I'll post the code for you in a while if I can find it.

There are several reliable sources that you might want to look into. You're arguing with @DrChinese so you will want to check out his website on Bell's Theorem - read and understand(!) the linked papers. Read this Scientific American article. Try rewriting your simulation to make it accurate and see whether you can find any way of tweaking the state assignments so that the inequality is violated. Until you have done this, the thread is closed.
 
  • Like
Likes berkeman, Doc Al, Motore and 4 others
Back
Top