import math
##Example 16.1
##calculation of density
##given values
a=3.36*10**-10;##lattice constant in m
M=209.;##atomicmass of polonium in kg
N=6.02*10**26;##avogadro's number
z=1.;##no of atom
##calculation
d=z*M/(N*a**3)
print'%s %.2f %s'%('density (in kg/m^3) is',d,'');
import math
##Example 16.2
##calculation of no of atoms
##given values
a=4.3*10**-10;##edge of unit cell in m
d=963.;##density in kg/m**3
M=23.;##atomicmass of sodium in kg
N=6.02*10**26;##avogadro's number
##calculation
z=d*N*a**3./M;
print'%s %.2f %s'%('no of atoms is',z,'');
import math
##Example 16.3
##calculation of distance
##given values
z=4.;##no of atoms in fcc
d=2180.;##density in kg/m**3
M=23+35.3;##atomicmass of sodium chloride in kg
N=6.02*10**26;##avogadro's number
##calculation
a1=z*M/(N*d);
a=a1**(1/3.);
l=a/2.;##in m
print'%s %.2f %s'%('distance between adjacent chlorine and sodium atoms in armstrong is',l*10**10,'');
import math
##Example 16.4
##calculation of interatomic spacing
##given values
alpha=30*math.pi/180.;##Bragg angle in degree
h=1;
k=1;
l=1;
m=1;##order of reflection
x=1.75*10**-10;##wavelength in m
##calculation
d=m*x/(2.*math.sin(alpha));
a=d*math.sqrt(h**2+k**2+l**2.);##in m
print'%s %.2f %s'%('interatomic spacing in armstrong is',a*10**10,'');