Chapter 1:Preliminary Concepts

Example no:1,Page no:258

In [3]:
#Variable declaration
N=2                                                          #no. of particles
n1=2                                                         #occupation no. of particles
g1=3                                                                           #degeneracy of particles

#Calculation
import math
#(i) particles are distinguishable
state1=(math.factorial(N)*g1**n1)/math.factorial(n1)                         #possible microstates of distinguishable particles
#(ii) particles are indistinguishable bosons 
state2=math.factorial(n1+g1-1)/(math.factorial(n1)*math.factorial(g1-1))     #possible microstates of indistinguishable bosons
#(iii) particles are indistinguishable fermions
state3=math.factorial(g1)/(math.factorial(n1)*math.factorial(g1-n1))         #possible microstates of indistinguishable fermions

#Result
print"\n(i) Ω(distinguishable) =",state1,"\n(ii) Ω(indistinguishable bosons) = ",state2,"\n(iii) Ω(indistinguishable fermions) =",state3 
(i) Ω(distinguishable) = 9 
(ii) Ω(indistinguishable bosons) =  6 
(iii) Ω(indistinguishable fermions) = 3

Example no:2,Page no:259

In [10]:
#Variable declaration
N=4                                                                             #no. of particles
A1=[2,0,0,2]                                                                    #possible macrostate
A2=[1,1,1,1]                                                                    #possible macrostate
A3=[0,3,0,1]                                                                    #possible macrostate
A4=[1,0,3,0]                                                                    #possible macrostate
A5=[0,2,2,0]                                                                    #possible macrostate
g1=1                                                                            #degeneracy of particles
g2=2                                                                            #degeneracy of particles
g3=2                                                                            #degeneracy of particles
g4=1                                                                            #degeneracy of particles

import math
#(i) particles are distinguishable
print"\n(i)Possible macrostates are\n "
print A1,A2,A3,A4,A5
micro1=((math.factorial(N)*g1**A1[0]*g2**A1[1]*g3**A1[2]*g4**A1[3])/(math.factorial(A1[0])*math.factorial(A1[1])*math.factorial(A1[2])*math.factorial(A1[3])))      #The number of microstates
micro2=((math.factorial(N)*g1**A2[0]*g2**A2[1]*g3**A2[2]*g4**A2[3])/(math.factorial(A2[0])*math.factorial(A2[1])*math.factorial(A2[2])*math.factorial(A2[3])))      #The number of microstates
micro3=((math.factorial(N)*g1**A3[0]*g2**A3[1]*g3**A3[2]*g4**A3[3])/(math.factorial(A3[0])*math.factorial(A3[1])*math.factorial(A3[2])*math.factorial(A3[3])))      #The number of microstates
micro4=((math.factorial(N)*g1**A4[0]*g2**A4[1]*g3**A4[2]*g4**A4[3])/(math.factorial(A4[0])*math.factorial(A4[1])*math.factorial(A4[2])*math.factorial(A4[3])))      #The number of microstates
micro5=((math.factorial(N)*g1**A5[0]*g2**A5[1]*g3**A5[2]*g4**A5[3])/(math.factorial(A5[0])*math.factorial(A5[1])*math.factorial(A5[2])*math.factorial(A5[3])))      #The number of microstates

print"No. of macrostates is given by:"
print A1,"=",micro1,"\n",A2,"=",micro2,"\n",A3,"=",micro3,"\n",A4,"=",micro4,"\n",A5,"=",micro5,"\n",

print"\nMost probable macrostates are\n " 
if(micro1>=micro2 and micro1>=micro3 and micro1>=micro4 and micro1>=micro5) :
    print A1 
 
if(micro2>=micro1 and micro2>=micro3 and micro2>=micro4 and micro2>=micro5) :
    print A2 
 
if(micro3>=micro1 and micro3>=micro2 and micro3>=micro4 and micro3>=micro5) :
    print A3 
 
if(micro4>=micro1 and micro4>=micro2 and micro4>=micro3 and micro4>=micro5) :
    print A4 
 
if(micro5>=micro1 and micro5>=micro2 and micro5>=micro3 and micro5>=micro4) :
    print A5 
 

