import math
from numpy import *
from matplotlib.pyplot import *
# Variables
slop = -4222.1 ;
R = 8.314 ;
# Calculations
del_h_vap = -R * slop * 10**-3 ;
%matplotlib inline
def f(x):
return -4222.1 * x + 17.556
xdata = linspace(0.0032,0.004,8) ;
ydata = f(xdata) ;
plot(xdata,ydata) ;
xlabel("1/T[k**-1]")
ylabel("Ln(Psat[kPa])")
suptitle("least-squares linear fit")
show()
# Results
print "Enthalpy of vapourisation of GaCH3)3 = %.1f kJ/mol"%(del_h_vap) ;
# variables
MWni = 58.69 #g/mol
Psni = 8900 # kg/m**3
Sni = 1.75 # J/m**2 surface tension of solid Ni
deltaHfus = -17.48 # kJ/mol
Tm = 1728 #K
R = 2*10**-9
# calculations
Uni = MWni/(Psni*1000)
T = Tm*(1+((2*Uni*Sni)/(deltaHfus*R)))
# results
print "molar density of the solid %.1e m**3/mol" %Uni
print "T = %.f K"%T
# incorrect answer in textbook
%matplotlib inline
from numpy import zeros
from matplotlib.pylab import *
# Variables
MW1 = 119.5 ;
MW2 = 58 ;
A = [0,4.77,9.83,14.31,19.38,23.27,25.53,25.07,21.55,13.56,0] ;
B = [0,.1 , .2 , .3 ,.4 ,.5 ,.6 ,.7 ,.8 ,.9,1] ;
C = zeros(11)
D = zeros(11)
# Calculations
print " For weight percent %.3f del_h_mix = %.1f J/mol"%(C[0],D[0])
for i in range(1,11):
x1 = (B[i] / MW1) / (B[i]/MW1 + (1 - B[i]) / MW2) ;
x2 = 1 - x1 ;
MW = x1 * MW1 + x2 * MW2 ;
del_h_mix = - 1*(A[i]) * MW ;
C[i] = del_h_mix ;
D[i] = x1 ;
print " For weight percent %.3f del_h_mix = %.1f J/mol"%(x1,del_h_mix)
xdata = D ;
ydata = C ;
plot(xdata ,ydata) ;
xlabel("xCHCI3")
ylabel("delta Hmix[J/mol]")
from sympy.solvers import solve
from sympy import Symbol
#Variables
cp1 = 27.5 #J/mol-K
cp2 = 25 #J/mol-K
cp3 = 20 #J/mol-K
T1 = 4+273 #K
#Calculations
#Since only species 2 and 3 are involved,
deltaH1_unmix = -160 #J
deltaH11_mix = 1100 #J
deltaH_mix = deltaH1_unmix+deltaH11_mix #J
T2 = Symbol('T2')
Tf = solve(deltaH_mix+235*(T2-T1))
#Result
print "The final temperature is",Tf,"K"
# Variables
A = [-32669,-31840,-28727,-26978,-24301,-20083,-13113] ;
B = [20 ,10 ,5 ,4 ,3 ,2 ,1] ;
# Calculations and Results
C = zeros(7)
D = zeros(7)
for i in range(7):
del_h_mix = A[i] / (1. + B[i]) ;
C[i] = del_h_mix ;
D[i] = 1. / (1 + B[i]) ;
print "For mole fraction %.3f the entropy of mixing is %.0f J/mol"%(D[i],C[i])
# Variables
x1 = 0.3 ;
x2 = 1- x1 ;
B11 = -910. ;
B22 = -1330. ;
B12 = -2005. ;
T = 333. ; #[K]
P = 10. * 10**5 ;
R = 8.314 ;
# Calculations and Results
v1 = round(R * T /P * 10**6 + B11,-1) ; #....E6.9A
print " v1 = %g cm**3/mol"%(v1)
V_bar_1 = (R * T / P) * 10**6+ (x1**2 + 2 * x1 * x2) *3.12 * B11 + x2**2 * B12 - x2**2 * B22 ; #.....E6.9B
print " V_bar_1 = %.f cm**3/mol"%(V_bar_1) ;
del_v_mix = x1 * x2 * (2 * B12 - B11 - B22) ; #.....E6.9C
print " del_v = %.f cm**3/mol"%(del_v_mix);
# Note : answer are slightly different because of rounding error.
from numpy import zeros
from matplotlib.pyplot import *
# Variables
h_H2SO4 = 1.596 ; #[kJ/mol]
h_H2O = 1.591 ; #[kJ/mol]
C1 = -74.40 ;
C2 = 0.561 ;
A = [0 ,0.1 , 0.2 ,0.3 ,0.4 ,0.5 ,0.6 ,0.7 ,0.8 ,0.9 ,1] ;
B = [1 ,0.9 ,0.8 ,0.7 ,0.6 ,0.5 ,0.4 ,0.3 ,0.2 ,0.1 ,0] ;
# Calculations
y_data_1 = zeros(11)
y_data_2 = zeros(11)
x_data = zeros(11)
for i in range(11):
H_bar_H2SO4 = h_H2SO4 + C1 * B[i]**2 - 2 * C2 * C1 * A[i] * B[i]**2 ;
H_bar_H2O = h_H2O + C1 * A[i]**2 -C2 * C1 * A[i]**2 * (1 - 2 * B[i]) ;
y_data_1[i] = H_bar_H2SO4 ;
y_data_2[i] = H_bar_H2O ;
x_data[i] = A[i] ;
plot(x_data,y_data_1) ;
plot(x_data,y_data_2) ;
xlabel("xH2SO4")
ylabel("Partial molar enthalpy (J/mol)")
#suptitle("Partial molar enthalpies of water and sulfuric acid at 21°C.")
m = y_data_1[5] ;
s = y_data_2[5] ;
print "For equimolar mixture del_H_H2SO4 = %.1f kJ/mol del_H_H2O = %.1f kJ/mol"%(m,s);
show()
%matplotlib inline
from matplotlib.pyplot import *
# Variables
C1 = 1.596 ;
C2 = 1.591 ;
C3 = -74.40 ;
C4 = -0.561 ;
A = [ 0 ,0.1 ,0.2 ,0.3 ,0.4 ,0.5 ,0.6 ,0.7 ,0.8 ,0.9 ,1] ;
m = (-C1 + C2 + C3 * ( C4 * 0.25)) * 1000 ;
# Calculations
C = zeros(11)
for i in range(11):
x_H2O = A[i] ;
x_H2SO4 = 1- x_H2O ;
h = C1 * x_H2SO4 + C2 * x_H2O + C3 * x_H2SO4 * x_H2O *(1 + C4 * x_H2SO4) ;
C[i] = h * 10**3;
y1 = C[5]
def f613(x):
return -m * (x - 0.5 ) + y1 ;
F = zeros(11)
for i in range(11):
F[i] = f613(A[i]) ;
# Results
plot(A,C);
plot(A,F)
plot(0.5,-12000,"go")
xlabel("XH2O")
ylabel("h(J/mol)")
suptitle("Graphical determination of values for the partial molar enthalpies of sulfuric acid and water")
print "The partial molar property can be obtained by drawing tangent at mole fraction 0.5 ."
show()