# Chapter 4 - Second and Third laws of thermodynamics¶

## Example 1 - pg 192¶

In [1]:
#calculate the maximum efficiency in all cases
#initialisation of variables
T = 100. #C
T1= 25. #C
T2= 150. #C
T3= 357. #C
T4= 500. #C
T5= 2000. #C
T6= 5*10**6
T7= 1000. #C
#CALCULATIONS
e= (T-T1)/(T+273)
e1= (T2-T1)/(273+T2)
e2= (T3-T)/(273+T3)
e3= (T5-T4)/(T5+273)
e4= (T6-T7)/T6
#RESULTS
print '%s %.2f' % (' maximum efficiency in case 1= ',e)
print '%s %.2f' % (' \n maximum efficiency in case 2 =  ',e1)
print '%s %.2f' % (' \n maximum efficiency in case 3 =  ',e2)
print '%s %.2f' % (' \n maximum efficiency in case 4 =  ',e3)
print '%s %.2f' % (' \n maximum efficiency in case 5 =  ',e4)

 maximum efficiency in case 1=  0.20

maximum efficiency in case 2 =   0.30

maximum efficiency in case 3 =   0.41

maximum efficiency in case 4 =   0.66

maximum efficiency in case 5 =   1.00


## Example 2 - pg 194¶

In [2]:
#calculate the maximum efficiency and minimum work
#initialisation of variables
T= 20. #C
T1= -10. #C
q= 1000. #cal
#CALCULATIONS
e= (273+T1)/(T-T1)
w= (T-T1)*q/(273+T1)
#RESULTS
print '%s %.1f' % (' maximum efficiency = ',e)
print '%s %d %s' % (' \n minimum work =',w,'cal')

 maximum efficiency =  8.8

minimum work = 114 cal


## Example 3 - pg 197¶

In [3]:
#calculate the net work done on and by the gas
#initialisation of variables
T= 1000 #K
T1= 400 #/K
w= 1000 #cal
E= 0 #cal
gam=7/5.
#CALCULATIONS
q= w-E
W= q*(T-T1)/T
q1= W-q
W1= -q1
dE=5/2.*(T1-T)
dH=7/2. *(T1-T)
w2=dE-E
w3=(T-T1)/(gam-1)
#RESULTS
print '%s %.1f %s' % ('net work done by gas=',W,' cal')
print '%s %.1f %s' % ('net work done on gas =',W1,'cal')
print '%s %.1f %s' %('Change in Internal energy = ',dE,'R cal')
print '%s %.1f %s' %('Change in Enthalpy = ',dH,'R cal')
print '%s %.1f %s' %('Work for adiabatic compression =',w3,'R cal')

net work done by gas= 600.0  cal
net work done on gas = 400.0 cal
Change in Internal energy =  -1500.0 R cal
Change in Enthalpy =  -2100.0 R cal
Work for adiabatic compression = 1500.0 R cal


## Example 4 - pg 199¶

In [4]:
#calculate the entropy of substances
#initialisation of variables
import numpy as np
Hv= np.array([1960.,1560.,4880.,37000.,5500.,27400.,60700.,9720.,30900.]) #cal mole^-1
Tb= np.array([112.,87.3,239.,1806.,259.,1180.,2466.,373.,1029.]) #K
#CALCULATIONS
Sv= np.round(Hv/Tb,1)
#RESULTS
print '%s' % (' Entropy (cal mole deg^-1)')
print Sv

 Entropy (cal mole deg^-1)
[ 17.5  17.9  20.4  20.5  21.2  23.2  24.6  26.1  30. ]


## Example 5 - pg 201¶

In [5]:
#calculate the entropy at constant pressure and volume
#initialisation of variables
import math
T= 300. #K
T1= 400. #K
k= 6.0954
k1= 3.2533*10**-3
k2= -1.0171*10**-6
R= 1.98719 #cal/mol K
#CALCULATIONS
S= 2*(k*math.log(T1/T)+k1*(T1-T)+k2*(T1**2-T**2)/2)
S1= S-2*R*math.log(T1/T)
#RESULTS
print '%s %.4f %s' % (' Entropy=',S,' cal  deg^-1')
print '%s %.4f %s' % (' \n Entropy =',S1,'cal  deg^-1')

 Entropy= 4.0865  cal  deg^-1

