Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions TxyNotebook.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "beautifulsoup4>=4.14.3",
# "marimo>=0.19.10",
# "matplotlib>=3.10.8",
# "numpy>=2.4.2",
# "pyzmq>=27.1.0",
# "requests>=2.32.5",
# "scipy>=1.17.1",
# ]
# ///

import marimo

__generated_with = "0.19.11"
Expand Down Expand Up @@ -81,10 +94,10 @@ def _(fsolve, get_antoine_coefficient, np, plt, raoult_law_kvalue):
P = 1.01325 # Pressure in bar
Tguess = 350 # K
propane = get_antoine_coefficient('propane', Tguess)
toluene = get_antoine_coefficient('toluene', Tguess)
antoineCoefs = np.array([propane[0:3], toluene[0:3]])
benzene = get_antoine_coefficient('benzene', Tguess) #changing the title to match toluene -> benzene
antoineCoefs = np.array([propane[0:3], benzene[0:3]])
T_soln = []
x_prop = np.linspace(0, 1)
x_prop = np.linspace(0, 1, 50) #make curve smoother
y_prop = []
for z_prop in x_prop:
z = [z_prop, 1 - z_prop]
Expand All @@ -97,11 +110,13 @@ def resfun(T):
K = raoult_law_kvalue(T, P, antoineCoefs)
y = K * z
y_prop.append(y[0])


plt.plot(y_prop, T_soln, label='Y_prop')
plt.plot(x_prop, T_soln, label='X_prop')
plt.xlabel('$x_{prop}$, $y_{prop}$')
plt.ylabel('Temperature (K)')
plt.title('T-x-y of propane and toluene')
plt.title('T-x-y of propane and benzene at 1.01325 bar')
plt.legend(loc='upper right')
return

Expand Down