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
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@
},
"outputs": [],
"source": [
"#Enter code for Task 1.1 here\n"
"#Enter code for Task 1.1 here\n",
"\n"
]
},
{
Expand All @@ -213,7 +214,8 @@
},
"outputs": [],
"source": [
"#Enter code for Task 1.2 here\n"
"#Enter code for Task 1.2 here\n",
"\n"
]
},
{
Expand Down Expand Up @@ -453,7 +455,8 @@
},
"outputs": [],
"source": [
"#Enter code for Task 2.1 here\n"
"#Enter code for Task 2.1 here\n",
"\n"
]
},
{
Expand Down Expand Up @@ -550,7 +553,8 @@
},
"outputs": [],
"source": [
"#Enter code for Task 3.1 here\n"
"#Enter code for Task 3.1 here\n",
"\n"
]
},
{
Expand Down Expand Up @@ -814,12 +818,7 @@
"outputs": [],
"source": [
"#Enter code for Task 3.3 here\n",
"\n",
"log_data = np.log(data)\n",
"print(log_data)\n",
"\n",
"print(\"First two elements, \", log_data[0:2])\n",
"print(\"Last element: \", log_data[-1])\n"
"\n"
]
},
{
Expand Down Expand Up @@ -1020,9 +1019,9 @@
},
"source": [
"<div class=\"alert alert-success\">\n",
"<b>Task 4.1: Write a function to calculate the total number of moles of reactant and product in the reaction $A \\rightarrow 2B$, where the arguments should be initial moles of A and the extent of reaction $\\chi$. Use the function to calculate the total number of moles at $\\chi = 0.4$ when the reaction started with 3 mol of A.<br></b>\n",
"<b>Task 4.1: Write a function to calculate the total number of moles, $n$, of reactant and product in the reaction $A \\rightarrow 2B$, where the arguments should be initial moles of A and the extent of reaction $\\xi$. Use the function to calculate the total number of moles at $\\xi = 0.4$ when the reaction started with 3 mol of A.<br></b>\n",
"<br>\n",
"Hint: The number of moles of reactant equals 1 - $\\chi$. What are the number of moles of product with respect to $\\chi$?\n",
"Hint: The number of moles of reactant equals 1 - $\\xi$. What are the number of moles of product with respect to $\\xi$?\n",
"</div>"
]
},
Expand All @@ -1035,7 +1034,9 @@
},
"outputs": [],
"source": [
"#Enter code for Task 4.1 here\n"
"#Enter code for Task 4.1 here\n",
"\n",
"\n"
]
},
{
Expand Down Expand Up @@ -1101,7 +1102,7 @@
},
"source": [
"<div class=\"alert alert-success\">\n",
"<b>Task 5.1: Write a lambda function to compute the mole fraction of product in the reaction $A \\rightarrow 2B$, where the only required argument is the extent of reaction. Use the function to calculate the mole fraction of B at $\\chi = 0.5$.<br></b>\n",
"<b>Task 5.1: Write a lambda function to compute the mole fraction of product in the reaction $A \\rightarrow 2B$, where the only required argument is the extent of reaction. Use the function to calculate the mole fraction of B at $\\xi = 0.5$.<br></b>\n",
"</div>"
]
},
Expand All @@ -1114,7 +1115,8 @@
},
"outputs": [],
"source": [
"#Enter code for Task 5.1 here\n"
"#Enter code for Task 5.1 here\n",
"\n"
]
},
{
Expand All @@ -1127,23 +1129,30 @@
"## End of Session Task\n",
"<a id='final-task'></a>\n",
"\n",
"Write a function called `gibbs_energy` that calculates the Gibbs energy change at different extents of reaction ($\\chi$) for a reaction of the form:\n",
"Write a function called `gibbs_energy` that calculates the change in Gibbs energy at different extents of reaction ($\\xi$) for a reaction of the form:\n",
"\n",
"<div style=\"text-align:center\">$A(g) \\rightarrow 2B(g)$</div>\n",
"\n",
"<div style=\"text-align:center\">$A(g) \\rightarrow 2B(g)$</div><br>\n",
"Assume 1 mol of A at $\\xi = 0$.\n",
"\n",
"Assume 1 mol of A at $\\chi = 0$.\n",
"The total change in Gibbs energy is defined as the sum of contributions from the Gibbs energy change between reactant and product ($\\Delta G_{\\mathrm{reaction}}$) and the Gibbs energy change due to mixing ($\\Delta G_{\\mathrm{mix}}$):\n",
"\n",
"The Gibbs energy change is the sum of contributions from the change in Gibbs energy between reactant and product and the Gibbs energy change due to mixing. The Gibbs energy change due to mixing is given by the equation:\n",
"<div style=\"text-align:center\">$\\Delta G_{\\mathrm{total}}(\\xi) = \\Delta G_{\\mathrm{reaction}}(\\xi) + \\Delta G_{\\mathrm{mix}}(\\xi)$</div>\n",
"\n",
"The Gibbs energy change due to mixing is given by the equation:\n",
"\n",
"<div style=\"text-align:center\">$\\Delta G_{\\text{mix}}(\\xi) = RT \\Big[ n_A\\ln(\\chi_A) + n_B\\ln(\\chi_B) \\Big]$</div>\n",
"\n",
"The function should take as arguments:\n",
"where $\\chi$ is the mole fraction of a respective species.\n",
"\n",
"\n",
"The function `gibbs_energy` must take the following arguments:\n",
"- The change in Gibbs energy between the reactant and product.\n",
"- The temperature at which the reaction takes place.\n",
"\n",
"The function should return:\n",
"and return:\n",
"- A 1D NumPy array representing the extent of reaction.\n",
"- A 1D NumPy array representing the Gibbs energy change for each extent of reaction."
"- A 1D NumPy array representing the total Gibbs energy change for each extent of reaction."
]
},
{
Expand All @@ -1155,7 +1164,9 @@
},
"outputs": [],
"source": [
"#Enter code for End of Session Task here\n"
"#Enter code for End of Session Task here\n",
"\n",
"\n"
]
},
{
Expand Down Expand Up @@ -1196,7 +1207,7 @@
"# Interactive widget\n",
"interact(\n",
" plot_gibbs,\n",
" delta_G=FloatSlider(value=0, min=-2e4, max=2e4, step=1000, description=\"ΔG° (J/mol)\")\n",
" delta_G=FloatSlider(value=0, min=-2e4, max=2e4, step=10, description=\"ΔG° (J/mol)\")\n",
");"
]
}
Expand Down