#(ii) particles are indistinguishable bosons
print"\n(ii)Possible macrostates are\n " 
print A1,A3,A3,A4,A5
micro1=(math.factorial(A1[0]+g1-1)*math.factorial(A1[1]+g2-1)*math.factorial(A1[2]+g3-1)*math.factorial(A1[3]+g4-1))/(math.factorial(A1[0])*math.factorial(A1[1])*math.factorial(A1[2])*math.factorial(A1[3])*math.factorial(g1-1)*math.factorial(g2-1)*math.factorial(g3-1)*math.factorial(g4-1)) 
micro2=(math.factorial(A2[0]+g1-1)*math.factorial(A2[1]+g2-1)*math.factorial(A2[2]+g3-1)*math.factorial(A2[3]+g4-1))/(math.factorial(A2[0])*math.factorial(A2[1])*math.factorial(A2[2])*math.factorial(A2[3])*math.factorial(g1-1)*math.factorial(g2-1)*math.factorial(g3-1)*math.factorial(g4-1)) 
micro3=(math.factorial(A3[0]+g1-1)*math.factorial(A3[1]+g2-1)*math.factorial(A3[2]+g3-1)*math.factorial(A3[3]+g4-1))/(math.factorial(A3[0])*math.factorial(A3[1])*math.factorial(A3[2])*math.factorial(A3[3])*math.factorial(g1-1)*math.factorial(g2-1)*math.factorial(g3-1)*math.factorial(g4-1)) 
micro4=(math.factorial(A4[0]+g1-1)*math.factorial(A4[1]+g2-1)*math.factorial(A4[2]+g3-1)*math.factorial(A4[3]+g4-1))/(math.factorial(A4[0])*math.factorial(A4[1])*math.factorial(A4[2])*math.factorial(A4[3])*math.factorial(g1-1)*math.factorial(g2-1)*math.factorial(g3-1)*math.factorial(g4-1)) 
micro5=(math.factorial(A5[0]+g1-1)*math.factorial(A5[1]+g2-1)*math.factorial(A5[2]+g3-1)*math.factorial(A5[3]+g4-1))/(math.factorial(A5[0])*math.factorial(A5[1])*math.factorial(A5[2])*math.factorial(A5[3])*math.factorial(g1-1)*math.factorial(g2-1)*math.factorial(g3-1)*math.factorial(g4-1)) 

print"No. of macrostates is given by:"
print A1,"=",micro1,"\n",A2,"=",micro2,"\n",A3,"=",micro3,"\n",A4,"=",micro4,"\n",A5,"=",micro5,"\n"

print"\nMost probable macrostate is\n "
if(micro1>=micro2 and micro1>=micro3 and micro1>=micro4 and micro1>=micro5) :
    print A1
 
if(micro2>=micro1 and micro2>=micro3 and micro2>=micro4 and micro2>=micro5) :
    print A2 
 
if(micro3>=micro1 and micro3>=micro2 and micro3>=micro4 and micro3>=micro5) :
    print A3 
 
if(micro4>=micro1 and micro4>=micro2 and micro4>=micro3 and micro4>=micro5) :
    print A4 
 
if(micro5>=micro1 and micro5>=micro2 and micro5>=micro3 and micro5>=micro4) :
    print A5 
 

#(iii) Particles are indistinguishable fermions
print"\n(iii)Possible macrostates are\n "
print A2,A5
micro2=4/(math.factorial(A2[0])*math.factorial(A2[1])*math.factorial(A2[2])*math.factorial(A2[3])*math.factorial(g1-A2[0])*math.factorial(g2-A2[1])*math.factorial(g3-A2[2])*math.factorial(g4-A2[3])) 
micro5=4/(math.factorial(A5[0])*math.factorial(A5[1])*math.factorial(A5[2])*math.factorial(A5[3])*math.factorial(g1-A5[0])*math.factorial(g2-A5[1])*math.factorial(g3-A5[2])*math.factorial(g4-A5[3])) 

print"No. of macrostates is given by:"
print A2,"=",micro2,"\n",A5,"=",micro5,"\n"

print"\nMost probable macrostate is\n "
if(micro2>=micro5) :
    print A2
 
if(micro5>=micro2) :
    print A5 
 
(i)Possible macrostates are
 
[2, 0, 0, 2] [1, 1, 1, 1] [0, 3, 0, 1] [1, 0, 3, 0] [0, 2, 2, 0]
No. of macrostates is given by:
[2, 0, 0, 2] = 6 
[1, 1, 1, 1] = 96 
[0, 3, 0, 1] = 32 
[1, 0, 3, 0] = 32 
[0, 2, 2, 0] = 96 

Most probable macrostates are
 
[1, 1, 1, 1]
[0, 2, 2, 0]

(ii)Possible macrostates are
 
