Maxwell-Boltzmann Distribution and Ideal Gas

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:

\[n(p) = \frac{g}{h^3} \frac{1}{e^{(-\mu + \mathcal{E}_0 + \mathcal{E}(p))/kT} \pm 1}\]

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:

\[n(p) = \frac{g}{h^3} e^{\mu/kT} e^{-\mathcal{E}_0/kT} e^{-p^2/2mkT}\]

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
\[\displaystyle \frac{4 \pi g p^{2} e^{- \frac{\mathcal{E_0}}{T k_{B}}} e^{\frac{\mu}{T k_{B}}} e^{- \frac{p^{2}}{2 T k_{B} m}}}{h^{3}}\]

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
\[\displaystyle \frac{2 \sqrt{2} \pi^{\frac{3}{2}} T^{\frac{3}{2}} g k_{B}^{\frac{3}{2}} m^{\frac{3}{2}} e^{- \frac{\mathcal{E_0}}{T k_{B}}} e^{\frac{\mu}{T k_{B}}}}{h^{3}}\]

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
\[\displaystyle \frac{\sqrt{2} h^{3} n_{I} e^{\frac{\mathcal{E_0} - \mu}{T k_{B}}}}{4 \pi^{\frac{3}{2}} T^{\frac{3}{2}} k_{B}^{\frac{3}{2}} m^{\frac{3}{2}}}\]
n = simplify(n.subs(g, g_solve, strict=False))
n
\[\displaystyle \frac{\sqrt{2} n_{I} p^{2} e^{- \frac{p^{2}}{2 T k_{B} m}}}{\sqrt{\pi} T^{\frac{3}{2}} k_{B}^{\frac{3}{2}} m^{\frac{3}{2}}}\]

Now we see that we have the normal Maxwell-Boltzmann distribution.

Pressure#

The pressure integral is simply:

\[P = \frac{1}{3} \int_0^\infty n(p) v p dp\]

with \(v = p / m\) (again, we are non-relativistic)

P = integrate(Rational(1, 3) * n * p**2 / m, (p, 0, oo))
P
\[\displaystyle T k_{B} n_{I}\]

We see that we get the familiar ideal gas law!

Energy#

The energy density is:

\[\rho e = \int_0^\infty n(p) E(p) dp\]

with \(E(p) = p^2 / (2m)\)

rhoe = integrate(n * p**2 / (2 *m), (p, 0, oo))
rhoe
\[\displaystyle \frac{3 T k_{B} n_{I}}{2}\]

So we see that this is \(3/2 P\).