import math
#Variable declaration
k= 8.617*10**(-5) #Boltzmann constant, eV/K
To=273.0 #initial temperature, K
E1= -13.6 #energy of ground state, eV
E2= -3.4 #energy of first excited state, eV
dE= E2-E1 #difference in energy levels
g1=2.0 #number of energy states for E1
g2=8.0 #number of energy states for E2
#Calculation
J= dE/(k*To)
Nratio1= (g2/g1)*math.exp(-J) #ratio of number of atoms in level 2 and level 1 at To
T1=10273.0 #K
J1= J*To/T1
Nratio2= (g2/g1)*math.exp(-J1) #at T1
#Result
print"(a).The ratio at 273 K is:%.3g"%Nratio1,"(Approx)"
print"(b).The ratio at 10273 k is:%.g "%Nratio2
#Variable declaration
Moxygen= 16.0 #atomic mass,u
Mo2= 32.0 #Molecular mass, u
u= 1.66*(10**(-27)) #atomic mass unit, kg
Moxygen= Mo2*u #mass, kg
t= 273 #temperature, K
k= 1.38*10**(-23) #Boltzmann constant, J/K
#Calculation
Vrms= math.sqrt(3*k*t/Moxygen) # m/s
#Result
print"The rms velocity of oxygen is: ",round(Vrms),"m/s"
#Variable declaration
V= 1.00 #volume, cm**3
V= V*10**(-6) #converting to m**3
dI= 2.404 #standard value of definite Integral used
k= 8.617*10**(-5) #Boltzmann constant, eV/K
h= 4.13*(10**(-15)) #Planck's constant, eV.s
T= 1000 #temperature, K
c= 3 *(10**8) #speed of light, m/s
#Calculation
#Part (a)
N= 8*(math.pi)*V*dI*((k*T/(h*c))**3)
#Part(b)
Sig= 5.670*10**(-8) #Stefan's constant, W/m**2.K**4 , refer to Page 317
Ephoton= Sig*(c**2)*(h**3)*T/(2.405*(2*(math.pi)*(k**3))) #J
e_to_J=6.23*10**18*Ephoton #Converting to eV
#Result
print"(a),The number of photons is:%.3g"%N
print"(b)The average energy of the photons is:%.3g"%Ephoton,"J=",round(e_to_J,3),"eV"
#Variable declaration
T= 2.7 #blackbody temperature, K
Lambda= 2.898*10**(-3)/T #using wein's displacement law, Eqn 9.40, m
#Calculation
Lambda= Lambda*10**(3) #converting to mm
#Result
print"The wavelength for maximum radiation is: ",Lambda,"mm"
#Variable declaration
Rearth= 1.5*10**(11) #radius of earth, m
r= 1.4 #rate of arrival of sunlight, kW/m**2
#Calculation
P= (r*10**3)*4*(math.pi)*(Rearth**2) #total power reaching Earth
Rsun= 7*10**(8) #radius of Sun, m
r2= P/(4*(math.pi)*(Rsun**2)) #radiation rate of Sun, W/m**2
emissivity=1 #for blackbody
Sig= 5.670*10**(-8) #Stefan's constant, W/m**2.K**4
T= (r2/(emissivity*Sig))**(1.0/4.0)
#Result
print"The surface temperature of Sun is:%.2g"%T,"K"
#Variable declaration
u= 1.66*(10**(-27)) #atomic mass unit, kg
density= 8.94*10**(3) # kg/m**3
M= 63.5 #atomic mass of copper, u
#Calculation
Edensity= density/(M*u) #electron density, electrons/m**3
h= 6.63*(10**(-34)) #Planck's constant, J.s
Me= 9.1*(10**(-31)) #mass of electron, kg
Efermi= h**2/(2*Me)*((3*Edensity)/(8*(math.pi)))**(2.0/3.0) # J
e_to_J=6.23*10**18*Efermi #Converting to eV
#Result
print"The fermi energy is:%.3g"%Efermi,"J or",round(e_to_J,2),"eV"