Chapter 14 - Equilibrium and the third law¶

Example 1 - Pg 372¶

In [1]:
#calculate the equlibrium constant
#Initialization of variables
import math
n1=0.95
n2=0.05
n3=0.025
P=147 #psia
pa=14.7 #psia
#calculations
n=n1+n2+n3
p1=n1/n *P/pa
p2=n2/n *P/pa
p3=n3/n *P/pa
Kp1= p1/(p2*math.pow(p3,0.5))
Kp2= p1*p1 /(p2*p2 *p3)
#results
print '%s %.1f' %("In case 1, Equilibrium constant = ",Kp1)
print '%s %.1f' %("\n In case 2, Equilibrium constant =  ",Kp2)

In case 1, Equilibrium constant =  38.5

In case 2, Equilibrium constant =   1480.1


Example 2 - Pg 373¶

In [2]:
#calculate the degree of dissociation
#Initialization of variables
kp=5.
import numpy
from numpy import roots
#calculations
vec=numpy.roots([24,0, 3,-2])
x=vec[2]
vec2=numpy.roots([249,0,3,-2])
y=vec2[2]
#results
print '%s %.2f' %("\n degree of dissociation = ",x)
print '%s %.2f' %("\n If pressure =10 . degree of dissociation =",y)

 degree of dissociation =  0.34

If pressure =10 . degree of dissociation = 0.18

-c:12: ComplexWarning: Casting complex values to real discards the imaginary part
-c:13: ComplexWarning: Casting complex values to real discards the imaginary part


Example 3 - Pg 373¶

In [4]:
#calculate the degree of dissociation
#Initialization of variables
k=5.
import numpy
from numpy import roots
#calculations
p=[k*k-1, k-5*k*k,7*k*k, -3*k*k]
vec=roots(p)
x=vec[2]
#results
print '%s %.2f' %("degree of dissociation = ",x)

degree of dissociation =  0.78


Example 4 - Pg 395¶

In [5]:
#calculate the work done in all the cases
import math
#Initialization of variables
T=77+460. #R
x1=0.21
x2=1-x1
G=-169557 #Btu/mole
n1=1
n2=3.76
R0=1.986
v=0.0885
pi=14.7
J=778.
#calculations
dg1=-n1*R0*T*math.log(x1)
dg2=-n2*R0*T*math.log(x2)
dg=dg1+dg2
dG=dg+G
W=-dG
W2=-G
p=0.0004 #atm
G1=-n1*R0*T*math.log(1./p)
W3= -(dg1+G+G1)
dgf=v*pi*144/J
#results
print '%s %d %s' %("In case 1,Work done =",W,"Btu/mole C")
print '%s %d %s' %("\n In case 2,Work done =",W2,"Btu/mole C")
print '%s %d %s' %("\n In case 3,Work done =",W3,"Btu/mole C")
print '%s %.2f %s' %("\n In case 4,Work done =",dgf," Btu/mole C")

In case 1,Work done = 166947 Btu/mole C

In case 2,Work done = 169557 Btu/mole C

In case 3,Work done = 176236 Btu/mole C

In case 4,Work done = 0.24  Btu/mole C