# Chapter 3 - First law of Thermodynamics¶

## Example 1 - pg 129¶

In [1]:
#calculate the increase in energy
#initialisation of variables
P= 0.0060 #atm
M=18.  #gm
L=80 #cal/gm
H=596.1 #cal/gm
#calculations
Hs=M*L+M*H
#results
print '%s %d %s' %('Net increase in energy = ',Hs,'cal')
Net increase in energy =  12169 cal

## Example 2 - pg 130¶

In [2]:
#calculate the increase in energy
#initialisation of variables
P= 0.0060 #atm
V1= 0.0181 #l
H= -10730 #cal
V2= 22.4 #l
#CALCULATIONS
W= (V2-P*V1)*(1.987/.08205)
E= H+W
#RESULTS
print '%s %d %s' % (' increase in energy=',E,' cal ')
print 'The answer differs a bit from the textbook due to rounding off error'
increase in energy= -10187  cal
The answer differs a bit from the textbook due to rounding off error

## Example 3 - pg 132¶

In [3]:
#calculate the increase in energy
#initialisation of variables
T1= 70 #C
T2= 10 #C
Cp= 18 #cal mole^-1 deg^-1
P= 1 #atm
m= 18. #g
d= 0.9778 #g/ml
d1= 0.9997 #g/ml
e= 1.987 #cal
x= 82.05 #ml atm
#CALCULATIONS
H= Cp*(T1-T2)
E= H-(e/x)*P*((m/d)-(m/d1))
#RESULTS
print '%s %.1f %s' % (' increase in energy=',E,'cal ')
increase in energy= 1080.0 cal

## Example 4 - pg 132¶

In [4]:
#calculate the conversion factor
#initialisation of variables
i= 1 #amp
r= 2 #ohms
t= 10 #min
dT= 2.73 #C
x= 0.1 #cal/deg
x1= 100 #cal/deg
x2= 5 #cal/deg
#CALCULATIONS
w= i**2*r*t*60
H= (x+x1+x2)*dT
E= w/H
#RESULTS
print '%s %.2f %s' % ('conversion factor =',E,'cal ')
conversion factor = 4.18 cal

## Example 6 - pg 137¶

In [5]:
#calculate the heat at constant pressure and volume
#initialisation of variables
Cp= 6.0954 #cal /mol deg
Cp1= 3.2533*10**-3 #cal /mol deg
Cp2= 1.071*10**-6 #cal /mol deg
T= 100 #C
T1= 0 #C
R= 1.987 #atml/cal K
#CALULATIONS
H= Cp*(T-T1)+(Cp1/2)*((T+273.2)**2-(T1+273.2)**2)-(Cp2/3)*((T+273.2)**3-(T1+273.2)**3)
q= H-R*(T-T1)
#RESULTS
print '%s %.1f %s' % (' Heat at constant pressure=',H,'cal ')
print '%s %.1f %s' % (' \n Heat at constant volume=',q,'cal ')
print 'The answer differs a bit from the textbook due to rounding off error'
Heat at constant pressure= 703.4 cal

Heat at constant volume= 504.7 cal
The answer differs a bit from the textbook due to rounding off error

## Example 7 - pg 140¶

In [6]:
#calculate the work done in the process
#initialisation of variables
vl= 0.019 #l
vg= 16.07 #l
h= 1489. #mm of Hg
#CALCULATIONS
w= -(h/760)*(vl-vg)*(1.987/0.08206)
#RESULTS
print '%s %d %s' % (' Work done=',w,'cal ')
Work done= 761 cal

## Example 8 - pg 141¶

In [7]:
#calculate the minimum work in both cases
#initialisation of variables
import math
n= 2 #moles
R= 0.08206 #J/mol K
T= 25 #C
b= 0.0428 #lmole^-1
a= 3.61 #atm l^2 mole^-1
V1= 20. #l
V2= 1. #l
#CALCULATIONS
w1= n*1.987*(273.2+T)*math.log10(V1/V2) *2.303
w= (n*R*(273.2+T)*2.303*math.log10((V1-n*b)/(V2-n*b))-a*n**2*((1/V2)-(1/V1)))*(1.987/0.08206)
#RESULTS
print '%s %.1f %s' % (' minimum work=',w1,'cal ')
print '%s %.1f %s' % (' \n minimum work=',w,'cal ')
print 'The answer differs a bit from the textbook due to rounding off error'
minimum work= 3550.7 cal

minimum work= 3319.5 cal
The answer differs a bit from the textbook due to rounding off error

## Example 9 - pg 144¶

