Application: Particle in a Box

Problem

Determine the varianz und standard deviation for the location (\(x\)) and the momentum (\(p\)) for a particle in a box with a length of \(a\). Verify Heisenberg's uncertainty principle on this model.

The wave functions of a particle in a box is given by $$\psi_{n} = N \cdot \sin \left( \frac{n \pi}{a} x \right);\quad n \in \mathbb{N}$$ The variance of a quantity \(A\) is defined as $$\sigma_{A}^2 = \langle A^2 \rangle - \langle A \rangle^2$$

Solution

First, we import SymPy and define symbols with all necessary assumptions.

import sympy as sp
from sympy.physics.quantum.constants import hbar

x, N = sp.symbols('x N')
a = sp.Symbol('a', positive=True)
n = sp.Symbol('n', integer=True, positive=True)
(a) Define a function which performs integrals over \(x\) on the correct interval.
def integrate(expr):
    return sp.integrate(expr, (x, 0, a))
(b) Find the normalization constant \(N\).
wf = N * sp.sin((n*sp.pi/a) * x)
norm = integrate(wf**2)
N_e = sp.solve(sp.Eq(norm, 1), N)[1]

The constant N_e should evaluate to \(\sqrt{2/a}\).

(c) Define the wave function \(\psi_{n}\).
psi = N_e * sp.sin((n*sp.pi/a) * x)
(d) Determine \(\sigma_{x}\).
x_mean = integrate(sp.conjugate(psi) * x * psi)
x_mean = sp.simplify(x_mean)
x_rms = integrate(sp.conjugate(psi) * x**2 * psi)
x_rms = sp.simplify(x_rms)

var_x = x_rms - x_mean**2
sigma_x = sp.sqrt(var_x)

The expectation value of \(x\) evaluates to $$ \langle x \rangle = \frac{a}{2} $$ and that of \(x^2\) evaluates to $$ \langle x^2 \rangle = \frac{a^2}{3} - \frac{a^2}{2 \pi^2 n^2}$$ The standard deviation of \(x\) is thus $$ \sigma_{x} = \sqrt{ \frac{a^2}{12} - \frac{a^2}{2 \pi^2 n^2} } $$

(e) Determine \(\sigma_{p}\).
p_mean = integrate(sp.conjugate(psi) * (-sp.I*hbar) * sp.diff(psi, x))
p_mean = sp.simplify(p_mean)
p_rms = integrate(sp.conjugate(psi) * (-sp.I*hbar)**2 * sp.diff(psi, x, x))
p_rms = sp.simplify(p_rms)

var_p = p_rms - p_mean**2
sigma_p = sp.sqrt(var_p)

The expectation value of \(p\) equals to \(0\) while that of \(p^2\) is $$ \langle p^2 \rangle = \frac{\pi^2 n^2}{a^2} $$ The standard deviation of \(p\) is therefore $$ \sigma_{p} = \frac{\pi n}{a} $$

(f) Compute the product \(\sigma_{x} \cdot \sigma_{p}\).
product = sigma_x * sigma_p
product = sp.simplify(prod)
p1 = prod.subs(n, 1)

This product equals to $$ \sigma_{x} \cdot \sigma_{p} = \frac{\sqrt{3 \pi^2 n^2 - 18}}{6} $$

For \(n = 1\), this expression takes on the value \( \frac{\sqrt{3\pi^2 - 18}}{6} \), which is approximately \(0.568\). For larger \(n\)'s, its value becomes larger. Therefore, Heisenberg's uncertainly principle holds for the particle in a box model.