Maxwell-Boltzmann Distribution and Ideal Gas#
from sympy import init_session
init_session(use_latex="mathjax")
IPython console for SymPy 1.14.0 (Python 3.12.11-64-bit) (ground types: python)
These commands were executed:
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)
>>> init_printing()
Documentation can be found at https://docs.sympy.org/1.14.0/
Explore the Maxwell-Boltzmann distribution#
In class, we started with the general distribution function:
and we said that since \(\mu/kT \ll -1\), we can ignore the “\(\pm 1\)” term, and we also assumed that we are non-relativistic (\(\mathcal{E}(p) = p^2/2m\)), giving:
We will now integrate this to understand its properties.
We need to create the symbols for SymPy that go into the Maxwell-Boltzmann distribution.
ni, m, k, T = symbols("n_I m k_B T", real=True, positive=True)
p, v = symbols("p v", real=True)
n_I = symbols("n_I", real=True)
g = symbols("g", real=True, positive=True)
h = symbols("h", real=True, positive=True)
E_0 = symbols(r"\mathcal{E_0}", real=True)
mu = symbols("mu", real=True)
We start with
n = 4 * pi * p**2 * g / h**3 * exp(mu/(k*T)) * exp(-E_0/(k*T)) * exp(-p**2/(2*m*k*T))
n
Using number density#
We typically know the number density of our system–let’s call it \(n_I\).
Now let’s integrate over \(p\) to find the number density–we use this to constrain \(\mu\) and \(\mathcal{E}_0\):
n_I_int = integrate(n, (p, 0, oo))
n_I_int
This is equal to \(n_I\). We want to substitute this back into \(n(p)\). Let’s solve for \(g\) in terms of \(n_I\) and then use that as a way to substitute this back.
g_solve = solve(Eq(n_I_int, n_I), g)[0]
g_solve
n = simplify(n.subs(g, g_solve, strict=False))
n
Now we see that we have the normal Maxwell-Boltzmann distribution.
Pressure#
The pressure integral is simply:
with \(v = p / m\) (again, we are non-relativistic)
P = integrate(Rational(1, 3) * n * p**2 / m, (p, 0, oo))
P
We see that we get the familiar ideal gas law!
Energy#
The energy density is:
with \(E(p) = p^2 / (2m)\)
rhoe = integrate(n * p**2 / (2 *m), (p, 0, oo))
rhoe
So we see that this is \(3/2 P\).