Wednesday, May 30, 2012

Light and Matter Waves

Purpose:
Using python (spyder) to create a visual representation of light's diffraction.

An example of the code is as follows:
from visual import *
import pylab as p
import mpl_toolkits.mplot3d.axes3d as p3
wavelength = 8.0e-3
scrnDist = 5.0e-2
scrnWdth = 2.4e-2
xs = 0
ys = 0
A = 1
N = 100
dX = scrnDist / N
Xcoords = arange(dX,scrnDist + 2* dX, dX)
dY = scrnDist / N
Ycoords = arange(-scrnDist / 2, scrnDist/2+2 * dY, dY)
[xd, yd] = meshgrid(Xcoords,Ycoords)
r = sqrt((xd - xs)**2 + (yd - ys)**2)
E0 = A * cos(2*pi*r/ wavelength)/r
print Xcoords
print Ycoords
print r
print E0
fig=p.figure()
Efield = p3.Axes3D(fig)
Efield.plot_wireframe(xd,yd,E0)
Efield.set_xlabel('Xd')
Efield.set_ylabel('Yd')
Efield.set_zlabel('E0')
fig2 = p.figure()
p.contour (xd,yd,E0)
p.show()


1.1
Graph visualizing the varying Efield on x,y, and z coordinates. z axis represents the quantity of E0 (E_field)
Wavelength = 4 mm
1.2
Graph of Efield when wavelength is 8mm



This shows that magnitude of E field varies in respect to wavelength. The "ripples" also varies; the higher the wavelength, the smoother the ripples (high wavelength shows no ripples / fat surface)


Contour plot of  fig 1.2

The next part measures and visualizes fields of two point-sources (where interference starts to occur)

The 2 holes-interference is shown as (wavelength = 50 mm to show the "flattening" of the surface):
2.0
Wavelength = 50 mm. Notice the red dot on contour graph, showing the high intensity caused by high wavelength value.

2.1 
Wavelength = 4.0 mm.

Next part will focus on measuring the intensity.
Th wavelength will be modified to 600 nm, screen width 30 mm and distance 50 mm, wand source separation 0.016 mm.

3.0
The 2-D graph of intensity




No comments:

Post a Comment