# 2: Diffraction¶

## Example number 1, Page number 73¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=5*10**-5;      #wavelength(cm)
k=2;                 #order

#Calculation
e=k*lamda/math.sin(theta);     #number of lines(cm)
n=1/e;                         #number of lines per centimeter

#Result
print "number of lines per centimeter is",int(round(n))
print "answer given in the book is wrong"

number of lines per centimeter is 5000
answer given in the book is wrong


## Example number 2, Page number 73¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=5000*10**-8;      #wavelength(cm)
e=1/6000;               #number of lines(cm)

#Calculation
theta1=math.asin(lamda/e)*180/math.pi;      #angle for 1st order(degrees)
theta2=math.asin(3*lamda/e)*180/math.pi;    #angle for 3rd order(degrees)
theta=round(theta2,1)-round(theta1,1);      #difference in angles of deviation(degrees)

#Result
print "difference in angles of deviation is",theta,"degrees"

difference in angles of deviation is 46.7 degrees


## Example number 3, Page number 74¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=5890*10**-5;      #wavelength(cm)
dlamda=6*10**-5;        #difference in wavelength(cm)
k=2;                    #order
w=2.5;                  #width(cm)

#Calculation
N=lamda/(k*dlamda*w);   #minimum number of lines per cm

#Result
print "minimum number of lines per cm is",round(N,2)
print "answer given in the book varies due to rounding off errors"

minimum number of lines per cm is 196.33
answer given in the book varies due to rounding off errors


## Example number 4, Page number 74¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=5890*10**-8;      #wavelength(cm)
dlamda=6*10**-8;        #difference in wavelength(cm)
w=2;                    #width(cm)
n=425;                  #number of lines on grating
k=2;                    #order

#Calculation
N=w*n;                  #number of lines on grating
N1=int(round(lamda/dlamda));         #number of lines required for resolution
N2=int(round(lamda/(k*dlamda)));                 #number of lines required for resolution

#Result
print "number of lines required for resolution is",N1,"and number of lines on grating is",N
print "hence lines will not be resolved"
print "number of lines required for resolution is",N2,"and number of lines on grating is",N
print "hence lines will appear resolved"

number of lines required for resolution is 982 and number of lines on grating is 850
hence lines will not be resolved
number of lines required for resolution is 491 and number of lines on grating is 850
hence lines will appear resolved


## Example number 5, Page number 75¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda1=5016*10**-8;      #wavelength(cm)
lamda2=5048*10**-8;      #difference in wavelength(cm)
k=2;                     #order
n=15000;                 #number of lines/inch

#Calculation
e=2.54/n;
theta1=math.asin(2*lamda1/e)*180/math.pi;   #angle for 1st wavelength(degrees)
theta2=math.asin(2*lamda2/e)*180/math.pi;   #angle for 2nd wavelength(degrees)
theta=int(60*(theta2-theta1));        #angle of separation(minutes)

#Result
print "angle of separation is",theta,"minutes"

angle of separation is 16 minutes


## Example number 6, Page number 75¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
n=4000;                #number of lines/cm
lamda=5000*10**-8;     #wavelength(cm)
k=3;                   #order

#Calculation
e=1/n;
sintheta=k*lamda/e;
costheta=math.sqrt(1-sintheta**2);
dthetabydlamda=k*n/costheta;         #dispersive power of grating

#Result
print "dispersive power of grating is",int(dthetabydlamda)

dispersive power of grating is 15000


## Example number 7, Page number 76¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
n=5000;                #number of lines/cm
lamda=6000*10**-8;     #wavelength(cm)

#Calculation
e=1/n;
k=e/lamda;             #highest order of spectrum

#Result
print "highest order of spectrum is",int(k)

highest order of spectrum is 3


## Example number 8, Page number 76¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
dlamda=5*10**-9;                #wavelength(cm)
k=2;

#Calculation
lamda=math.sin(theta)*dlamda/(math.cos(theta)*dtheta);
lamdanew=lamda+dlamda;             #wavelength of lines(cm)
N=lamda/(dlamda*k);
Ne=N*k*lamda/math.sin(theta);      #minimum grating width required(cm)

#Result
print "wavelength of lines is",round(lamda*10**8,1),"*10**-8 cm"
print "answer given in the book varies due to rounding off errors"
print "minimum grating width required is",round(Ne,1),"cm"

wavelength of lines is 6061.7 *10**-8 cm
answer given in the book varies due to rounding off errors
minimum grating width required is 4.2 cm


## Example number 9, Page number 77¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=5000*10**-8;     #wavelength(cm)
sintheta1=0.2;
sintheta2=0.3;
w=2.5;                 #width of grating(cm)

#Calculation
e=lamda/(sintheta2-sintheta1);      #grating element is
N=2*w/e;        #resolving power

#Result
print "grating element is",int(e*10**4),"*10**-4","cm"
print "resolving power is",int(round(N))

grating element is 5 *10**-4 cm
resolving power is 10000


## Example number 10, Page number 77¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
d=2;                   #diffraction observed(m)
lamda=500*10**-9;      #wavelength(m)
a=1.5*10**-3;          #slit width(m)

#Calculation
w=2*d*lamda/a;        #width of central maxima(m)

#Result
print "width of central maxima is",round(w*10**3,2),"mm"

width of central maxima is 1.33 mm


## Example number 11, Page number 77¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
d=2;                   #diffraction observed(m)
lamda=500*10**-9;      #wavelength(m)
x=5*10**-3;            #width of central maxima(m)