Entropy = 2.9432 cal  deg^-1


## Example 8 - pg 216¶

In [6]:
#calculate the final temperature
#initialisation of variables
T1= 273.16 #K
R= 1.987 #cal /mol K
R1= 0.08205 #J /mol K
n= 10 #moles
V1= 22.4 #lit
a= 1.36
Cv= 4.9
#CALCULATIONS
T2= T1-(R*a*(n-1)/(R1*n*Cv*V1))
#RESULTS
print '%s %.2f %s' % (' temperature=',T2,' K')

 temperature= 272.89  K


## Example 9 - pg 218¶

In [7]:
#calculate the inversion Temperature
#initialisation of variables
a= 1.360 #l^2 atm mole^-1
b= 0.0317 #l mole^-1
R= 0.08205 #J/mol K
#CALCULATIONS
T= 2*a/(b*R)
#RESULTS
print '%s %.1f %s' % ('Inversion Temperature=',T,'K')
print 'The answer is a bit different due to rounding off error in textbook'

Inversion Temperature= 1045.8 K
The answer is a bit different due to rounding off error in textbook


## Example 10 - pg 218¶

In [8]:
#calculate the joule thomson coefficient
#initialisation of variables
a= 1.360 #l^2 atm mole^-1
b= 0.0317 #l mole^-1
R= 0.08205 #J/mol K
R1= 1.987 #cal/mole K
Cp= 6.9 #cal mole^-1 deg^-1
T= 273.2 #K
#CALCULATIONS
u= ((2*a/(R*T))-b)/(Cp*(R/R1))
#RESULTS
print '%s %.3f %s' % (' Joule thomson coefficient=',u,' atm^-1')

 Joule thomson coefficient= 0.315  atm^-1


## Example 12 - pg 221¶

In [1]:
#Calculate the increase in entropy
#initialisation of variables
import math
p= 4/3. #atm
p1= 1 #atm
R= 1.9872 #cal /mole K
#CALCULATIONS
S= 2*R*math.log(p/p1)
#RESULTS
print '%s %.4f %s' %(' increase in entropy=',S,'cal deg^-1')

 increase in entropy= 1.1434 cal deg^-1


## Example 13 - pg 222¶

In [2]:
#Calculate the increase in entropy
#initialisation of variables
import math
p1= 1 #atm
R= 1.9872 #cal /mole K
#CALCULATIONS
S= 0 #Initial and final states are alike
#RESULTS
print '%s %.4f %s' %(' increase in entropy=',S,'cal deg^-1')

 increase in entropy= 0.0000 cal deg^-1


## Example 14 - pg 222¶

In [4]:
#calculate rhe increase in entropy in both cases
#initialisation of variables
import math
T= 25. #C
T1= 100. #C
R= 1.9872 #cal /mole K
p= 1 #atm
p1= 10. #atm
#CALCULATIONS
S= 3.5*R*math.log((T1+273)/(T+273))
S1= S+R*math.log(p/p1)
#RESULTS
print '%s %.2f %s' % (' increase in entropy in case 1 =',S,'cal deg^-1')
print '%s %.2f %s' % (' \n increase in entropy in case 2 =',S1,'cal deg^-1')

 increase in entropy in case 1 = 1.56 cal deg^-1

increase in entropy in case 2 = -3.01 cal deg^-1


## Example 15 - pg 222¶

In [5]:
#calculate the absolute entropy
#initialisation of variables
import math
S= 45.77 #cal deg^-1
T= 25. #C
T1= 100. #C
R= 1.9872 #cal /mole K
#CALCULATIONS
S0= S+ 3.5*R*math.log((T1+273)/(T+273))
#RESULTS
print '%s %.2f %s' % (' absolute entropy=',S0,'cal deg^-1')

 absolute entropy= 47.33 cal deg^-1


## Example 16 - pg 226¶

In [6]:
#calculate the change in entropy
#initialisation of variables
import math
Cp= 18. #cal deg^-1
T= 0. #C
T1= -5. #C
H2= -1440. #cal
Cp1= 9. #cal deg^-1
H= 0.
#CALCULATIONS
T2= (-Cp*(T-T1)-H2+Cp1*(273.16+T))/Cp1
S= Cp*math.log((273.16+T)/(273.16+T1))-(Cp*(T-T1)/(T+273.16))
#RESULTS
print '%s %.4f %s' % (' Change in entropy=',S,'cal deg^-1')

 Change in entropy= 0.0031 cal deg^-1


