import math
import numpy as np
import scipy
from scipy import integrate
#Variable declaration
R = 1.985
#Calculations
#from equation 11.31,
f = lambda x:(x**3/(np.exp(x)-1))
integ,err = integrate.quad(f,0,1)
Cv = 9*R*4*integ*1/math.exp(1)-1
#Result
print "Cv = %.2f cal/mole K"%Cv
#Incorrect answer in the textbook
import math
#Variable declaration
h=6.6*10**-34#in J-s
v=1*10**7#per sec
K=1.4*10**-23#in J-K
T=300#in K
#calculations
n=math.exp(-((h*v)/(K*T)))
#Result
print "The Boltzan factor is %.1e Tesla"%(1-n)
import math
#Calculations&Results
#Part a
A=108#in g/mole
M=10.5#in g/cm3
D=6.02*10**23#in atom/mole
n=((D*M)/A)*100
h=6.6*10**-34
print "The fermi energy is %.1e electron/cm**3"%n
m=9.1*10**-31#in kg
x=((3*n)/(math.pi))**(2/3)
Ef=(h**2/(8*m))*x
print "The energy is %.1e J"%Ef
#part b
K=1.38*10**-23#in J-K
T=300#in K
z=(n*h**3)/(2*math.pi*m*K*T)**(3./2)
print "\nThe degeneracy term is %.1e "%z
#Incorrect answers in the textbook