import math
#Variable declaration
P=1#power in j/s
r=10**-10#Radius in m^2
#Calculations
R=(P*math.pi*r**2)/(4*math.pi)#Rate at which energy falls in J/sec
R_e=3.4*10**-19#in Joule, rate at energy removed
t=R_e/R
#Result
print "Time required for energy to clear is %.1e sec"%t
#Variable declaration
h=6.63*10**-34#Joule-sec
vo=5.6*10**14
#Calculations&Results
w=h*vo
print "power is %.1e per sec"%w
ev=(1/(1.6*10**-19))
wo=w*ev
print "Energy is %.1f ev"%wo
import math
#Variable declaration
p=1#j/s
r=1#radius in m
h=6.63*10**-34#Joule-sec
c=3*10**8#m/sec
lamda=5.89*10**-7#m
#Calculations
R=p/(4*math.pi*r**2)
E=(h*c)/lamda
Rate_R=R*(1/E)
#Result
print "Rate at which photons strike unit area of place %.1e photons/m^2-sec"%Rate_R
import math
#Variable declaration
h=6.63*10**-34#Joule-sec
c=3*10**8#m/sec
m_o=9.11*10**-31#in kg
#Calculations&Results
delta_h=(h*(1-math.cos(90*math.pi/180)))/(m_o*c)
print "Part(a)\nCompton shift is %.2e m"%delta_h
delta1=1*10**-10
K=(h*c*delta_h)/(delta1*(delta1+delta_h))
print "\nPart(b)\nX-ray beam is %.2e Joule"%K
delta2=1.88*10**-12
K=(h*c*delta_h)/(delta2*(delta2+delta_h))
print "X-ray beam is %.2e Joule"%K
E1=(h*c)/delta1
E1_ev=(6.241509*10**18)*E1
print "\nPart(c) \nX-ray energy is %.1f keV"%(E1_ev/10**3)
E2=(h*c)/delta2
E2_ev=(6.241509*10**18)*E2
print "X-ray energy is %.1f kev"%(E2_ev/10**3)
Per1=(100*.295*10**3)/E1_ev
Per2=(100*378*10**3)/E2_ev
print "Energy lost in percentage = %.1f "%Per1
print "Energy lost in percentage = %.f "%Per2
#Variable declaration
e=1.6*10**-19#in coul
v=4*10**4#in V
lamda=3*10**-11#in m
c=3*10**8#m/sec
#Calculations
h=(e*v*lamda)/c
#Result
print "Planck's constant is %.2e Joule-sec"%h
import math
#Variable declaration
e=1.6*10**-19#in coul
B=2*10**-1#weber/m2
r=2.5*10**-2#in m
#Calculations&Results
p=e*B*r
print "Momentum of electron %.1e Kg-m/sec"%p
x=1.5#in Mev, ie c^2*p^2
y=.51#in Mev
E_minus=math.sqrt(x**2+y**2)
E=2*E_minus#h*v
h=6.63*10**-34#Joule-sec
c=3*10**8#m/sec
lamda=(h*c)/(10**6*E*1.6*10**-19)
print "Photons wavelength is %.1e m"%lamda