#Calculation
a=d*lamda/x;           #slit width(m)

#Result
print "slit width is",a*10**3,"mm"

slit width is 0.2 mm


## Example number 12, Page number 78¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=6000*10**-10;      #wavelength(m)
a=12*10**-7;             #slit width(m)

#Calculation
theta=math.asin(lamda/a)*180/math.pi;      #half angular width(degrees)

#Result
print "half angular width is",int(theta),"degrees"

half angular width is 30 degrees


## Example number 13, Page number 78¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
b=0.8;                  #distance(mm)
a=0.16;                 #slit width(mm)
p1=1;
p2=2;
p3=3;

#Calculation
nbyp=(a+b)/a;           #ratio of missing orders
n1=int(nbyp*p1);
n2=int(nbyp*p2);
n3=int(nbyp*p3);        #missing orders

#Result
print "the orders",n1,n2,n3,"etc will be missing"

the orders 6 12 18 etc will be missing


## Example number 14, Page number 79¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
N=6000*10**2;           #number of lines/m
m=3;                    #order
lamda1=500*10**-9;      #wavelength(m)
lamda2=510*10**-9;      #wavelength(m)

#Calculation
sintheta1=m*N*lamda1;
theta1=math.asin(sintheta1)*180/math.pi;        #angle(degrees)
sintheta2=m*N*lamda2;
theta2=math.asin(sintheta2)*180/math.pi;        #angle(degrees)
theta=theta2-theta1;                            #angular separation(degrees)

#Result
print "angular separation is",round(theta,2),"degrees"

angular separation is 2.48 degrees


## Example number 15, Page number 79¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
N=15000/2.54*10**2;   #number of lines/cm
lamda=600*10**-9;      #wavelength(m)

#Calculation
m=1/(N*lamda);         #highest order that can be seen

#Result
print "highest order that can be seen is",int(m)

highest order that can be seen is 2


## Example number 16, Page number 79¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
N=10000/2*10**2;           #number of lines/m
m=1;                       #order
lamda1=5890*10**-10;        #wavelength(m)
lamda2=5896*10**-10;        #wavelength(m)

#Calculation
sintheta1=m*N*lamda1;
theta1=math.asin(sintheta1)*180/math.pi;        #angle(degrees)
sintheta2=m*N*lamda2;
theta2=math.asin(sintheta2)*180/math.pi;        #angle(degrees)
theta=theta2-theta1;                            #angular separation(degrees)

#Result
print "angular separation is",round(theta,3),"degrees"

angular separation is 0.018 degrees


## Example number 17, Page number 80¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
lamda=6500*10**-8;               #wavelength(cm)
n=1;                             #order

#Calculation
a=n*lamda/math.sin(theta);       #slit width(cm)

#Result
print "slit width is",round(a*10**4,2),"*10**-4 cm"

slit width is 2.51 *10**-4 cm


## Example number 18, Page number 80¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
a=2.5*10**-6;                    #slit width(m)

#Calculation
lamda=a*math.pi*math.sin(theta)*10**10/(1.43*math.pi);       #wavelength of light(angstrom)

#Result
print "wavelength of light is",int(lamda),"angstrom"
print "answer given in the book is wrong"

wavelength of light is 4524 angstrom
answer given in the book is wrong


## Example number 19, Page number 81¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
n=2;                             #order
N=4250;                          #grating lines(lines/cm)

#Calculation
e=1/N;
lamda=e*math.sin(theta)*10**8/n;       #wavelength of spectral line(angstrom)

#Result
print "wavelength of spectral line is",int(lamda),"angstrom"

wavelength of spectral line is 5882 angstrom


## Example number 20, Page number 81¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
n=1;                #order
a=1*10**-6;         #slit width(m)
lamda=600*10**-9;   #wavelength of spectral line(m)

#Calculation
theta=math.asin(n*lamda/a)*180/math.pi;      #angular separation(degrees)

#Result
print "angular separation is",round(theta,4),"degrees"

angular separation is 36.8699 degrees


## Example number 21, Page number 82¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
N=10520;                         #grating lines(lines/cm)
lamda=5*10**-5;                  #wavelength of spectral line(cm)

#Calculation
e=1/N;
n=e*math.sin(theta)/lamda;     #order

#Result
print int(round(n)),"orders can be seen"

2 orders can be seen


## Example number 22, Page number 82¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
x=4.2*10**-3;                    #distance(m)
D=60*10**-2;                     #screen slit distance(m)
lamda=6000*10**-10;              #wavelength(m)

#Calculation
d=D*lamda/x;                     #slit width(m)

#Result
print "slit width is",round(d*10**4,3),"*10**-4 m"

slit width is 0.857 *10**-4 m


## Example number 23, Page number 83¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
N=15000/2.54;                    #number of lines(per cm)
lamda=6000*10**-8;               #wavelength(cm)

#Calculation
d=1/N;                           #slit width(m)
m=d/lamda;                       #possible order of spectra

#Result
print "possible order of spectra is",int(round(m))

possible order of spectra is 3


## Example number 24, Page number 83¶

In :
#importing modules
import math
from __future__ import division

#Variable declaration
D=150;                           #slit screen distance(cm)
d=0.03;                          #separation(cm)
beta=0.3;                        #fringe separation(cm)

#Calculation
lamda=d*beta*10**8/D;            #wavelength of light(angstrom)

#Result
print "wavelength of light is",int(round(lamda)),"angstrom"

wavelength of light is 6000 angstrom