In [2]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
d=0.282; #lattice spacing(nm)
theta=(8+(35/60))*math.pi/180; #glancing angle(radian)
n1=1; #order
#Calculation
lamda=2*d*math.sin(theta)/n1; #wavelength of X-rays(nm)
n=2*d/lamda; #maximum order of diffraction
#Result
print "wavelength of X-rays is",round(lamda,4),"nm"
print "maximum order of diffraction is",int(n)
```

In [10]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
d=3.209; #lattice spacing(angstrom)
lamda=1.92; #wavelength of X-rays(angstrom)
n1=1; #order
n2=2; #order
#Calculation
theta1=math.asin(n1*lamda/(2*d))*180/math.pi; #glancing angle for 1st order(degrees)
theta1d=int(theta1); #glancing angle for 1st order(degrees)
theta1m=(theta1-theta1d)*60; #glancing angle for 1st order(minutes)
theta2=math.asin(n2*lamda/(2*d))*180/math.pi; #glancing angle for 2nd order(degrees)
theta2d=int(theta2); #glancing angle for 2nd order(degrees)
theta2m=(theta2-theta2d)*60; #glancing angle for 2nd order(minutes)
#Result
print "glancing angle for 1st order is",theta1d,"degrees",int(theta1m),"minutes"
print "glancing angle for 2nd order is",theta2d,"degrees",int(theta2m),"minutes"
print "answers given in the book are wrong"
```

In [14]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
d=3.05; #lattice spacing(angstrom)
theta=12*math.pi/180; #glancing angle(radian)
n=1; #order
#Calculation
lamda=2*d*math.sin(theta)/n1; #wavelength of X-rays(angstrom)
#Result
print "wavelength of X-rays is",round(lamda,3),"angstrom"
print "answer given in the book is wrong"
```

In [16]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
thetaA=30*math.pi/180; #glancing angle(radian)
thetaB=60*math.pi/180; #glancing angle(radian)
n1=1; #order
n2=2; #order
lamdaB=0.9; #wavelength of X-rays(angstrom)
#Calculation
lamdaA=2*lamdaB*math.sin(thetaA)/math.sin(thetaB); #wavelength of line A(angstrom)
#Result
print "wavelength of line A is",round(lamda,3),"angstrom"
print "answer given in the book is wrong"
```

In [21]:

```
#importing modules
import math
from __future__ import division
#Variable declaration
d=2.51; #lattice spacing(angstrom)
theta=9*math.pi/180; #glancing angle(radian)
n1=1; #order
n2=2; #order
#Calculation
lamda=2*d*math.sin(theta)/n1; #wavelength of X-rays(angstrom)
theta=math.asin(n2*lamda/(2*d))*180/math.pi; #glancing angle for 2nd order(degrees)
#Result
print "wavelength of X-rays is",round(lamda,4),"angstrom"
print "glancing angle for 2nd order is",round(theta,1),"degrees"
```