## Example 18 - pg 231¶

In [7]:
#calculate the Gibbs free energy
#initialisation of variables
H= -57.7979 #cal
H1= -68.3174 #cal
S= 45.106 #cal deg^-1
S1= 16.716 #cal deg^-1
T= 25 #C
#CALCULATIONS
H2= (H-H1)*1000
S2= S-S1
G= H2-(273.16+T)*S2
#RESULTS
print '%s %.1f %s' % (' Gibbs free energy=',G,'cal')

 Gibbs free energy= 2054.7 cal


## Example 19 - pg 231¶

In [8]:
#calculate the Gibbs free energy
#initialisation of variables
H= -68317.4 #cal
S= 16.716 #cal
S1= 49.003 #cal
S2= 31.211 #cal
T= 25 #C
#CALCULATIONS
H1= 2*H
S3= 2*S-(S1+2*S2)
G= H1-(T+273.16)*S3
#RESULTS
print '%s %.1f %s' % (' Gibbs free energy=',G,'cal')

 Gibbs free energy= -113380.4 cal


## Example 20 - pg 232¶

In [9]:
#calculate the gibbs free energy change
#initialisation of variables
H= -57.7979 #kcal
H1= -196.5 #kcal
S1=45.106
S2=6.49
S3=21.5
S4=31.211
T=298.16
#calculations
dH=3*H-H1
dS=3*S1+2*S2-S3-3*S4
dG=dH*1000-T*dS
#results
print '%s %d %s' %("Gibbs free energy change =",dG,"cal")
print 'The answer is a bit different due to rounding off error in textbook'

Gibbs free energy change = 13217 cal
The answer is a bit different due to rounding off error in textbook


## Example 22 - pg 240¶

In [10]:
#calculate the Gibbs free energy and value of A in both cases
#initialisation of variables
import math
p= 1. #atm
p1= 3. #atm
R= 1.987 #cal/mole K
T= 27. #C
b= 0.0428 #l mole^-1
a= 3.61 #l^2 atm mole^-1
#CALCULATIONS
G= R*(273+T)*math.log(p/p1)
A= R*(273+T)*math.log(p/p1)
G1= R*(273+T)*math.log(p/p1)+(b-(a/(0.08205*(T+273))))*(p-p1)*(R/0.08205)
#RESULTS
print '%s %.1f %s' % (' Gibs free energy=',G,'cal')
print '%s %.1f %s' % (' \n Value of dA=',A,'cal')
print '%s %.1f %s' % (' \n Gibs free energy=',G1,'cal')
print '%s %.1f %s' % (' \n Value of dA=',A,'cal')

 Gibs free energy= -654.9 cal

Value of dA= -654.9 cal

Gibs free energy= -649.9 cal

Value of dA= -654.9 cal


## Example 24 - pg 244¶

In [11]:
#calculate the fugacities of both components
#initialisation of variables
import math
b= 0.0386 #l**2 atm mole**-1
a= 1.348 #l mole**-1
R= 0.08205 #cal /mole K
T= 25 #C
a1= 3.61 #l**2 atm mole**-1
b1= 0.0428 #l mole**-1
P= 50 #atm
P1= 1 #atm
#CALCULATIONS
Bn= b-(a/(R*(273.2+T)))
Bc= b1-(a1/(R*(273.2+T)))
Fn= P1*math.e**(Bn*P1/(R*(273.2+T)))
Fc= P1*math.e**(Bc*P1/(R*(273.2+T)))
Fn1= P*math.e**(Bn*P/(R*(273.2+T)))
Fc1= P*math.e**(Bc*P/(R*(273.2+T)))
#RESULTS
print '%s %.3f %.2f %s' % (' Fugacity of N2 at 1 and 50 atm are respectively =',Fn,Fn1,'atm')
print '%s %.3f %.2f %s' % (' \n Fugacity of CO2 at 1 and 50 atm are respectively =',Fc,Fc1,'atm')

 Fugacity of N2 at 1 and 50 atm are respectively = 0.999 48.34 atm

Fugacity of CO2 at 1 and 50 atm are respectively = 0.996 40.37 atm


## Example 25 - pg 245¶

