What you'll learn
- Explain wavefunctions and energy levels
- Compute particle-in-a-box energies and convert them to electronvolts
- Find the photon wavelength emitted in a transition between levels
- Estimate a probability by integrating |psi|^2 with the midpoint rule
Explain wavefunctions, probability and quantized energy levels using the particle in a box, and compute them in Python.
Why it matters
Quantum mechanics explains why atoms are stable, why materials conduct or insulate, why LEDs and quantum dots have the colours they do, and how lasers, transistors and MRI work. You do not need the full theory to start computing with it. The particle in a boxA model of a particle confined between infinitely high walls, with energies E_n = n^2 h^2 / (8 m L^2). is the standard first model: simple enough to solve by hand and rich enough to show every key idea.
The core ideas
- WavefunctionThe function psi(x) that describes a quantum particle and is used to make predictions; it is not itself a visible wave.. A particle is described by a wavefunction
psi(x). It is not a physical wave you can see; it is a tool for predictions. - Probability.
|psi(x)|^2is a probability density|psi(x)|^2; integrating it over a region gives the chance of finding the particle there.. The chance of finding the particle betweenaandbis the integral of|psi|^2fromatob. The total over all space must be 1 (the wavefunction is normalizedDescribes a wavefunction whose probability density integrates to 1 over all space.). - Schrödinger equation. For a time-independent problem in one dimension:
-(hbar^2 / 2m) * psi''(x) + V(x) * psi(x) = E * psi(x)Only some values of E give wavefunctions that obey the boundary conditions. That is why energy is quantized.
The particle in a box
Put a particle of mass m in a region 0 < x < L with zero potential inside and infinitely high walls outside. The wavefunction must be zero at both walls. Sine waves that fit a whole number of half-wavelengths into the box are the solutions:
psi_n(x) = sqrt(2/L) * sin(n * pi * x / L), n = 1, 2, 3, ...
E_n = n^2 * h^2 / (8 * m * L^2)What this tells you:
- Energy grows as
n^2: levels 1, 4, 9, 16 times the ground state. - The lowest energy is not zero. Confining a particle always costs energy (zero-point energyThe non-zero lowest energy of a confined particle, a consequence of the uncertainty principle.), a consequence of the uncertainty principle.
- State
nhasn - 1nodes inside the box where the particle is never found. - A smaller box or a lighter particle spreads the levels further apart (
1/(m L^2)).
Worked example: an electron in a 1 nm box
h = 6.62607015e-34 J s
m_e = 9.1093837e-31 kg
L = 1.0e-9 m
E_1 = h^2 / (8 m L^2) = 4.390e-67 / 7.288e-48 = 6.025e-20 J
= 6.025e-20 / 1.602e-19 = 0.376 eVSo E_2 = 4 * 0.376 = 1.504 eV and E_3 = 3.384 eV. If the electron drops from n = 3 to n = 2, it releases 5 * 0.376 = 1.880 eV, and the photon wavelength is
lambda = h c / dE = 1239.84 eV nm / 1.880 eV = 659 nm (red light)This is roughly how colour works in dye molecules and quantum dots: the size of the region the electron is confined to sets the colour. Real atoms have a different potential, so their levels follow other formulas. For hydrogen, E_n = -13.6 eV / n^2, and the 3 to 2 transition gives 656 nm, the red H-alpha line.
Worked example: probabilities
For the ground state, what is the chance of finding the particle in the middle half of the box?
P = integral from L/4 to 3L/4 of (2/L) sin^2(pi x / L) dx = 1/2 + 1/pi = 0.818A classical particle bouncing at constant speed would spend exactly 50% of its time there. The quantum ground state piles probability up in the middle. Many such integrals have no neat closed form, so you compute them numerically:
import math
def psi(n, x, L):
return math.sqrt(2 / L) * math.sin(n * math.pi * x / L)
def prob(n, L, a, b, steps=10_000):
dx = (b - a) / steps
return sum(psi(n, a + (i + 0.5) * dx, L) ** 2 for i in range(steps)) * dx
print(prob(1, 1.0, 0.25, 0.75)) # 0.8183...This is the midpoint ruleA numerical integration method that splits the interval into steps, evaluates the function at each step's centre and adds up.: split the interval, evaluate at each centre, add up.
Common mistakes
- Treating
psias the probability. The probability density is|psi|^2, and probabilities come from integrating it. - Starting
nat 0.n = 0givespsi = 0everywhere, which is no particle at all. - Mixing
handhbar. The box formula above usesh. Withhbar = h / (2 pi)it readsn^2 pi^2 hbar^2 / (2 m L^2); both give the same number. - Forgetting the eV conversion (
1 eV = 1.602176634e-19 J) and quoting joules as if they were electronvolts.
Recap
|psi|^2is a probability density; normalized wavefunctions integrate to 1.- Boundary conditions quantize energy:
E_n = n^2 h^2 / (8 m L^2)in a box. - Transitions emit photons with
lambda = h c / dE. - Numerical integration (midpoint rule) handles the probabilities you can't do by hand.
Try it
Open the Do tab to compute box energy levels, a transition wavelength and a probability by numerical integration.
Key terms (6)
- wavefunction
- The function psi(x) that describes a quantum particle and is used to make predictions; it is not itself a visible wave.
- probability density
- |psi(x)|^2; integrating it over a region gives the chance of finding the particle there.
- normalized
- Describes a wavefunction whose probability density integrates to 1 over all space.
- zero-point energy
- The non-zero lowest energy of a confined particle, a consequence of the uncertainty principle.
- particle in a box
- A model of a particle confined between infinitely high walls, with energies E_n = n^2 h^2 / (8 m L^2).
- midpoint rule
- A numerical integration method that splits the interval into steps, evaluates the function at each step's centre and adds up.