In [4]:

```
L=1.2 # Seperation between screen and double-slit in meter
d=3*10**-5 #distance between the two slits
m=2 #second order bright fringe
Y=4.5*10**-2 #distance of second order bright fringe from centerline
#wavelength of light
lamda=(Y*d)/(m*L)
print "(A) wavelength of light = %0.2e meters"%lamda
#distance between adjacent bright fringes
#delta_Y=Y(m+1)-Ym
delta_Y=lamda*L/d
print "(B) Distance between adjacent fringes = %0.3f meters"%delta_Y
```

In [6]:

```
n=1.33 #refractive index of soap bubble
lamda=602 #wavelength of light in nm
#for constructive interference we have 2nt=lamda/2
t=lamda/(4*n)
print "Minimum thickness of soap bubble film = %0.2f nm is"%t
```

In [7]:

```
n=1.45 #refractive index of silicon monoxide
lamda=552 #wavelength of light in nm
#for destructive interference we have condition for minimn thickness 2t=lamda/2n
t=lamda/(4*n)
print "Minimum thickness of film = %0.2f nm is"%t
```

In [8]:

```
n=1.6 #refractive index of plastic transparent layer
lamda=780 #wavelength of laser light in nm
#for destructive interference we have condition for minimn thickness 2t=lamda/2n
t=lamda/(4*n)
print "Pit depth in a CD = %0.2f nm"%t
```

In [10]:

```
lamda=580*10**-9 #wavelength of incident light in meter
a=0.30*10**-3 #slit width in meter
L=2 #distance of screen from slit in meters
#The first dark fringe corresponds to m=+1 or -1
m=1
sin_theta=m*lamda/a
#From fig 24.16 tan_theta=y/L and since theta is very small we have sin_theta=tan_theta hence sin_theta=y/L
y=L*sin_theta
print " Position of first dark fringe = %0.2e meters"%y
```

In [11]:

```
from math import asin, degrees
lamda=632.8 #wavelength of monochromatic light from helium-neon laser in meter
a=6000 #lines in diffraction grating per cm
d=10**7/a#slit seperation in nm
#for the first order maximum we have m=1
sin_theta1=lamda/d
theta1=degrees(asin(sin_theta1))
print "Angle in degrees at which first order maxima is observed : %0.2f"%theta1
#for the second order maximum we have m=2
sin_theta2=2*lamda/d
theta2=degrees(asin(sin_theta2))
print "Angle in degrees at which second order maxima is observed : %0.2f"%theta2
print "for higher order number of diffraction the the solutions are non realistic"
```