In [12]:
#calculate the Increase in pressure in all cases
#initialisation of variables
import math
P1= 23.756 #atm
T= 25. #C
P2= 1. #atm
P3= 10. #atm
P4= 100. #atm
R= 82.02 #J/mole K
v= 18.07 #ml
#CALCULATIONS
p1= P1/760.
p2= 10**(math.log10(P1)+(v*(P2-p1)/(2.303*R*(273.2+T))))
p3= 10**(math.log10(P1)+(v*(P3-p1)/(2.303*R*(273.2+T))))
p4= 10**(math.log10(P1)+(v*(P4-p1)/(2.303*R*(273.2+T))))
x= -(P1-p2)*100/P1
x1= -(P1-p3)*100/P1
x2= -(P1-p4)*100/P1
#RESULTS
print '%s %.2f %s' % ('Increase in pressure=',x,'percent')
print '%s %.2f %s' % ('Increase in pressure=',x1,' percent')
print '%s %.1f %s' % ('Increase in pressure=',x2,' percent')
print '%s %.3f %s' %('Vapor pressure at 1 atm',p2,'mm Hg')
print '%s %.3f %s' %('Vapor pressure at 10 atm',p3,'mm Hg')
print '%s %.3f %s' %('Vapor pressure at 100 atm',p4,'mm Hg')

Increase in pressure= 0.07 percent
Increase in pressure= 0.74  percent
Increase in pressure= 7.7  percent
Vapor pressure at 1 atm 23.773 mm Hg
Vapor pressure at 10 atm 23.932 mm Hg
Vapor pressure at 100 atm 25.577 mm Hg


## Example 26 - pg 247¶

In [13]:
#calculate the pressure required
#initialisation of variables
H= 1436.3 #cal mole^-1
d= 0.9999 #g ml^-1
d1= 0.9168 #g ml^-1
P= 1. #atm
m= 18.02 #gm
R= 1.987 #cal/mole K
T= 2 #C
#CALCULATIONS
V= (P/d)-(P/d1)
H1= H*82.05/(m*R)
P1= H1*(-T)/(273*V)
#RESULTS
print '%s %.1f %s' % (' pressure required to decrease=',P1,'atm')

 pressure required to decrease= 266.0 atm


## Example 27 - pg 249¶

In [14]:
#calculate the heat of vapourisation
#initialisation of variables
H= 540. #cal gram ^-1
T= 95. #C
T1= 100. #C
m= 18. #gms
R= 1.987 #cal /mole K
P= 760. #mm of Hg
#CALCULATIONS
H1= m*H
P1= P/(10**(H1*(T1-T)/(2.303*R*(273+T)*(273+T1))))
#RESULTS
print '%s %.1f %s' % (' heat of vapourisation=',P1,'mm of Hg')

 heat of vapourisation= 636.0 mm of Hg


## Example 28 - pg 249¶

In [15]:
#calculate the vapor pressure of water
#initialisation of variables
H= 9720 #cal mole^-1
P= 1 #atm
R= 1.987 #cal /mole K
T= 100 #C
T1= 95 #C
#CALCULATIONS
r= P*H/(R*(273+T)**2)
dP= r*(T1-T)
P1= (P+dP)*626/0.824
#RESULTS
print '%s %d %s' % (' vapour pressure=',P1,'mm Hg')

 vapour pressure= 626 mm Hg


## Example 29 - pg 250¶

In [16]:
#calculate the vapour pressure
#initialisation of variables
G= 145 #cal
R= 1.987 #cal/mole K
T= 95 #C
#CALCULATIONS
P= 10**(-G/(2.303*R*(273+T)))*(624/0.820)
#RESULTS
print '%s %d %s' % (' vapour pressure=',P,'mm Hg')

 vapour pressure= 624 mm Hg


## Example 30 - pg 250¶

In [17]:
#calculate the molar heat of vapourisation
#initialisation of variables
import math
R= 1.987 #cal/mole K
T1= 25 #C
T2= 76.8 #C
P2= 760. #mm
P1= 115. #mm
#CALCULATIONS
H= 2.303*R*(273.2+T1)*(273.2+T2)*math.log10(P2/P1)/(T2-T1)
#RESULTS
print '%s %d %s' % (' molar heat of vapourisation=',H,'cal mole^-1')

 molar heat of vapourisation= 7561 cal mole^-1