import math
#to calculate value of planck's constant
e=1.6*10**-19 #in C
V=100*10**3 #voltage in KV
c=3*10**8 #light speed in m/s
lamdamin=12.35*10**-12 #wavelength in m
h=e*V*lamdamin/c
print "the value of plancks constant is h=","{:.3e}".format(h),"J-s"
import math
#to calculate maximum frequency
h=6.6*10**-34 #planck's constant in J-s
c=3.0*10**8 #light speed in m/s
Ve=50000 #accelerating potential in V
lamdamin=h*c/Ve #wavelength in m
numax=c/lamdamin
print "maximum frequency present in the radiation from an X-ray tube is numax=","{:.3e}".format(numax),"Hz"
#answer is given in thec book is incorrect =1.2*10**19 Hz
import math
#to calculate number of electrons
I=2*10**-3 #current in mA
e=1.6*10**-19
n=I/e
print "number of electrons striking the target per second is n=","{:.3e}".format(n),"unitless"
#to calculate speed
m=9.1*10**-31 #mass of electron in kg
V=12.4*10**3 #potential difference in V
v=math.sqrt(2*V*e/m)
print "the speed with which electrons strike the target is v=","{:.3e}".format(v),"m/s"
import math
#to calculate wavelength
n=2 #second order for longest wavelength
d=2.82*10**-10 # spacing in angstrom
sintheta=1
lamdamax=2*d*sintheta/n
print "the longest wavelength that can be analysed by a rock salt crystal is lamdamax=","{:.3e}".format(lamdamax),"m"
import math
#to calculate spacing of the crystal
h=6.62*10**-34 #planck's constant in J-s
m=9.1*10**-31 #mass of electron in kg
V=344 #voltage in V
e=1.6*10**-19
lamda=h/math.sqrt(2*m*e*V) #wavelength in m
#according to Bragg's law
n=1
#formula is 2*d*sintheta=n*lamda
d=n*lamda/(2*math.sin(math.pi/6))
print "the spacing of the crystal is d=",round(d/1e-10,3),"angstrom"
import math
#to calculate wavelength of Kalpha line for an atom
R=1.1*10**5
z=92
#Ka line is emitted when electron jumps from l shell(n2=2) to k shell(n1=1)
#formula is 1/alphaa=R*(z-b)*((1/n1**2)-(1/n2)**2)
alphaa=4/(3*R*(z-1)**2)
print "wavelength of Kalpha line for an atom is alphaa=","{:.3e}".format(alphaa),"cm"
import math
#to calculate thickness
#mass absorption coefficient mum of an absorber is related with linear absorption coefficient mu and density of the material rho is given by
#mu=rho*mum=2.7*0.6=1.62 cm**-1
mu=1.62
#if initial intensity Io of the X-ray beam is reduced to I in traversing a distance x in absorber I=Io*e**-mu*x
#where I/Io=20
#put above values in the below equation , we get
x=(2.3026*(math.log(20)/math.log(10)))/1.62
print "thickness is x=",round(x,3),"cm"
import math
#to calculate atomic number of the element
#equation for balmer series in hydrogen spectrum is 1/lamda=R*((1/2**2)-(1/n**2))
#for series limit n=infinity ,R=4/lamdainfinity i.e. R=4/364.6nm
#X-ray wavelength of K series is 1/lamda=R*(z-1)**2*((1/1**2)-(1/n**2))
lamda=0.1*10**-9
R=4/(364.6*10**-9)
#for n=infinity ,minimum wavelength of k series is given by
z=math.sqrt(1/(lamda*R))+1
print "atomic number is z=",int(z),"unitless"
import math
#to calculate wavelength
d=1.87*10**-10 #spacing in angstrom
n=2
#formula is lamda=2*d*sintheta/n
lamda=2*d*math.sin(math.pi/6)/n
print "the wavelength of X-rays is lamda=",round(lamda/1e-10,3),"angstrom"
import math
#to calculate wavelength of second X-ray beam
#from bragg's law
#lamda=(d*math.sin(math.pi/3))/n eq(1)
#it is given that,theta=60,n=3,lamda=1.97 angstrom
#from eq(1) we get,2*d*sin60degree=3*0.97 eq(2)
#let lamda' be the second X-ray beam
#we get 2*d'*sin theta'=n'*lamda' eq(3)
#from eq(2) and eq(3),we get
lamda1=math.sin(math.pi/6)*3*0.97/math.sin(math.pi/3) #where lamda1=lamda'
print "wavelength of X-ray is lamda1=",round(lamda1,3),"angstrom"
import math
#to calculate wavelength
d=2.82*10**-10 #spacing in m
n=1
lamda=2*d*math.sin(10*math.pi/180)/n
print "wavelength of X-ray is lamda=",round(lamda/1e-10,3),"angstrom"
import math
#deduce possible spacing of the set of planes
#for first order , 2*d*sintheta1=1*lamda...eq(1)
#for second order ,2*d*sintheta2=2*lamda..eq(2)
#for third order, 2*d*sintheta3=3*lamda......eq(3)
#for fourth order, 2*d*sintheta4=4*lamda..............eq(4)
#divide eq(2) by eq(1),we get sintheta2=2*sintheta1
#similarly,sintheta3=3*sintheta1,sintheta4=4*sintheta1
lamda=1.32*10**-10
sintheta1=0.1650
d1=lamda/(2*sintheta1)#for first order n=1,d1=d/n
d2=lamda/(2*2*sintheta1) #for second order n=2,d2=d/n
d3=lamda/(2*3*sintheta1) #for third order n=3,d3=d/n
d4=lamda/(2*4*sintheta1) #for fourth order n=4,d4=d/n
print "d1=",d1,"m"
print "d2=",d2,"m"
print "d3=",round(d3,2),"m"
print "d4=",d4,"m"
import math
#to calculate compton shift and wavelength
h=6.63*10**-34 #planck's constant in J-s
m0=9.11*10**-31 #mass of electron
c=3*10**8 #light speed in m/s
dellamda=h*(1-(1/math.sqrt(2)))/(m0*c)
lamda0=2*10**-10
lamda=dellamda+lamda0
print "compton shift is dellamda=",round(dellamda/1e-10,4),"angstrom"
print "wavelength of the scattered X-rays is lamda=",round(lamda/1e-10,4),"angstrom"
#to calculate fraction of energy lost by the photon in the collision
#energy lost =E0-E/E0=(hc/lamda0)-(hc/lamda)/(ha/lamda0)
#we get,
energylost=dellamda/lamda
print "energylost =",round(energylost,5),"unitless"
import math
#to calculate wavelength and energy
#formula is lamda'-lamda=h*(1-cos phi)/(m0*c),where phi=90 degree, lamda'=2lamda ---------------eq(1)
#dellamda=2lamda-lamda=lamda ----------------------------eq(2)
h=6.62*10**-34 #planck's constant
c=3*10**8 #light speed in m.s
m0=9*10**-31 #mass of electron in kg
#from eq(1) and eq(2) ,we get
lamda=h/(m0*c)
print "wavelength is lamda=",round(lamda/1e-10,4),"angstrom"
E=h*c/lamda
print "energy of the incident photon is E=","{:.3e}".format(E),"J"
import math
#to calculate wavelength of radiation and direction of emission
h=6.6*10**-34 #planck's constant in J-s
c=3*10**8 #speed of light in m/s
energy=510*10**3 #energy of photon in eV
lamda=h*c/(energy*1.6*10**-19)
mo=9.1*10**-31 #mass of electron in Kg
lamda1=lamda+h*(1-math.cos(math.pi/2))/(mo*c)
print "wavelength of radiation is lamda1=","{:.3e}".format(lamda1),"m"
theta=math.degrees(math.atan(lamda*math.sin(math.pi/2)/(lamda1-lamda*math.cos(math.pi/2))))
print"direction of emission of electron is theta=",round(theta,3),"degree"
import math
#to calculate wavelength of two X-rays
h=6.6*10**-34 #planck's constant in J-s
c=3.0*10.0**8 #light speed in m/s
mo=9.1*10**-31 #mass of electron in kg
lamda=10.0*10**-12 #wavelength in pm
lamda1=lamda+((h/(mo*c))*(1-(1/math.sqrt(2))))
print "wavelength of two X-rays is lamda1=",round(lamda1*(1e12),3),"picometer"
#to calculate maximum wavelength
lamda2=lamda+((2*h)/(mo*c))
print "maximum wavelength present in the scattered X-rays is lamda2=",round(lamda2*(1e12),3),"picometer"
#to calculate maximum kinetic energy
Kmax=(h*c)*((1/lamda)-(1/lamda2))/(1.6*10**-19)
print "maximum kinetic energy of the recoil electrons is Kmax=",round(Kmax/1000.0,3),"KeV"
# the answer is slightly different due to approximation