Skip to content

Commit

Permalink
added interactive features
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdolan authored and maxdolan committed Jun 26, 2024
1 parent 9c52403 commit 0d95dc4
Showing 1 changed file with 75 additions and 3 deletions.
78 changes: 75 additions & 3 deletions examples/ideal_gas_law/first_principles.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -15,9 +25,39 @@
"where, $V$ is the volume of the system and $\\Lambda$ is the de Broglie thermal wavelength, \n",
"\n",
"$$\n",
"\\Lambda = \\bigg(\\frac{\\beta h^2}{2\\pi m}\\bigg)^{1/2}.\n",
"$$\n",
"\\Lambda = \\bigg(\\frac{\\beta h^2}{2\\pi m}\\bigg)^{1/2} = \\bigg(\\frac{h^2}{2 k_B T \\pi m}\\bigg)^{1/2}\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The De Broglie wavelength for an electron can be calculated using electron mass:\n",
"\n",
"$$m_e = 9.11*10^{-31}$$ \n",
"\n",
"Write a function that calculates the De Broglie wavelength for an electron at room temp (293k)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m_e = 9.11e-31\n",
"h = 6.626e-34\n",
"k_b = 1.38e-23\n",
"\n",
"def db_wavelength(T)\n",
" return ◽◽◽"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The most useful way to work with the partition function is in its logarithmic form, \n",
"\n",
"$$\n",
Expand Down Expand Up @@ -49,12 +89,44 @@
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the cell below, write a function that calculates the pressure using the ideal gas law"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"def ideal_pressure(◽◽◽,◽◽◽,◽◽◽)\n",
" return ◽◽◽"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"See how this changes for a range of temperatures"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"T = ◽◽◽\n",
"p = ideal_pressure(◽◽◽,◽◽◽,◽◽◽)\n",
"\n",
"plt.plot(T, p)\n",
"plt.xlabel('Temperature')\n",
"plt.ylabel('Ideal Pressure')\n",
"plt.show()"
]
}
],
"metadata": {
Expand Down

0 comments on commit 0d95dc4

Please sign in to comment.