In [8]:
#calculate the final volume and temperature of the gas. Also calculate the work done in the process
#initialisation of variables
cv = 5.00 #cal mole^-1 deg^-1
R= 1.99 #cal mole^-1 deg^-1
p= 1 #atm
p1= 100. #atm
V= 75. #l
n= 3. #moles
R1= 0.08206 #cal/mol K
#CALCULATIONS
cp= cv+R
r= cp/cv
V1= V/(p1/p)**(1/r)
T2= p1*V1/(n*R1)
w= (p1*V1-p*V)*R/((r-1)*R1)
#RESULTS
print '%s %.2f %s' % (' final volume of gas =',V1,'l ')
print '%s %d %s' % (' \n final temperature of gas =',T2,'K ')
print '%s %d %s' % (' \n Work done =',w,'cal ')
print 'The answer differs a bit from the textbook due to rounding off error'
final volume of gas = 2.78 l

final temperature of gas = 1130 K

Work done = 12384 cal
The answer differs a bit from the textbook due to rounding off error

## Example 10 - pg 144¶

In [9]:
#calculate the change in energy and enthalpy
#initialisation of variables
cv= 5 #cal mole^-1
P= 100 #atm
T= 1130 #K
T1= 812 #K
n= 3 #moles
R= 1.99 #cal/mole K
#CALCULTIONS
E= n*cv*(T1-T)
H= E+n*R*(T1-T)
#RESULTS
print '%s %.1f %s' % (' change in energy =',E,'cal ')
print '%s %.1f %s' % (' \n change in enthalpy=',H,' cal ')
print 'The answer differs a bit from the textbook due to rounding off error'
change in energy = -4770.0 cal

change in enthalpy= -6668.5  cal
The answer differs a bit from the textbook due to rounding off error

## Example 11 - pg 145¶

In [10]:
#calculate the work done and final pressure
#initialisation of variables
import math
k= 1.435
k1= 17.845*10**-3 #K**-1
k2= -4.165*10**-6 #K**-2
T= 200. #C
T1= 0. #C
P= 10. #atm
R= 1.987 #cal/mol K
k3= 3.422
#CALCULATIONS
W= k*(T-T1)+(k1/2)*((273+T)**2-(273+T1)**2)+(k2/3)*((273+T)**3-(273+T1)**3)
P2= (P/math.e**((k*math.log((273+T1)/(273+T))+k1*(T1-T)+(k2/2)*((273+T1)**2-(273+T)**2))/R))/100.
#RESULTS
print '%s %d %s' % (' work done by methane =',W,'cal ')
print '%s %.2f %s' % (' \n final pressure=',P2,'atm ')
work done by methane = 1499 cal

final pressure= 0.77 atm

## Example 12 - pg 150¶

In [11]:
#calculate the fraction of liquid
#initialisation of variables
P= 100 #atm
P1= 1 #atm
R= 1.99 #cal/mol**-1 K**-1
k= 0.3 #atm**-1
E= 1600 #cal
T= -183 #C
T1= 0 #C
#CALCULATIONS
X= (k*3.5*R*(P-P1))/(3.5*R*(T1-T)+E)
#RESULTS
print '%s %.3f' % (' fraction of liquid = ',X)
fraction of liquid =  0.072

## Example 13 - pg 152¶

In [12]:
#calculate the enthalpy change of the reaction
#initialisation of variables
H= -21.8 #kcal
H1= 3.3 #kcal
#CALCULATIONS
H2= H-H1
#RESULTS
print '%s %.1f %s' % (' Enthalpy =',H2,'kcal ')
Enthalpy = -25.1 kcal

## Example 14 - pg 153¶

In [13]:
#calculate the heat of hydrogenation
#initialisation of variables
H= -68.317 #kcal
H1= -310.615 #kcal
H2= -337.234 #kcal
R= 1.987 #cal/mol^-1 K^-1
T= 298.2 #K
n= 1 #mole
n1= 1 #mole
n2= 1 #mole
#CALCULATIONS
E= H+H1-H2-(n-n1-n2)*R*T*10**-3
#RESULTS
print '%s %.3f %s' % (' Heat of hydrogenation =',E,'kcal ')
Heat of hydrogenation = -41.105 kcal

## Example 15 - pg 155¶

In [14]:
#calculate the enthalpy of the process
#initialisation of variables
Hf= -196.5 #kcal
H= -399.14 #kcal
#CALCULATIONS
H1= (H-Hf)*1000
#RESULTS
print '%s %d %s' % (' Enthalpy =',H1,' kcal ')
Enthalpy = -202640  kcal

## Example 16 - pg 157¶

In [15]:
#calculate the Enthalpy change
#initialisation of variables
H= -350.2 #kcal
H1= -128.67 #kcal
H2= -216.90 #kcal
#CALCULATIONS
H3= H-(H1+H2)
#RESULTS
print '%s %.1f %s' % (' Enthalpy =',H3,'kcal ')
Enthalpy = -4.6 kcal

