#calculate the number of photons required
#Initialization of variables
import math
P=100. #W
t=10. #s
l=560. #nm
#calculations
TE=P*t
E1=6.626*math.pow(10,-34) *2.998*math.pow(10,8) /(l*math.pow(10,-9))
N=TE/E1
#results
print '%s %.2e' %("No. of photons required = ",N)
#calculate the wavelength of electrons
#Initialization of variables
import math
V=1000. #V
#calculations
l=6.626*math.pow(10,-34) /math.sqrt(2*9.11*math.pow(10,-31) *1.602*math.pow(10,-19) *V)
#results
print '%s %.2e %s' %("Wavelength of electrons =",l," m")
#calculate the no. of times the electron would be more propable at r2 than at r1
#Initialization of variables
import math
r1=0 #multiply by a0
r2=1 #multiply by a0
#calculations
ratio=math.pow(math.e,r1) /math.pow(math.e,(-2.*r2))
#results
print '%s %.2f %s' %("It is more propable that electron would be found",ratio,"times more at r1")
print '%s' %("The answer is a bit different due to rounding off error in textbook")
#calculate the uncertainity in position
#Initialization of variables
import math
m=1 #g
v=math.pow(10,-6) #m/s
#calculations
dx=1.054*math.pow(10,-34) /(2*m*math.pow(10,-3) *v)
#results
print '%s %.1e %s' %("Uncertainity in position =",dx," m")
#calculate the surface temperature
#Initialization of variables
import math
lmax=4.9*math.pow(10,-7) #m
#calculations
T=2.9*math.pow(10,-3) /lmax
#results
print '%s %d %s' %("Surface temperature must be close to",T,"K")
#calculate the separation between adjacent levels frequency and energy
#Initialization of variables
import math
k=516. #N/m
m=1.67*math.pow(10,-27) #kg
#calculations
v=math.sqrt(k/m) /(2*math.pi)
E=6.624*math.pow(10,-34) *v
#results
print '%s %.2e %s' %("Separation between adjacent levels frequency,",v,"Hz")
print '%s %.2e %s' %("\n Energy =",E,"J")