""" WORK IN PROGRESS This program sets up a basic Double Slit Experiment. The variables a,d,l,w,S change the result seen on the screen. The yellow bars mark the location of different fringes. Note: The slits are extremely small. Rotate scene and zoom in far to see the slits. """ from visual import * # create custom VPython display window display(width=1000,height=600,background=color.white) # sets parameters of experiment a = 1.5*10**(-6) d = 20*10**(-6) L = 10 w = 900*10**(-9) S = 10 # create screen with two slits slit1 = Polygon([(-.5,d/2),(-.5,d/2+a),(.5,d/2+a),(.5,d/2)]) slit2 = Polygon([(-.5,-d/2),(-.5,-(d/2+a)),(.5,-(d/2+a)),(.5,-d/2)]) wall1 = Polygon([(-1,-1),(-1,1),(1,1),(1,-1)]) screen1 = extrusion(pos=[(0,0,0),(.001,0,0)],shape=wall1-slit1-slit2) # create screen for display wall2 = Polygon([(-S/2,-S/2),(-S/2,S/2),(S/2,S/2),(S/2,-S/2)]) screen2 = extrusion(pos=[(L,0,0),(L+.001,0,0)],shape=wall2,color=color.black) # create laser source shell = Polygon([(-.5,-.5),(-.5,.5),(.5,.5),(.5,-.5)]) cavity = shapes.circle(radius=.3) laser = extrusion(pos=[(-10,0,0),(-12,0,0)],shape=shell-cavity,color=color.red) lasercap = box(pos=(-12.5,0,0),axis=(1,0,0),length=1,width=1,height=1,color=color.red) # calculations theta = math.asin(w/d) y = L*math.tan(theta) phi = 2*math.pi*d*math.sin(theta)/w I = (math.sin(phi)/math.sin(phi/2))**2 print(I) # drawing fringes m = 0 while m*y < S/2: m = m+1 n = -(m-1) fringe = Polygon([(-1,-.05),(-1,.05),(1,.05),(1,-.05)]) while -m < n < m: extrusion(pos=[(L,n*y,0),((L-.001),n*y,0)],shape=fringe,color=color.yellow) n = n+1