This code performs a settable number of trials of a simulated Wigner-d'Espagnat Bell inequality experiment to test for violations at settable angles. It assumes a Stern-Gerlach type apparatus. The entangled particles used in this type of experiment would be spin 1/2 particles such as protons or electrons.
From "The New Physics for the Twenty-First Century" by Gordon Fraser(mostly quoted but I've made a few alterations):
"There are many mathematical formulations of the resulting Bell inequality. The simplest was first formulated by Eugene Wigner. For three arbitrary angles, A, B, and C, the following inequality must be satisfied: N(uA,dB') <= N(uA,dC') + N(uB,uC'). Here, for example, N(uA,uB') means the number of cases when the "up" detector in the Stern-Gerlach apparatus of particle 1 (unprimed) oriented along direction A registers simultaneously with the "up" detector of particle 2 (primed) with the Stern-Gerlach apparatus oriented along direction B."
In english this inequality says: "The number of men, uA, (as opposed to women) who have green eyes, dB', (as opposed to blue eyes) is not greater than the sum of the number of men who are tall, dC', (as opposed to short) plus the number of people with green eyes, uB, who are short, dC'. (Note: the primed quantities are the complements of the corresponding unprimed quantities. For example dB' (green eyes) == uB (green eyes).)
Quantum mechanics predicts that the spin orientations of singlet state (entangled) particle pairs measured at the two Stern-Gerlach detectors are correlated and depend on the angle |A - B| by which the orientations of the detectors differ:
Pqm(uA,uB) = (sin(|A-B|/2))^2, and Pqm(uA,dB) = 1-Pqm(uA,uB) (again adapted from "The New Physics for the Twenty-First Century" by Gordon Fraser). ("P", here, is the probability of a "spin up" detection, and "qm" is "according to quantum mechanics".) "Correlated" means that measuring a characteristic of one particle, say gender, influences the result of measuring another characteristic, say eye color, of the other particle.
"Local realistic" theories predict that these probabilities are
Plr(uB given uA) = 1 - |A-B|/pi and
Phv(dB given uA) = 1 - Plr(uB given uA), assuming a uniform random distribution of the spin orientation of the particle. (The "lr" is "according to local realistic theories".) Local realistic theories say that the results of measurements of characteristics of the two particles are independent of one another -- that measuring a characteristic of one particle, say gender, has no influence on the result of measuring another characteristic, say eye color, of the other particle.
Local realistic theories predict that Bell's inequality will be obeyed, quantum mechanics predicts it will be violated.
In this program, the angles are A (man) = 0 degrees, B (green eyes) = 30 degrees, and C (tall) = 60 degrees. Change them as you desire.
Bob Day (2021). BellsInequality.m (https://www.mathworks.com/matlabcentral/fileexchange/24455-bellsinequality-m), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!