# 5: Elements of Statistical Mechanics¶

## Example number 3, Page number 5.32¶

In [2]:
#importing modules
import math
from __future__ import division

#Variable declaration
E=5.5;          #energy(eV)
Ef=5;           #fermi energy(eV)
p=1/100;        #probability
e=1.6*10**-19;  #charge(coulomb)
k=1.38*10**-23; #boltzmann constant

#Calculation
x=E-Ef;         #difference in energy(eV)
y=math.log((1/p)-1);
T=x*e/(k*y);    #temperature(K)

#Result
print "temperature is",round(T,1),"K"
print "answer given in the book is wrong"

temperature is 1261.6 K
answer given in the book is wrong


## Example number 4, Page number 5.32¶

In [4]:
#importing modules
import math
from __future__ import division

#Variable declaration
rho=970;        #density(kg/m**3)
N=6.02*10**26;  #avagadro number
A=23;           #atomic weight(kg)
h=6.62*10**-34; #planks constant(Js)
m=9.1*10**-31;  #mass(kg)
e=1.6*10**-19;  #charge(coulomb)

#Calculation
n=rho*N/A;      #number of atoms per m**3
EF=(h**2/(8*m))*((3*n/math.pi)**(2/3));     #fermi energy(J)
EF=EF/e;        #fermi energy(eV)

#Result
print "fermi energy is",round(EF,2),"eV"

fermi energy is 3.15 eV