[2, 0, 0, 2] [0, 3, 0, 1] [0, 3, 0, 1] [1, 0, 3, 0] [0, 2, 2, 0]
No. of macrostates is given by:
[2, 0, 0, 2] = 1 
[1, 1, 1, 1] = 4 
[0, 3, 0, 1] = 4 
[1, 0, 3, 0] = 4 
[0, 2, 2, 0] = 9 


Most probable macrostate is
 
[0, 2, 2, 0]

(iii)Possible macrostates are
 
[1, 1, 1, 1] [0, 2, 2, 0]
No. of macrostates is given by:
[1, 1, 1, 1] = 4 
[0, 2, 2, 0] = 1 


Most probable macrostate is
 
[1, 1, 1, 1]

Example no:3,Page no:262

In [13]:
#vairable initialization
N=4                                                                             #no. of particles
A1=(4,0)                                                                        #possible macrostate
A2=(3,1)                                                                        #possible macrostate
A3=(2,2)                                                                        #possible macrostate
A4=(1,3)                                                                        #possible macrostate
A5=(0,4)                                                                        #possible macrostate
import math
#calculation
print"\nPossible macrostates are\n "
print A1,A2,A3,A4,A5
micro1=math.factorial(N)/(math.factorial(A1[0])*math.factorial(A1[1]))                         #no. of microstate corresponding to macrostate1
micro2=math.factorial(N)/(math.factorial(A2[0])*math.factorial(A2[1]))                         #no. of microstate corresponding to macrostate2
micro3=math.factorial(N)/(math.factorial(A3[0])*math.factorial(A3[1]))                         #no. of microstate corresponding to macrostate3
micro4=math.factorial(N)/(math.factorial(A4[0])*math.factorial(A4[1]))                        #no. of microstate corresponding to macrostate4
micro5=math.factorial(N)/(math.factorial(A5[0])*math.factorial(A5[1]))                         #no. of microstate corresponding to macrostate5
print"No.of macrostates is:"
print A1,"=",micro1,"\n",A2,"=",micro2,"\n",A3,"=",micro3,"\n",A4,"=",micro4,"\n",A5,"=",micro5,"\n"


print"\nTotal no. of microstates are ",micro1+micro2+micro3+micro4+micro5
print"\nMost probable macrostate is\n " 
if(micro1>=micro2 and micro1>=micro3 and micro1>=micro4 and micro1>=micro5) :
    print A1
if(micro2>=micro1 and micro2>=micro3 and micro2>=micro4 and micro2>=micro5) :
    print A2
if(micro3>=micro1 and micro3>=micro2 and micro3>=micro4 and micro3>=micro5):
    print A3
if(micro4>=micro1 and micro4>=micro2 and micro4>=micro3 and micro4>=micro5):
    print A4
if(micro5>=micro1 and micro5>=micro2 and micro5>=micro3 and micro5>=micro4):
    print A5
Possible macrostates are
 
(4, 0) (3, 1) (2, 2) (1, 3) (0, 4)
No.of macrostates is:
(4, 0) = 1 
(3, 1) = 4 
(2, 2) = 6 
(1, 3) = 4 
(0, 4) = 1 


Total no. of microstates are  16

Most probable macrostate is
 
(2, 2)

Example no:4,Page no:263

In [17]:
#Variable declaration
N=4                                                                             #no. of particles
A1=(1,0,1,2)                                                                    #possible macrostate
A2=(0,2,0,2)                                                                    #possible macrostate
A3=(0,1,2,1)                                                                    #possible macrostate
A4=(0,0,4,0)                                                                    #possible macrostate

#calculation
print"\nPossible macrostates are\n "
print A1,A2,A3,A4
micro1=math.factorial(N)/(math.factorial(A1[0])*math.factorial(A1[1])*math.factorial(A1[2])*math.factorial(A1[3]))                         #no. of microstate corresponding to macrostate1
micro2=math.factorial(N)/(math.factorial(A2[0])*math.factorial(A2[1])*math.factorial(A2[2])*math.factorial(A2[3]))                         #no. of microstate corresponding to macrostate2
micro3=math.factorial(N)/(math.factorial(A3[0])*math.factorial(A3[1])*math.factorial(A3[2])*math.factorial(A3[3]))                         #no. of microstate corresponding to macrostate3
micro4=math.factorial(N)/(math.factorial(A4[0])*math.factorial(A4[1])*math.factorial(A4[2])*math.factorial(A4[3]))                         #no. of microstate corresponding to macrostate4
print"\nThe number of microstates belonging to the above macrostates is:"
print A1,"=",micro1,"\n",A2,"=",micro2,"\n",A3,"=",micro3,"\n",A4,"=",micro4,"\n"
Possible macrostates are
 
