# Chapter 6 - Chemical Equilibrium¶

## Example 1 - pg 353¶

In [1]:
#calculate the value of Kc
#initialisation of variables
d= 3.880 #g l^-1
M= 208.3 #gm
P= 1 #atm
R= 0.08205 #cal/mol K
T= 473.1 #K
#CALCULATIONS
d1= M*P/(R*T)
d2= (d1-d)/d
Kp= d2**2/(1-d2**2)
Kc= Kp/(R*T)
#RESULTS
print '%s %.3e %s' %(' Kc =',Kc,'moles l^-1')
print '%s %.4f %s' %(' Kp =',Kp,'atm')
print '%s %.4f' %('Fraction dissociated = ',d2)

 Kc = 4.429e-03 moles l^-1
Kp = 0.1719 atm
Fraction dissociated =  0.3830


## Example 2 - pg 353¶

In [2]:
#calculate the percentage of Pcl5 dissociated
#initialisation of variables
import math
P= 10 #atm
Kp= 0.1719
#CALCULATIONS
a= math.sqrt(Kp/(10+Kp))*100
#RESULTS
print '%s %.3f %s' % (' percentage =',a,'percent')

 percentage = 13.000 percent


## Example 3 - pg 354¶

In [3]:
#calculate the value of Kp
#initialisation of variables
P= 0.3429 #atm
p0= 0.3153 #atm
#CALCULATIONS
Kp= (2*(P-p0))**2/(2*p0-P)
#RESULTS
print '%s %.2e %s' % (' Kp =',Kp,'atm')

 Kp = 1.06e-02 atm


## Example 4 - pg 355¶

In [4]:
#calculate the pressure required
#initialisation of variables
Kp= 1.06*10**-2 #atm
a= 0.990
#CALCULATIONS
P= Kp*(1-a**2)/(4*a**2)
#RESULTS
print '%s %.2e %s' % (' pressure =',P,' atm')

 pressure = 5.38e-05  atm


## Example 5 - pg 357¶

In [5]:
#calculate the pressure required
#initialisation of variables
G= 2054.7 #cal
R= 1.9872 #cal/mol K
T= 298.16 #K
#CALCULATIONS
P= 10**(-G/(2.303*T*R))
#RESULTS
print '%s %.5f %s' % (' pressure =',P,'atm')

 pressure = 0.03120 atm


## Example 7 - pg 359¶

In [6]:
#calculate the solubility product constant
#initialisation of variables
T= 25 #C
H= 25.31 #cal
H1= -40.02 #cal
H2= -30.36 #cal
S1= 17.67 #cal deg^-1
S2= 13.17 #cal deg^-1
S3= -22.97 #cal deg^-1
R= 1.987 #cal/mol K
#CALCULATIONS
H3= (H+H1-H2)*1000
S4= S1+S2+S3
G= H3-(273.2+T)*S4
Ka= 10**(-G/(2.303*R*(273.2+T)))
#RESULTS
print '%s %.1e' %(' solubility product constant = ',Ka)

 solubility product constant =  1.8e-10


## Example 8 - pg 359¶

In [7]:
#calculate the increase in free energy
#initialisation of variables
import math
T= 25 #C
H= -36430 #cal
S= -4.19 #cal deg^-1
a= 0.1
f= 0.2
R= 1.987 #cal/mol K
#CALCULATIONS
G= H-(273.2+T)*S
Q= a*f/a**2
G1= G+R*(273.2+T)*math.log(Q)
#RESULTS
print '%s %.1f %s' % (' increase in free energy =',G1, 'cal')

 increase in free energy = -34769.8 cal


## Example 9 - pg 361¶

In [8]:
#calculate the free energy of formation
#initialisation of variables
H= 21600. #cal
S= 50.339 #cal
S1= 49.003 #cal
S2= 45.767 #cal
T= 298.2 #K
#CALCULATIONS
H1= 2*H
S1= 2*S-S1-S2
G= H1-T*S1
Gj= G/(2*1000)
#RESULTS
print '%s %.3f %s' % (' free energy of formation =',Gj,'kcal')

 free energy of formation = 20.719 kcal


## Example 10 - pg 361¶

In [9]:
#calculate the range of humidity
#initialisation of variables
R= 1.987 #cal/mol K
T= 25. #C
G1= -193.8 #cal
G2= -54.6 #cal
G3= -253.1 #cal
G4= -253.1 #cal
G5= -54.6 #cal
G6= -309.7 #cal
#CALCULATIONS
G= G1+G2-G3
Ph= 10**(-G*10**3/(2.303*R*(273.2+T)))
G0= G4+G5-G6
Ph1= 10**(-G0*10**3/(2.303*R*(273.2+T)))
p= Ph*100./Ph1
#RESULTS
print '%s %.2f %s' %(' range of humidity =',p,'percent')
print 'The answers are a bit different due to rounding off error in textbook'

 range of humidity = 1.05 percent
The answers are a bit different due to rounding off error in textbook


