import math
from numpy import *
# Variables
H2O = 1. ;
NH3 = 2. ;
CH4 = 3. ;
CH3Cl = 4. ;
CCl4 = 5. ;
M_11 = 1.85
alp_12 = 14.80
I_13 = 12.62 ;
M_12 = 1.47
alp_22 = 22.20
I_23 = 10.07 ;
M_31 = 0.00
alp_32 = 26.00
I_33 = 12.61 ;
M_41 = 1.87
alp_42 = 45.30
I_43 = 11.26 ;
M_51 = 0.00
alp_52 = 105.0
I_53 = 11.47 ;
# Calculations
k = 1.38 * 10**-16 ; #[ J/K]
T = 298. #[K]
A =[[M_11 , alp_12 , I_13, 0,0,0,0],[M_12 , alp_22 , I_23,0,0,0,0 ],[M_31 , alp_32 , I_33,0,0,0,0],[M_41 , alp_42 , I_43,0,0,0,0],[M_51 , alp_52 , I_53,0,0,0,0 ]]
print A
print (" Molecule M alp*10**25 I C*10**60 Cd_d Cind Cdis") ;
for i in range(5):
A[i][4] = ceil( 2./3 * A[i][0]**4 / (k * T) * 10**-12) ;
A[i][5] = ceil(2 * A[i][1] * A[i][0]**2 * 10**-1) ;
A[i][6] = ceil(3./4 * A[i][1]**2 * A[i][2] * 1.6 * 10**-2) ;
A[i][3] = ceil(A[i][4] + A[i][5] + A[i][6]) ; # ....E4.1D
print " H2O %8.2f %5.1f %5.2f %7d %7d %5d %d "%(A[0][0],A[0][1],A[0][2],A[0][3],A[0][4],A[0][5],A[0][6]) ;
print " NH3 %8.2f %5.1f %5.2f %7d %7d %5d %d "%(A[1][0],A[1][1],A[1][2],A[1][3],A[1][4],A[1][5],A[1][6]) ;
print " CH4 %8.2f %5.1f %5.2f %7d %7d %5d %d "%(A[2][0],A[2][1],A[2][2],A[2][3],A[2][4],A[2][5],A[2][6]) ;
print " CH3Cl %8.2f %5.1f %5.2f %7d %7d %5d %d "%(A[3][0],A[3][1],A[3][2],A[3][3],A[3][4],A[3][5],A[3][6]) ;
print " CCl4 %8.2f %5.1f %5.2f %7d %7d %5d %d "%(A[4][0],A[4][1],A[4][2],A[4][3],A[4][4],A[4][5],A[4][6]) ;
print "Even though it is non polar , CCl4 exhibit the largest intermolecular forces . It is due to the large polarizability accociated with the four Cl atom in CCl4 ."
# Note : Answer are slightly different because of rounding off error.
# Variables
import math
C6_Ar_HCl_tab = 76 * 10**-60 ; #From table E4.2
C6_Ar_Ar_tab = 52 * 10**-60 ; #From table E4.2
C6_HCl_HCl_tab = 134 * 10**-60 ; #From table E4.2
# Calculations
C6_Ar_HCl_gmean = math.sqrt(C6_Ar_Ar_tab * C6_HCl_HCl_tab) ; #[erg/cm**6]
x = (C6_Ar_HCl_gmean - C6_Ar_HCl_tab) / C6_Ar_HCl_tab * 100 ;
# Results
print "The geometric mean is different from that in table E4.2 by %d %%"%(x)
# Variables
import math
Psat_wat_25 = 3.169 * 10**3 ; # From steam table
Psat_wat_50 = 1.235 * 10**4 ; # From steam table
Psat_wat_100 = 1.014 * 10**5 ; # From steam table
A =11.9673 ;
B = 3626.55 ;
C = -34.29 ;
T1 = 25 ; #[*C]
T2 = 50 ; #[*C]
T3 = 100 ; #[*C]
# Calculations
M = [[T1, Psat_wat_25 , 0],[T2 , Psat_wat_50, 0],[T3 , Psat_wat_100, 0]]
#M = array(M)
print (" T(*C) Water(Pa) Methanol(Pa)")
for i in range(3):
M[i][2] = math.exp(A - B / (M[i][0] + 273 + C)) * 10**5 ;
print "%5d %7.3e %7.2e"%(M[i][0],M[i][1],M[i][2])
#t.append(math.exp(A - B / (M[i][0] + 273 + C)) * 10**5)
#M.append(t)
# Results
print "1) Water can form two hydrogen bonds . While CH4Oh can form only one . Thus at\
a given temperature, water has stronger attractive forces in the liquid and a lower vapour pressure ."
print "2) Since the Maxwell-Boltzmann distribution depends exponentially on temperature,\
Psat also increses exponentially with temperature ."
# Note: Answers may vary because of rounding off error.
# Variables
Pc_B = 49.1 ; # [bar] , From table
Pc_T = 42.0 ; # [bar] , From table
Pc_C = 40.4 ; # [bar] , From table
Tc_B = 562 ; # [K] , From table
Tc_T = 594 ; # [K] , From table
Tc_C = 553 ; # [K] , From table
R = 8.314 ;
# Calculations
A = [[Pc_B , Tc_B, 0,0],[Pc_T , Tc_T,0,0],[Pc_C , Tc_C,0,0]]
# Results
print " P_c T_c a b "
for i in range(3):
A[i][2] = 27./64 * (R * A[i][1])**2 /( A[i][0] * 10**5) ;
A[i][3] = R * A[i][1] / (8 * A[i][0] * 10**5) ;
print " %5.1f %5d %7.2f %7.2e"%(A[i][0],A[i][1],A[i][2],A[i][3])
print "The attractive interactions of all three compounds are dominated by\
print ersion interactions ( parameter a) , while size affects parameter b ."
# Variables
import math
B = 0.0486 * 10**-3 ;
T1 = 20 + 273 ; #[K]
T2 = 500 + 273 ; #[K]
v1 = 7.11 ; # [cm**3/mol]
# Calculations
v2 = v1 * math.exp( B * (T2 - T1)) ;
# Results
print " Molar volume of solid state 2 = %.2f cm**3/mol"%( v2);
# Variables
P_c = 37.9 * 10**5 ; #[N/m**2] , From compressibility chart
T_c = 425.2 # [K , From compressibility chart
P = 50. * 10**5 ; #N/m**2]
T = 333.2 ; #[K]
R = 8.314 ;
z_0 = 0.2148 ;
z_1 = -0.0855 ;
w = 0.199 ;
m = 10. ;
MW = 0.05812 ;
# Calculations
a = (0.42748 * R**2 * T_c**2.5) / P_c ;
b = 0.08664 * R * T_c / P_c ;
A = P * T**(1./2) ;
B = -R * T**(3./2) ;
C = (a - P * T**(1./2) * b**2 - R * T**(3./2)*b) ;
D = - a * b;
#mycoeff = [ D , C , B , A] ;
mycoeff = [ A,B,C,D]
#p = poly1d(mycoeff , "v" , "coeff" );
M = roots(mycoeff);
# Results
for i in range(3):
ans = sign(M[i])
if ans == 1:
V = m / MW *(M[i]) ;
#print "Using Redlich Kwong equation the volume is = %.3f m**3"%(V)
z = z_0 + w * z_1 ;
v = z * R * T / P ;
V = m / MW * v ;
print "Using compressibility chart the volume is = %.3f m**3"%(V)
# Variables
import math
T = 100. + 273 ; #[K]
P = 70. * 10**5 ; #[N/m**2]
P_c = 42.2 * 10 ** 5 ;
T_c = 370. ; #[K]
w = 0.153 # Interpolating from table C.1 and C.2
z_0 = 0.2822 ; # Interpolating from table C.1 and C.2
z_1 = - 0.0670 ; # Interpolating from table C.1 and C.2
m = 20. * 10**3 ; #[g]
MW = 44. ; #[g/mol]
R = 8.314 ;
# Calculations and Results
P_r = P / P_c ;
T_r = T / T_c ;
z = z_0 + w * z_1 ;
V = m / MW *z * R * T / P ;
print "1) Volume = %.4f m**3 "%( V )
T = 295. ; #[K]
n = 50. ; # [mol]
a = 0.42748 * R**2 * T_c**2.5 / P_c ;
b = 0.08664 * R * T_c / P_c ;
v = 0.1 ;
P = R * T / (v - b) - a / (T**0.5 * v * (v + b)) ;
x = P * n * 10**-6 ;
print "2) Pressure = %.1f MPa "%( x )
y1 = 0.4 ;
y2 = 1 - y1 ;
n = 50. ;
P_c = 48.7 * 10**5 ; #[N/m**2]
T_c = 305.5 ; #[K]
a1 = a ;
b1 = b ;
a2 = 0.42748 * R**2 * T_c**2.5 / P_c ;
b2 = 0.08664 * R * T_c / P_c ;
a_mix = y1**2 * a1 + 2 * y1 * y2 * math.sqrt(a1 * a2) + y2**2 * a2 ;
b_mix = y1 * b1 + y2 * b2 ;
P = R * T / (v - b_mix) - a_mix /(T**0.5 * v * (v + b_mix));
x = P * n * 10**-6 ;
print "3) Pressure = %.2f MPa "%( x )
# Note : Answers are slightly different because of rounding off error.