(1, 0, 1, 2) (0, 2, 0, 2) (0, 1, 2, 1) (0, 0, 4, 0)

The number of microstates belonging to the above macrostates is:
(1, 0, 1, 2) = 12 
(0, 2, 0, 2) = 6 
(0, 1, 2, 1) = 12 
(0, 0, 4, 0) = 1 

Example no:5,Page no:264

In [22]:
def p(A):                                                      #function to calculate probability
    probability=1 
    i=0
    for i in range(0,7):
        probability=probability*(math.factorial(A[i]+2))/(2*math.factorial(A[i])) 
    return(probability)
#Variable declaration
A1=(5,0,0,0,0,0,1)                         #possible macrostate
A2=(4,1,0,0,0,1,0)                         #possible macrostate
A3=(4,0,1,0,1,0,0)                         #possible macrostate
A4=(3,2,0,0,1,0,0)                         #possible macrostate
A5=(4,0,0,2,0,0,0)                         #possible macrostate
A6=(3,1,1,1,0,0,0)                         #possible macrostate
A7=(2,3,0,1,0,0,0)                         #possible macrostate
A8=(3,0,3,0,0,0,0)                         #possible macrostate
A9=(2,2,2,0,0,0,0)                         #possible macrostate
A10=(1,4,1,0,0,0,0)                        #possible macrostate
A11=(0,6,0,0,0,0,0)                        #possible macrostate

#calculation
p1=p(A1)                                   #Thermodynamic probability of macrostate 1
p2=p(A2)                                   #Thermodynamic probability of macrostate 2
p3=p(A3)                                   #Thermodynamic probability of macrostate 3
p4=p(A4)                                   #Thermodynamic probability of macrostate 4
p5=p(A5)                                   #Thermodynamic probability of macrostate 5
p6=p(A6)                                   #Thermodynamic probability of macrostate 6
p7=p(A7)                                   #Thermodynamic probability of macrostate 7
p8=p(A8)                                   #Thermodynamic probability of macrostate 8
p9=p(A9)                                   #Thermodynamic probability of macrostate 9
p10=p(A10)                                 #Thermodynamic probability of macrostate 10
p11=p(A11)                                 #Thermodynamic probability of macrostate 11

print"\nP1 =",p1,"P2 =",p2,"P3 =",p3,"P4 =",p4,"P5 =",p5,"P6 =",p6,"P7 =",p7,"P8 =",p8,"P9 =",p9,"P10 =",p10,"P11 =",p11
print"\nThermodyanmic probability of the system = ",p1+p2+p3+p4+p5+p6+p7+p8+p9+p10+p11
P1 = 63 P2 = 135 P3 = 135 P4 = 180 P5 = 90 P6 = 270 P7 = 180 P8 = 100 P9 = 216 P10 = 135 P11 = 28

Thermodyanmic probability of the system =  1532

Example no:6,Page no:265

In [27]:
import math
def p(A):                                                            #function to calculate no. of microstates
    micro=1 
    i=1
    for i in range(0,5):
        micro=micro*(6/(math.factorial(A[i])*math.factorial(3-A[i]))) 
    return(micro)
#Variable declaration
A1=(3,2,0,0,1)                                     #possible macrostate
A2=(3,1,1,1,0)                                     #possible macrostate
A3=(2,3,0,1,0)                                     #possible macrostate
A4=(3,0,3,0,0)                                     #possible macrostate
A5=(2,2,2,0,0)                                     #possible macrostate

#calculation
p1=p(A1)                                           #no. of microstates
p2=p(A2)                                           #no. of microstates
p3=p(A3)                                           #no. of microstates
p4=p(A4)                                           #no. of microstates
p5=p(A5)                                           #no. of microstates

print"No.of microstates associated with macrostates are :"
print A1,"=",p1,"\n",A2,"=",p2,"\n",A3,"=",p3,"\n",A4,"=",p4,"\n",A5,"=",p5,"\n"
print"\nThe thermodynamic probability of the system = ",(p1+p2+p3+p4+p5)
No.of microstates associated with macrostates are :
(3, 2, 0, 0, 1) = 9 
(3, 1, 1, 1, 0) = 27 
(2, 3, 0, 1, 0) = 9 
(3, 0, 3, 0, 0) = 1 
(2, 2, 2, 0, 0) = 27 


The thermodynamic probability of the system =  73