diff --git a/examples/ideal_gas_law/first_principles.ipynb b/examples/ideal_gas_law/first_principles.ipynb index 984c75b..23c4cfa 100644 --- a/examples/ideal_gas_law/first_principles.ipynb +++ b/examples/ideal_gas_law/first_principles.ipynb @@ -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": {}, @@ -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", @@ -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": {