import math
T = 671.7 #[R] Equilibrium temperature
m_steam = 1. #[lbm] Condenmath.sing amount of the steam
delta_h_condensation = -970.3 #[Btu/lbm] Enthalpy change of the steam
delta_s_condensation = -1.4446 #[Btu/(lbm*R)] Entropy change of the steam
delta_g_condensation = delta_h_condensation - T*delta_s_condensation #[Btu/lbm]
print "Gibb''s free energy change of the steam is %0.1f Btu/lbm"%(delta_g_condensation)
from numpy import *
from matplotlib.pyplot import *
import math
%matplotlib inline
g_g = 0.00 #[kJ/mol]
g_d = 2.90 #[kJ/mol]
v_g = 5.31*10**(-1) #[kJ/(mol*kbar)]
v_d = 3.42*10**(-1) #[kJ/(mol*kbar)]
D_g = v_g #[J/(mol*Pa)] For graphite
D_d = v_d #[J/(mol*Pa)] For diamond
P = linspace(0,30,30).T
plot(P, D_d*P+g_d )
plot(P,D_g*P+g_g )
xlabel("Pressure, P, kbar");
ylabel("Gibb''s free energy per mol, g, kJ/mol");
legend(['Diamond, slope = 0.342 (kJ/mol)/kbar','Graphite, slope = 0.532 (kJ/mol)/kbar']);
show()
print " Gibb's free energy-pressure diagram for graphite-diamond system at 25 degC is as shown in the graphic window. "
from scipy.optimize import fsolve
import math
K = 4.52
def f(x_iso):
return x_iso/(1-x_iso)-K
x_iso = fsolve(f,0)
print " Mole fraction of isobumath.tane isomer in equilibrium is %0.2f"%(x_iso)