#importing modules
import math
from __future__ import division
#Variable declaration
n=1; #order
theta=32*math.pi/180; #glancing angle(radian)
lamda=1.54; #wavelength(angstrom)
h=2;
k=2;
l=0;
#Calculation
d=n*lamda/(2*math.sin(theta)); #lattice parameter(angstrom)
a=d*math.sqrt(h**2+k**2+l**2); #cube edge of unit cell(angstrom)
#Result
print "cube edge of unit cell is",round(a,1),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
lamda=0.58; #wavelength(angstrom)
theta1=6.45*math.pi/180; #glancing angle(radian)
theta2=9.15*math.pi/180; #glancing angle(radian)
theta3=13*math.pi/180; #glancing angle(radian)
n=1; #order
#Calculation
d1=lamda/(2*math.sin(theta1)); #interplanar spacing at 1st angle(angstrom)
d2=lamda/(2*math.sin(theta2)); #interplanar spacing at 2nd angle(angstrom)
d3=lamda/(2*math.sin(theta3)); #interplanar spacing at 3rd angle(angstrom)
#Result
print "interplanar spacing at 1st angle is",round(d1,3),"angstrom"
print "interplanar spacing at 2nd angle is",round(d2,3),"angstrom"
print "interplanar spacing at 3rd angle is",round(d3,3),"angstrom"
print "answers given in the book are wrong"
#importing modules
import math
from __future__ import division
#Variable declaration
d=1.181; #lattice spacing(angstrom)
theta=90*math.pi/180; #glancing angle(radian)
lamda=1.540; #wavelength of X-rays(angstrom)
#Calculation
n=2*d*math.sin(theta)/lamda; #order of diffraction
#Result
print "order of diffraction is",int(n)
#importing modules
import math
from __future__ import division
#Variable declaration
theta=9.5*math.pi/180; #glancing angle(radian)
lamda=0.58; #wavelength of X-rays(angstrom)
n=1; #order
h=2;
k=0;
l=0;
#Calculation
d=n*lamda/(2*math.sin(theta));
a=d*math.sqrt(h**2+k**2+l**2); #lattice parameter(angstrom)
#Result
print "lattice parameter is",round(a,3),"angstrom"
print "answer given in the book varies due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
theta1=(8+(35/60))*math.pi/180; #glancing angle(radian)
lamda=0.842; #wavelength of X-rays(angstrom)
n1=1; #order
n2=3; #order
#Calculation
x=n2*lamda*math.sin(theta1)/(n1*lamda);
theta2=math.asin(x)*180/math.pi; #glancing angle
theta2d=int(theta2); #glancing angle(degrees)
theta2m=(theta2-theta2d)*60; #glancing angle(minutes)
#Result
print "glancing angle is",theta2d,"degrees",int(theta2m),"minutes"
print "answer for glancing angle in minutes given in the book is wrong"
#importing modules
import math
from __future__ import division
#Variable declaration
a=3.16; #lattice parameter(angstrom)
theta=20.3*math.pi/180; #glancing angle(radian)
lamda=1.54; #wavelength of X-rays(angstrom)
n=1; #order
#Calculation
d=n*lamda/(2*math.sin(theta)); #interplanar spacing(angstrom)
x=(a/d)**2;
#Result
print "interplanar spacing is",round(d,2),"angstrom"
print "answer for interplanar spacing given in the book is wrong"
print "value of h**2+k**2+l**2 is",int(x),". hence the miller indices could be (110) (011) or (101)"
#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)
n=1; #order
#Calculation
lamda=2*d*math.sin(theta)/n; #wavelength(nm)
N=2*d/lamda; #maximum order of diffraction
#Result
print "wavelength is",round(lamda,3),"nm"
print "maximum order of diffraction is",int(N)
#importing modules
import math
from __future__ import division
#Variable declaration
lamda=1.5; #wavelength(AU)
d=1.6; #lattice spacing(AU)
#Calculation
n=2*d/lamda; #maximum order of diffraction
#Result
print "maximum order of diffraction is",int(n)
#importing modules
import math
from __future__ import division
#Variable declaration
theta=30*math.pi/180; #glancing angle(radian)
h=1;
k=1;
l=1;
lamda=1.5418; #wavelength(angstrom)
n=1; #order
#Calculation
d=n*lamda/(2*math.sin(theta)); #interplanar spacing(angstrom)
a=d*math.sqrt((h**2)+(k**2)+(l**2)); #interatomic spacing(angstrom)
#Result
print "interatomic spacing is",round(a,2),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
h=1;
k=1;
l=0;
lamda=0.065; #wavelength(nm)
n=2; #order
a=0.26; #axial length(nm)
#Calculation
x=n*lamda*math.sqrt(h**2+k**2+l**2)/(2*a);
theta=math.asin(x)*180/math.pi; #glancing angle(degrees)
#Result
print "glancing angle is",round(theta,1),"degrees"
#importing modules
import math
from __future__ import division
#Variable declaration
h=1;
k=1;
l=1;
lamda=1.54; #wavelength(angstrom)
n=1; #order
theta=19.2*math.pi/180; #glancing angle(radian)
#Calculation
d=n*lamda/(2*math.sin(theta));
a=d*math.sqrt(h**2+k**2+l**2); #cube edge of unit cell(angstrom)
#Result
print "cube edge of unit cell is",round(a,3),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
lamda=1.54*10**-10; #wavelength(m)
n=1; #order
theta=19.2*math.pi/180; #glancing angle(radian)
h=1;
k=1;
l=1;
#Calculation
d=n*lamda/(2*math.sin(theta));
a=d*math.sqrt(h**2+k**2+l**2); #cube edge of unit cell(m)
#Result
print "cube edge of unit cell is",round(a*10**10,3),"*10**-10 m"
#importing modules
import math
from __future__ import division
#Variable declaration
lamda=0.12; #wavelength(nm)
n=2; #order
theta=28*math.pi/180; #glancing angle(radian)
#Calculation
d=n*lamda/(2*math.sin(theta)); #interplanar spacing(nm)
#Result
print "interplanar spacing is",round(d,2),"nm"
#importing modules
import math
from __future__ import division
#Variable declaration
lamda=97; #wavelength(pm)
n1=1; #order
n2=3; #order
theta1=23*math.pi/180; #glancing angle(radian)
theta2=60*math.pi/180; #glancing angle(radian)
#Calculation
lamda1=n2*lamda*math.sin(theta1)/(n1*math.sin(theta2)); #wavelength(pm)
d=n2*lamda/(2*math.sin(theta2)) #interplanar spacing(pm)
#Result
print "wavelength is",round(lamda1,1),"pm"
print "interplanar spacing is",int(d),"pm"
print "answer for wavelength given in the book varies due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
theta=45*math.pi/180; #glancing angle(radian)
d=275; #interplanar spacing(pm)
n1=3;
n2=4;
#Calculation
lamda=2*d*math.sin(theta); #wavelength(pm)
lamda1=lamda/n1; #wavelength for n=3
lamda2=lamda/n2; #wavelength for n=4
#Result
print "wavelength for n=3 is",int(round(lamda1)),"pm and for n=4 is",round(lamda2,2),"pm"
print "answer for wavelength for n=4 given in the book varies due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
theta1=(30+(0/60))*math.pi/180; #glancing angle(radian)
theta2=(35+(17/60))*math.pi/180; #glancing angle(radian)
lamda=0.171; #wavelength(nm)
h1=1;
k1=1;
l1=0;
h2=2;
k2=0;
l2=0;
h3=1;
k3=1;
l3=1;
#Calculation
d100=lamda/(2*math.sin(theta1)); #wavelength(nm)
d200=lamda/(2*math.sin(theta2)); #wavelength(nm)
a1=d100*math.sqrt(h1**2+k1**2+l1**2);
a2=d200*math.sqrt(h2**2+k2**2+l2**2); #lattice parameter in case of bcc
a3=d100*math.sqrt(h3**2+k3**2+l3**2);
a4=d200*math.sqrt(h2**2+k2**2+l2**2); #lattice parameter in case of bcc
d=a3/math.sqrt(2); #atomic diameter(nm)
#Result
print "lattice parameter in case of bcc are",round(a1,3),"nm and",round(a2,3),"nm which are not the same. hence the metal is not bcc"
print "lattice parameter in case of fcc are",round(a3,3),"nm and",round(a4,3),"nm which are the same. hence the metal is fcc"
print "atomic diameter is",round(d,5),"nm"
print "answer for atomic diameter given in the book varies due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
d=0.282*10**-9; #lattice spacing(m)
theta=(8+(35/60))*math.pi/180; #glancing angle(radian)
maxtheta=90*math.pi/180;
n=1; #order
#Calculation
lamda=2*d*math.sin(theta)/n; #wavelength of x-rays(m)
N=2*d*math.sin(maxtheta)/lamda; #maximum order of diffraction
#Result
print "wavelength of x-rays is",round(lamda*10**10,3),"angstrom"
print "maximum order of diffraction is",int(round(N))
print "answer for wavelength of x-rays given in the book is wrong"
#importing modules
import math
from __future__ import division
#Variable declaration
d=3.04*10**-10; #lattice spacing(m)
lamda=0.79*10**-10; #wavelength(m)
n=3; #order
#Calculation
x=n*lamda/(2*d);
theta=math.asin(x)*180/math.pi; #glancing angle(degrees)
#Result
print "glancing angle is",round(theta,3),"degrees"