import math
#Variable declaration
theta = 30 #angle(degrees)
n = 1
lamda = 6500*10**-8 #wavelength(cm)
#Calculations
a = (n*lamda)/math.sin(theta*math.pi/180)
#Result
print "a =",a/1e-4,"*10^-4 cm"
import math
#Variable declaration
a = 6*10**-4 #width of slit(cm)
n = 1 #first order
lamda = 6000*10**-8 #wavelength(cm)
#Calculations
def deg_to_dms(deg):
d = int(deg)
md = abs(deg - d) * 60
m = int(md)
sd = (md - m) * 60
sd=round(sd,2)
return [d, m, sd]
theta = (math.asin((n*lamda)/a))*180/math.pi
d = 2*theta #angular seperation
#Result
print "Angular seperation between the 1st order minima is",deg_to_dms(d)
import math
#Variable declaration
n1 = 2 #for second minimum
n2 = 3 #for third minimum
lamda = 4000 #wavelength(A)
#Calculations
'''For 2nd order,
a sin0 = n1*lamda
For 3rd order,
a sin0 = n2*lamda'''
lamda = (n2*lamda)/n1
#Result
print "Wavelength =",lamda,"A"
import math
#Variable declaration
a = 0.16*10**-3 #width of slit(cm)
n = 1 #first order
lamda = 5600*10**-10 #wavelength(cm)
#Calculations
def deg_to_dms(deg):
d = int(deg)
md = abs(deg - d) * 60
m = int(md)
sd = (md - m) * 60
sd=round(sd,2)
return [d, m, sd]
theta = (math.asin((n*lamda)/a))*180/math.pi
#Result
print "Half angular width=",deg_to_dms(theta)
import math
#Variable declaration
a = 12*10**-5 #width of slit(cm)
n = 1 #first order
lamda = 6000*10**-8 #wavelength(cm)
#Calculations
theta = (math.asin((n*lamda)/a))*180/math.pi
#Result
print "Half angular width=",(theta),"degrees"
import math
#Variable declaration
a = 2*10**-6 #width of slit(cm)
n = 1 #first order
lamda = 6500*10**-10 #wavelength(cm)
#Calculations
theta = (math.asin((n*lamda)/a))*180/math.pi
#Result
print "Angle theta =",round(theta,2),"degrees"
#Variable declaration
a = 0.16 #width(mm)
b = 0.8 #distance(mm)
#Calculations & Results
m = ((a+b)/a)
for n in range(1,4):
print "m =",m*n
#Variable declaration
lamda1 = 5*10**-5 #cm
lamda2 = 7*10**-5 #cm
a_plus_b = 1./4000 #cm
#Calculations
m_max1 = a_plus_b/lamda1
m_max2 = round((a_plus_b/lamda2),1)
#Results
print m_max2,"orders are visible for 7000 A and",m_max1,"orders for 5000 A and either",m_max2,",4 or",m_max1,"for intermediate wavelengths"
#Variable declaration
theta = 30 #angle of diffraction(degrees)
lamda1 = 5400*10**-8 #cm
lamda2 = 4050*10**-8 #cm
#Calculations
m = lamda2/(lamda1-lamda2)
a_plus_b = (m*lamda1)/math.sin(theta*math.pi/180)
N = 1/a_plus_b
#Result
print "Number of lines per cm =",round(N,2)
#Variable declaration
lamda = 4992 #A
m1 = 3 #for 3rd order
m2 = 4 #for 4th order
#Calculations
'''For m = 3,
(a+b)sin0 = 3*lamda
For m = 4,
(a+b)sin0 = 4*lamda'''
l = (m2*lamda)/m1
#Results
print "Wavelength =",l,"A"
#Variable declaration
lamda = 6328*10**-8 #wavelength(cm)
m1 = 1
m2 = 2
a_plus_b = 1./6000 #cm
#Calculations
theta1 = math.asin((m1*lamda)/a_plus_b)*180/math.pi
theta2 = math.asin((m2*lamda)/a_plus_b)*180/math.pi
#Result
print "01 =",round(theta1,2),"degrees"
print "02 =",round(theta2,2),"degrees"
import math
#Variable declaration
m = 2 #2nd order
lamda = 5*10**-5 #wavelength(cm)
theta = 30
#Calculations
a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)
N = 1/a_plus_b
#Result
print "The number of lines/cm of the grating surface is",N
import math
#Variable declaration
m = 3 #3rd order
a_plus_b = 1./7000 #no. of lines/cm
sin0 = 1
#Calculation
lamda = (a_plus_b*sin0)/m
#Result
print "Wavelength =",round(lamda/1e-8),"A"
import math
#Variable declaration
m = 1 #1st order
lamda = 6560*10**-8 #wavelength(cm)
theta = 16+12./60
#Calculations
a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)
N = 1/a_plus_b
w = 2*N
#Result
print "The total number of lines is",round(w)
import math
#Variable declaration
m = 1 #1st order
lamda = 6.56*10**-5 #wavelength(cm)
theta = 18+14./60
#Calculations
a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)
N = 1/a_plus_b
w = 2*N
#Result
print "The total number of lines is",round(w,1)
#Variable declaration
lamda = 6*10**-5 #wavelength(cm)
a_plus_b = 1./5000 #cm
#Calculations
m_max = a_plus_b/lamda
#Result
print "Order =",round(m_max)
#Variable declaration
lamda = 6000*10**-8 #wavelength(cm)
a_plus_b = 1./5000 #cm
#Calculations
m_max = a_plus_b/lamda
#Result
print "m_max =",round(m_max)
#The rest of the solution is theoretical
import math
#Variable declaration
m = 1 #1st order
lamda = 5790*10**-8 #wavelength(cm)
theta = 19.994
#Calculations
a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)
N = 1/a_plus_b
w = 2.54*N
#Result
print "The total number of lines is",round(w)
import math
#Varaible declaration
n = 3000./0.5 #no. of lines per cm
m = 2 #for 2nd order
lamda1 = 5893*10**-8 #wavelength(cm)
lamda2 = 5896*10**-8 #wavelength(cm)
#Calculations
a_plus_b = 1/n
theta1 = math.degrees(math.asin((2*lamda1)/(a_plus_b)))
theta2 = math.degrees(math.asin((2*lamda2)/(a_plus_b)))
d = theta2-theta1 #angular seperation
N = lamda1*10**8/(m*3)
#Result
print "Since N=",round(N),"which is smaller than 3000 lines, the two lines will be resolved in the second order"
import math
#Varaible declaration
m = 3 #for 3rd order
lamda = 481 #wavelength(nm)
n = 620 #no. of ruling per mm
w = 5.05 #width(mm)
#Calculations
N = n*w
dl = lamda/(m*N)
#Result
print "Smallest wavelength interval =",round(dl,4),"nm"
import math
#Varaible declaration
m = 2 #for 2nd order
lamda = 5890 #wavelength(A)
dl = 6 #A
n = 500. #no. of lines per cm
#Calculations
N = lamda/(dl*m)
W = N/n
#Result
print "Least width =",W,"cm"
#Varaible declaration
N = 3*5000 #no. of lines per cm
a_plus_b = 1./5000 #cm
lamda = 5890*10**-8 #wavelength(cm)
#Calculations
m_max = round(a_plus_b/lamda)
RP = m_max*N
#Result
print "Maximum value of resolving power =",RP
#Varaible declaration
m = 2 #for 2nd order
lamda = 5890 #wavelength(A)
dl = 6 #A
w = 3. #width of a line(cm)
#Calculations
lamda2 = lamda+dl
N = lamda/(dl*m)
a_plus_b = w/N
#Results
print "The minimum no. of lines a grating must have is",N
print "The grating element is",round(a_plus_b/1e-3,2),"*10^-3 cm"
#Varaible declaration
N = 40000 #no. of lines per cm
m = 2 #for 2nd order
#Calculations
RP = m*N
#Result
print "Maximum value of resolving power =",RP