Advertisement
chemoelectric

Bell test snippet (Monte Carlo)

Sep 19th, 2023
1,507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | Source Code | 0 0
  1. class Photon(Enum):
  2.     HORIZONTAL = 1
  3.     VERTICAL = 2
  4.  
  5. class Detector(Enum):
  6.     PLUS = 1
  7.     MINUS = 2
  8.  
  9. ...
  10.  
  11.         σ1 = (Photon.HORIZONTAL if random() < 0.5
  12.               else Photon.VERTICAL)
  13.         σ2 = (Photon.VERTICAL if σ1 == Photon.HORIZONTAL
  14.               else Photon.HORIZONTAL)
  15.  
  16.         r1 = random()
  17.         x1 = (cos(ζ1) if σ1 == Photon.HORIZONTAL else sin(ζ1))
  18.         τ1 = (Detector.PLUS if r1 < x1 * x1 else Detector.MINUS)
  19.  
  20.         r2 = random()
  21.         x2 = (cos(ζ2) if σ2 == Photon.HORIZONTAL else sin(ζ2))
  22.         τ2 = (Detector.PLUS if r2 < x2 * x2 else Detector.MINUS)
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement