In [7]:

```
import math
# Variables
T=212. # [F]
#**********#
#From the steam table, we have
delta_h=970.3 #[Btu/lbm]
delta_v=26.78 #[ft**(3)/lbm] and
# Calculations
# changing the units
delta_h1=delta_h*778 #[ft*lbf/lbm]
delta_v1=delta_v*144 #[ft*in**(2)/lbm]
T=671.7 #[R]
# We have dP/dT = delta_h/(T*delta_v)
#Thus
dP_by_dT=delta_h1/(T*delta_v1) #[psi/R]
# Results
print "The value of dP/dT is %f psi/R"%(dP_by_dT)
#Using the nearest adjacent steam table entries for vapour pressure, wee have
#dP_by_dT = delta_P_by_delta_T=(15.291-14.125)/(214-210)=0.2915 psi/R
```

In [3]:

```
import math
# Variables
p_2=0.005 # [psia]
R=1.987/18. #[1/R]
#From the steam tables at the tripple point, we find
T_1=460+32.018 #[R]
p_1=0.0887 #[psia]
#delta_h(solid to gas) = delta_h(sublimation) = 1218.7#[Btu/lbm]
delta_H=1218.7 #[Btu/lbm]
#Assuming that the enthalpy change of vaporization is independent of temperature (a fairly good approximation in this case)
#we start with Eq. 5.10 and rearrange:
#1/T_2 = 1/T_1-(math.log(p_2/p_1))*R/delta_H
#So
# Calculations
T_2=1/(1/T_1-(math.log(p_2/p_1))*R/delta_H) #[R]
#Changing the temperature in farenheit
T_2F=T_2-460 #[F]
# Results
print "The temperature is %.2f F"%(T_2F)
#BY linear interpolation in the steam tables, one finds -23.8 F. Because of imprecision of linear interpolation, these values are approximately equal.
```

In [1]:

```
import math
from numpy import *
# Variables
T_3=1155.2 #[R]
T_2=652.9 #[R]
T_1=787.5 #[R]
p_2=10. #[psia]
p_1=100. #[psia]
# Calculations
#******#
#Here we can write Eq. 5.9 as reported in the book in the form most often seen.
# math.log(p)=A-B/T
#Where A and B are consmath.tants to be determined from the pair of T and p values above.
#we simply write
#math.log(10)=A-B/652.9
#math.log(100)=A-B/787.5
# We have to solve the above two simulmath.taneous equations having two vaiables A and B.
M = matrix([[1, -1/652.9],[1,-1/787.5]])
C = array([[math.log(10)],[math.log(100)]])
X = linalg.inv(M) * C
A=X[0]
B=X[1]
# By straightforward algebra we find the values of A and B. Thus, for 1155.2 R we have
p_3=math.exp(A-B/T_3)
# Results
print "Vapuor pressure of water at given temperature is %f psia"%(p_3)
# p_3=3499 psia.
# Note : "It has been reported in the book that from table 5.1 we see that the correct value is 3000 psia. Thus there is an error of 16% in the predicted pressure."
```

In [10]:

```
import math
# Variables
# At Tr = 0.7, we read
Pr=0.023
# and thus accentric factor is given by
# Calculations
w=-math.log10(0.023)-1
# Results
print "The accentric factor based on the given data is %f"%(w)
#It has been reported in the book that table A.1 shows that the value based on the best data is 0.645.
```

In [11]:

```
import math
# Variables
#From Antoine equation we have
# math.log(p) = A-B/(T+C)
#Solving above equation for T, we have
# T = B/(A-math.log(p))-C
#Inserting the values of the consmath.tants for the water which are reported in the given book in the table A.2 (page 419),
# and the value of 1.00 atm expressed in torr, we find that
A=7.96681
B=1668.21
C=228.0
p=760. #[torr]
# Calculations
#Thus
T=B/(A-math.log10(p))-C
# Results
print "NBP of water umath.sing antoine equation and table A.2 is %f C"%(T)
#This does not prove the overall accuracy of the Antoine equation, but does show that whoever fitted the consmath.tants to the experimental data for water made them represent the NBP (100C) very well.
```

In [12]:

```
import math
# Variables
T_2=-22. #[C]
# converting temperature in farenheit
T_2F=T_2*9/5+32 #[F]
#Expressing T_2 in Rankine
T_2R=460+T_2F #[R]
#delta_h = delta_h(fusion)
delta_h=143.35*778. #[ft*lbf/lbm]
#delta_v = v_water-v_ice
delta_v=0.01602-0.01747 #[ft**(3)/lbm]
# changing the unit
delta_v1=delta_v*144 #[ft*in/lbm]
# Calculations
#and
T_1=460+32. #[R]
dP_by_dT=delta_h/(T_1*delta_v1) #[psi/R] at 32F
delta_T=T_2R-T_1
#This gives the rigorously correct slope of the liquid-solid curve at 32F on a P-T diagram.
#Here we use P instead of p because neither phase is a gas, so this is not a vapour pressure.
#If we further assume that the solid-liquid curve is a straight line, which is equivalent to assuming that delta_h/(T*deta_v)is a consmath.tant over the region of interest, then we can estimate the pressure at -22C = -7.6F by
#So
delta_P=(dP_by_dT)*delta_T #[psi]
# From this we can estimate the final pressure as
delta_P=delta_P+0.09 #[psi]
# Results
print "Freezing preesure of water at given temperature is %f psi"%(delta_P)
# In this case, the experimental pressure is well known, because this temperature corresponds to the tripple point between liquid and water,
# ice I(the common variety), and ice III, a variety that does not exist at pressure below about 30000 psia (see figure 1.10 in the book).
# The measured value is 30000 psia, which shows that our assumption of a straight line on a P-T plot (delta_h/(T*delta_v)=consmath.tant) is only approximately correct.
```

In [ ]:

```
```