#importing modules
import math
from __future__ import division
#Variable declaration
d=4.255; #atomic spacing(angstrom)
lamda=1.549; #wavelength of K-copper line(angstrom)
n=1; #theta is smallest when n=1
#Calculation
theta=math.asin(lamda/(2*d)); #glancing angle(radian)
theta=theta*(180/math.pi); #glancing angle(degrees)
#max value of sin(theta)=1 for highest order
nmax=((2*d)/lamda); #highest bragg's order
#Result
print "smallest glancing angle is",round(theta,4),"degrees"
print "maximum order of reflection is",round(nmax,3)
#importing modules
import math
from __future__ import division
#Variable declaration
V=60*10**3; #potential difference(volts)
c=3*10**8; #velocity of light(m/sec)
e=1.6*10**-19; #electron charge(coulomb)
lamda=0.194*10**-10; #minimum wavelength of x-rays(m)
#Calculation
h=(lamda*e*V)/c; #planck's constant(Jsec)
#Result
print "planck's constant is",h,"Jsec"
#importing modules
import math
from __future__ import division
#Variable declaration
#for 110 plane
h=1;
k=1;
l=0;
a=3; #lattice parameter(angstrom)
n=1;
theta=12.5; #glancing angle(degrees)
#Calculation
theta1=theta*(math.pi/180); #glancing angle(radian)
d110=(a/math.sqrt((h**2)+(k**2)+(l**2)));
lamda=2*d110*math.sin(theta1)/n; #wavelength of x-ray(angstrom)
nmax=((2*d110)/lamda); #highest order possible
#Result
print "wavelength of x-ray beam is",round(lamda,3),"angstrom"
print "highest bragg's order possible is",int(nmax)
#importing modules
import math
from __future__ import division
#Variable declaration
d=2.81*10**-10; #interplanar spacing(m)
theta=14; #glancing angle(degrees)
e=1.6*10**-19; #electron charge(c)
V=9100; #voltage(V)
n=1;
c=3*10**8; #velocity of light(m/sec)
#Calculation
theta=theta*(math.pi/180); #glancing angle(radian)
lamda=2*d*math.sin(theta)/n; #minimum wavelength
h=(lamda*e*V)/c; #planck's constant(Jsec)
#Result
print "planck's constant is",round(h*10**34,4),"*10**-34 Jsec"
#importing modules
import math
from __future__ import division
#Variable declaration
thetaA=30; #glancing angle for line A(degrees)
lamdaB=0.97; #wavelength of line B(angstrom)
thetaB=60; #glancing angle for line B(degrees)
#Calculation
#for line A-> 2*d*sin(thetaA)=lamdaA(n=1)
thetaA=thetaA*(math.pi/180); #glancing angle for line A(radian)
#for line B-> 2*d*sin(thetaB)=3*lamdaB(n=3)
thetaB=thetaB*(math.pi/180); #glancing angle for line B(radian)
d=(3*lamdaB)/(2*math.sin(thetaB)); #interplanar spacing(angstrom)
lamdaA=2*d*math.sin(thetaA); #wavelength of line A(angstrom)
#Result
print "wavelength of line A is",round(lamdaA,2),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
a=3.615; #lattice constant(angstrom)
h=1;
k=1;
l=1;
theta=21.7; #glancing angle(degrees)
#Calculation
d111=a/math.sqrt(h**2+k**2+l**2); #interplanar spacing(angstrom)
theta=theta*(math.pi/180); #glancing angle(radian)
lamda=2*d111*math.sin(theta); #wavelength of X-rays(angstrom)
#Result
print "wavelength of X-rays is",round(lamda,3),"angstrom"
#importing modules
import math
from __future__ import division
#Variable declaration
V=50*10**3; #voltage(V)
n=4; #FCC crystal
m=74.6; #molecular mass(kg)
N=6.02*10**26; #avagadro number(per kg mol)
rho=1.99*10**3; #density(kg/m**3)
#Calculation
lamda=(12400/V); #short wavelength(angstrom)
a=(((n*m)/(N*rho))**(1/3)); #lattice constant(m)
#for kcl ionic crystal
d=a/2;
sintheta=lamda*10**-10/(2*d); #value of sintheta
theta=math.asin(sintheta); #glancing angle(radian)
theta=theta*(180/math.pi); #glancing angle(degrees)
#Result
print "short wavelength of spectrum from tube is",lamda,"angstrom"
print "glancing angle for that wavelength is",round(theta,4),"degrees"
#importing modules
import math
from __future__ import division
#Variable declaration
theta1=5.4; #glancing angle(degrees)
theta2=7.6; #glancing angle(degrees)
theta3=9.4; #glancing angle(degrees)
#Calculation
#from bragg's law 2*d*sin(theta)=n*lamda, n=1
theta1=theta1*(math.pi/180); #glancing angle(radian)
theta2=theta2*(math.pi/180); #glancing angle(radian)
theta3=theta3*(math.pi/180); #glancing angle(radian)
d100=lamda/2*math.sin(theta1); #interplanar spacing
d110=lamda/2*math.sin(theta2); #interplanar spacing
d111=lamda/2*math.sin(theta3); #interplanar spacing
#Result
print "ratio of interplanar spacing (1/d100):(1/d110):(1/d111)=",round(math.sin(theta1),4),":",round(math.sin(theta2),4),":",round(math.sin(theta3),4)
print "as ratio (1/d100):(1/d110):(1/d111)=1:sqrt(2):sqrt(3). this relation is valid for simple cubic systems. therefore, this is a simple cubic crystal"