## Example 17 - pg 158¶

In [16]:
#calculate the enthalpy of the process
#initialisation of variables
H= -40.023 #kcal
H1= -22.063 #kcal
#CALCULATIONS
H2= H-H1
#RESULTS
print '%s %.3f %s' % (' Enthalpy =',H2,' kcal ')
Enthalpy = -17.960  kcal

## Example 18 - pg 162¶

In [34]:
#calculate the enthalpy change in the process
#initialisation of variables
H= -112.148 #k cal
H1= 101.99 #k cal
Hx=-112.148 #kcal
Hy=-111.015 #kcal
Hz=-.64
Hsol=-9.02
#CALCULATIONS
H2= H+H1
H3=2*Hx-2*Hy
H4=-10*Hz
H5=Hsol-5*Hz
#RESULTS
print '%s %.2f %s' % (' Enthalpy in case 1=',H2,'k cal ')
print '%s %.3f %s' % (' Enthalpy in case 2=',H3,'k cal ')
print '%s %.1f %s' % (' Enthalpy in case 3=',H4,'k cal ')
print '%s %.2f %s' % (' Enthalpy in case 4=',H5,'k cal ')
Enthalpy in case 1= -10.16 k cal
Enthalpy in case 2= -2.266 k cal
Enthalpy in case 3= 6.4 k cal
Enthalpy in case 4= -5.82 k cal

## Example 19 - pg 167¶

In [18]:
#calculate the dE and dH in the process
#initialisation of variables
cp=18.
T2=373 #K
T1=298 #K
T3=403.2 #K
hvap=9713 #cal
H4= 0 #cal
E4= 0 #cal
a=7.1873
b=2.3733e-3
c=.2084e-6
R=1.987
#RESULTS
H1=cp*(T2-T1)
H2=hvap
H3=a*(T3-T2) + b/2 *(T3**2-T2**2) + c/3 *(T3**3-T2**3)
E1=H1
E2=H2-R*T2
E3=H3-R*(T3-T2)
H= H1+H2+H3+H4
E= E1+E2+E3+E4
#RESULTS
print '%s %d %s' % (' Enthalpy=',H,'cal ')
print '%s %d %s' % (' \n Energy=',E,' cal ')
Enthalpy= 11308 cal

Energy= 10507  cal

## Example 20 - pg 171¶

In [19]:
#calculate the enthalpy change
#initialisation of variables
H= -114009.8 #cal
x= -5.6146 #K**-1
y= 0.9466*10**-3 #K**-2
z= 0.1578*10**-6 #K**-3
T= 1000
#CALCULATIONS
H1= H+x*T+y*T**2+z*T**3
#RESULTS
print '%s %.1f %s' %(' Enthalpy =',H1,'cal ')
Enthalpy = -118520.0 cal

## Example 21 - pg 173¶

In [24]:
#caculate the temperature achieved
#Initialization of variables
import numpy
a=72.3639
b=36.2399e-3
c=3.7621e-6
H=214920
#calculations
vec=([-c/3,b/2,a,-H])
vec2=numpy.roots(vec)
vec22=(vec2[2])
#results
print '%s %.1f %s' %('The required temperature observed is', vec22,'K')
The required temperature observed is 2059.4 K

## Example 22 - pg 175¶

In [14]:
#calculate the change in enthalpy
#initialisation of variables
T= 298 #K
R= 1.987 #atmcc/mol K
x= 128.16
y= 0.9241
H= -8739 #cal
H1=-771.1 #cal
H22=-196.5 #cal
H33=-30.4 #cal
n1= 10 #mol
n2= 12 #mol
M1=122.12
M11=128.16
M2=55.85
dT=2.51
x1=.8
H2=1947.4
x2=1.
H3=1944.2
dT2=3.62
#CALCULATIONS
E1=H1+1.5*R*T/1000.
E2=H22+1.5*R*T/1000.
E3=(H33+3.5*R*T/1000.)/2.
C=(-E1*.9619/M1-E2/2/M2*.0002 -.47/1000. *E3)*1000/dT - x1-H2
E11=(-E2/2/M2*.0002-.76/1000. *E3 - (x2+H3+C)*dT2)*M11/.9241
H= (E11+R*T*(n1-n2))/1000
#RESULTS
print '%s %.1f %s' %(' Enthalpy =',H,'kcal mole^-1 ')
print 'The answer is a bit different from textbook due to rounding off error'
Enthalpy = -1214.5 kcal mole^-1
The answer is a bit different from textbook due to rounding off error