## Example 11 - pg 362¶

In [10]:
#calculate the Ksp
#initialisation of variables
m= 10**-2
m1= 10**-22
G= -22.15 #kcal
G1= -5.81 #kcal
G2= 20.6 #kcal
T= 25 #C
R= 1.987 #cal/mol K
#CALCULATIONS
G3= G-(G1+G2)
Ksp= 10**(G3*10**3/(2.303*R*(273+T)))
#RESULTS
print '%s %.0e' %(' Ksp = ',Ksp)

 Ksp =  8e-28


## Example 12 - pg 366¶

In [1]:
#calculate the heat of dissociation and standard free energy of iodine
%matplotlib inline
import numpy
import math
import matplotlib
from matplotlib import pyplot
import warnings
#initialization of variables
R=1.987
T=1000 #K
T=numpy.array([973.,1073.,1173.,1274.])
kp=numpy.array([.175e-2,1.108e-2,4.87e-2,17.05e-2])
#calculations
Tx=1000./T
logkp=numpy.log10(kp)
slope, intercept = numpy.polyfit(Tx,logkp,1)
dH=-slope*2.303*R*1000.
dH0=dH-1.5*R*T
dG1=-R*T*logkp[1]*2.303
dGt=28720 #cal
dGI=(dGt/1000. + 4.63)/2
#results
print '%s %d %s' %('Heat of dissociation = ',dH,'cal')
print '%s %.2f %s' %('standard free energy of iodine atom = ',dGI,'kcal/mol')
pyplot.plot(Tx,logkp)
pyplot.xlabel('1000/T')
pyplot.ylabel('log Kp')
pyplot.title('Logarithm of Kp for dissociation of Iodine as a function of reciprocal temperature')
pyplot.show()
warnings.filterwarnings("ignore")
print 'The answers are a bit different due to rounding off error in textbook'

Heat of dissociation =  37460 cal
standard free energy of iodine atom =  16.68 kcal/mol

The answers are a bit different due to rounding off error in textbook


## Example 13 - pg 361¶

In [12]:
#calculate the Partial pressure
#initialisation of variables
import math
T= 2000 #K
P= 1 #atm
G= 41438 #cal
R= 1.987 #cal/mol K
T2= 298.2 #K
T1= 2000 #K
H= 43200 #cal
#CALCULATIONS
Kp= 10**(-G/(2.303*R*T2))
Kp1= Kp*10**(H*(T-T2)/(2.303*R*T1*T2))
p= math.sqrt(Kp1*0.8*0.2)
#RESULTS
print '%s %.1e %s' % (' Partial pressure of NO =',p,'atm ')

 Partial pressure of NO = 7.7e-03 atm


## Example 15 - pg 368¶

In [13]:
#calculate the Temperature required
#initialisation of variables
G0 = 0 #cal
G= 13200. #cal
T1= 298.2
H1= 23100. #cal
#CALCULATIONS
T= H1/((H1/T1)-(G/T1)+(G0/T1))
#RESULTS
print '%s %.1f %s' % (' Temperature =',T,' K ')

 Temperature = 695.8  K


## Example 16 - pg 373¶

In [14]:
#calculate the Equilibrium constant
#initialisation of variables
T= 2000 #K
R= 1.987 #cal /mol K
G= 31160 #cal
#CALULATIONS
Kp= 10**(-G/(2.303*R*T))
#RESULTS
print '%s %.2e' % ('Equilibrium constant =',Kp  )

Equilibrium constant = 3.94e-04


## Example 17 - pg 373¶

In [15]:
#calculate the fraction of methane decomposed
#initialisation of variables
p= 0.08 #atm
#CALCULATIONS
a= (1-p)/(p+1)
#RESULTS
print '%s %.2f' % ('fraction =  ',a)

fraction =   0.85


## Example 18 - pg 374¶

In [16]:
#calculate the enthalpy of the reaction
#initialisation of variables
H= -57240. #cal
T= 2257. #C
Hh= -54.60 #cal
Ho= -38.56 #cal
HO= -57.08 #cal
#CALCULATIONS
H1= H-T*(2*Hh-2*Ho-HO)
#RESULTS
print '%s %.1f %s' % (' Enthalpy =',H1,'cal')
print 'The answers in the textbook are a different due to a rounding off error '

 Enthalpy = -113665.0 cal
The answers in the textbook are a different due to a rounding off error


## Example 19 - pg 375¶

In [17]:
#calculate the Enthalpy
#initialisation of variables
H= -57797 #cal
T= 25 #C
Hh= 7.934 #cal
Ho= -6.788 #cal
HO= 6.912 #cal
#CALCULATIONS
H1= 2*H-(T+273.16)*(2*Hh+2*Ho-HO)
#RESULTS
print '%s %.1f %s' % (' Enthalpy =',H1,'cal ')
print 'The answers in the textbook are a different due to a rounding off error '

 Enthalpy = -114216.5 cal
The answers in the textbook are a different due to a rounding off error