<jupyter_start><jupyter_text>Two-slit diffractionParaxial approximation<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
hbar = 1.
m = 1.
k = 1.
w0 = 1.
zf = 100.
lam = 2*np.pi/k
zR = np.pi*w0**2/lam
sep = 5*w0
# helper functions
w = lambda z: w0*np.sqrt(1+(z/zR)**2)
R = lambda z: z*(1+(zR/z)**2)
gouy = lambda z: np.arctan(z/zR)
psi = lambda x,z: w0/w(z)*np.exp(-x**2/w(z)**2-1.j*(k*z+k*x**2/2/R(z)-gouy(z)))
# psi in limit |z| >> zR
psifar = lambda x,z: zR/z*np.exp(-x**2/(2.*z/k/w0)**2-1.j*(k*z+k*x**2/z))
psi2 = lambda x,z: psi(x-sep,z)+psi(x+sep,z)
psi2far = lambda x,z: psifar(x-sep,z)+psifar(x+sep,z)
incoh = lambda x,z: np.abs(psi(x-sep,z))**2+np.abs(psi(x+sep,z))**2
xlist = 2*sep*np.linspace(-1.,1.,401)
# pdf at slits
plt.plot(xlist,np.abs(psi2(xlist,0.001))**2)
plt.plot(xlist,incoh(xlist,0.001),'.')
# pdf far away at z = zf
plt.plot(xlist*zf/2,np.abs(psi2far(xlist*zf/2,zf))**2)
plt.plot(xlist*zf/2,incoh(xlist*zf/2,zf),'.')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.25124626121635096, 'fraction_numerical': 0.05583250249252243, 'mean_word_length': 5.159509202453988, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '594967', 'license': 'MIT', 'n_tokens_mistral': 564, 'n_tokens_neox': 537, 'n_words': 82, 'path': '2slit.ipynb', 'repo_name': 'corcoted/Phys475', 'size': '1003'}