A Byte of PhysicsLogo

Energy levels

A bound classical particle can often have any energy in a continuous range. A bound quantum state must also satisfy its wave equation and boundary conditions. Only particular wave patterns fit, so only particular energies are allowed. These energy levels are eigenvalues of the Hamiltonian.

Discrete levels do not form one universal ladder. Their values depend on the system, potential, boundaries, particle mass, and interactions. Unbound states commonly form a continuum above an ionization or escape threshold.

The stationary eigenvalue problem

For one nonrelativistic particle in one dimension,

\[\hat H\psi(x)=\left[-\frac{\hbar^2}{2m}\frac{d^2}{dx^2}+V(x)\right]\psi(x)=E\psi(x)\]

The potential \(V(x)\), boundary conditions, and normalizability restrict the solutions. A bound eigenstate has finite norm:

\[\int_{-\infty}^{\infty}|\psi(x)|^2\,dx=1\]

Its time dependence is a phase:

\[\Psi(x,t)=\psi(x)e^{-iEt/\hbar}\]

so \(|\Psi(x,t)|^2\) is time-independent. A superposition of different energy eigenstates is not generally stationary because its relative phases evolve at different rates.

Why boundaries create discrete values

Consider a particle confined to an infinite well from \(x=0\) to \(x=L\). The wavefunction vanishes at both walls. Inside the well, the allowed states are

\[\psi_n(x)=\sqrt{\frac{2}{L}}\sin\left(\frac{n\pi x}{L}\right),\qquad n=1,2,3,\ldots\]

with energies

\[E_n=\frac{n^2\pi^2\hbar^2}{2mL^2}\]

Only wavelengths satisfying

\[L=\frac{n\lambda_n}{2}\]

fit both boundaries. There is no \(n=0\) state: it would make the wavefunction zero everywhere and could not be normalized.

Several checks follow immediately. Halving \(L\) multiplies every fixed-level energy by four. Doubling mass halves each level. The ratio

\(E_n/E_1=n^2\)

is independent of mass and width.

Zero-point energy and the oscillator

Confinement prevents a particle from having both exact position and zero momentum. The infinite-well ground state therefore has \(E_1>0\).

The harmonic oscillator has potential

\[V(x)=\frac12m\omega^2x^2\]

and equally spaced levels

\[E_n=\hbar\omega\left(n+\frac12\right),\qquad n=0,1,2,\ldots\]

Its ground-state energy is \(\hbar\omega/2\). Changing the zero of potential adds the same constant to every level but does not change energy gaps or observable dynamics.

Hydrogenic levels

For a one-electron ion in the nonrelativistic Coulomb model,

\[E_n=-13.6\,\frac{Z^2}{n^2}\ \mathrm{eV},\qquad n=1,2,3,\ldots\]

The zero is the ionized electron and nucleus at infinite separation. Negative values are bound. Levels approach zero from below as \(n\to\infty\).

The ideal Coulomb energy depends only on \(n\), so states with different orbital quantum numbers can share one energy. Fine structure, the Lamb shift, and external fields can split degeneracies. Multi-electron atoms have electron–electron and exchange effects and do not follow a single \(1/n^2\) ladder.

Finite wells and the continuum

A finite well also supports discrete bound states, but its wavefunctions decay into the classically forbidden region rather than dropping abruptly to zero. A shallower or narrower well supports fewer bound states. Above the surrounding potential, scattering states normally form a continuum.

A finite numerical box can turn that continuum into many artificial discrete box states. Bound-state energies should stabilize as the box expands, while the spacing of discretized continuum states changes. Inspect localization and domain-size dependence before calling every eigenvalue a physical bound level.

Transitions and photons

For a downward transition from \(E_i\) to \(E_f\), the emitted photon has

\[E_\gamma=E_i-E_f=hf=\frac{hc}{\lambda}>0\]

Absorption requires \(E_f-E_i=hf>0\). Spectra probe differences, not the arbitrary absolute zero of energy. Not every pair of levels gives an equally strong line: the interaction and selection rules determine transition probability.

h, c, electronvolt = 6.62607015e-34, 299792458.0, 1.602176634e-19


def transition(initial_ev, final_ev):
    change = (final_ev - initial_ev) * electronvolt
    if change == 0:
        return "no transition", None
    process = "absorption" if change > 0 else "emission"
    return process, h * c / abs(change)


print(transition(-13.6 / 3**2, -13.6 / 2**2))

Finite lifetimes, collisions, thermal motion, and instrumentation broaden measured lines. An ideal level diagram shows central energies, not the full width or intensity of every spectral feature.

Degeneracy

An energy is degenerate when multiple linearly independent states share the same eigenvalue. Individual eigenvectors inside a degenerate numerical subspace are not unique: any orthonormal combination spanning the same subspace is equally valid. Compare subspace projectors across calculations instead of demanding identical vector components.

Symmetry often produces degeneracy. External electric or magnetic fields can reduce the symmetry and split levels through the Stark or Zeeman effects.

Levels are not populations

The Hamiltonian determines the available energy levels, while preparation and environment determine how those levels are occupied. Heating an atom does not usually move the eigenvalues upward; it changes the probabilities of finding the atom in different eigenstates. For a simple system in thermal equilibrium with a reservoir at temperature \(T\), the canonical probability of level \(E_n\) is

\[P_n=\frac{g_ne^{-E_n/(k_{\mathrm B}T)}}{\sum_jg_je^{-E_j/(k_{\mathrm B}T)}}\]

where \(g_n\) is degeneracy. Only energy differences matter because adding one constant to all energies cancels between numerator and denominator. This equilibrium formula does not describe every illuminated, rapidly driven, or isolated atom; such systems may have nonequilibrium populations.

Confusing levels with populations leads to faulty spectral reasoning. A transition can be allowed by energy and selection rules yet produce no strong emission line if the initial level is scarcely occupied. Conversely, stimulated absorption and emission depend on both the radiation field and the populations of the connected states.

Numerical eigenvalues

On a uniform grid, the centered second derivative gives Hamiltonian entries

\[H_{jj}=\frac{\hbar^2}{m\Delta x^2}+V_j,\qquad H_{j,j\pm1}=-\frac{\hbar^2}{2m\Delta x^2}\]

Solve

\[H\boldsymbol\psi_n=E_n\boldsymbol\psi_n\]

and normalize with the grid measure:

\[\sum_j|\psi_{n,j}|^2\Delta x=1\]
import numpy as np

H = np.array([[1.0, 0.2], [0.2, 2.0]])  # Illustrative two-level Hamiltonian, eV.
energies, eigenvectors = np.linalg.eigh(H)
for energy, state in zip(energies, eigenvectors.T):
    residual = H @ state - energy * state
    assert np.linalg.norm(residual) < 1e-12
    print("Energy (eV):", energy, "residual:", np.linalg.norm(residual))

The residual

\[\mathbf r_n=H\boldsymbol\psi_n-E_n\boldsymbol\psi_n\]

tests the discrete algebraic problem. It does not prove that the grid accurately represents the continuum. Validate against the infinite well or oscillator, refine \(\Delta x\), enlarge the domain, and compare low-lying energies and gaps. Higher-energy states oscillate faster and need finer grids.

Report the potential and energy zero, particle mass, units, domain, spacing, boundaries, degeneracy, normalization, residual, and convergence. Also identify whether a state is bound or belongs to a box-discretized continuum.

This treatment is nonrelativistic and primarily single-particle. Spin, many-body interactions, relativistic corrections, and coupling to a quantized radiation field require extensions. For measured atomic levels, use evaluated spectroscopic data rather than treating a small numerical residual as empirical validation.

A worked Python notebook

Subtract the first two infinite-well energy levels to predict an excitation gap. The question for this calculation is precise: how does first excitation energy gap change when we change well width, while keeping the other choices fixed? The earlier sections explain the physical relationship. Here we turn one part of that relationship into a calculation that you can run, inspect, and change in Google Colab.

The transition energy does not by itself determine a transition probability or selection rule. Keep that sentence beside the results. A formula can return a number outside its useful range, and a plotting library will usually draw that number without asking whether the physical assumptions still hold. The selected interval is from 0.5 to 2 scaled length units. It gives us a specific domain to discuss instead of leaving the graph's range to a software default.

Use the notebook link above the lesson, run the setup cell, and then run the cells in order. The code below is also included there. NumPy handles the arrays of numerical values, SymPy keeps the equation symbolic, and Matplotlib draws the results. If these libraries or notebook cells are unfamiliar, start with Your first physics notebook.

State the relationship before choosing a graph

In this small example, q stands for well width, expressed in scaled length units. The output is first excitation energy gap, expressed in scaled energy units. The equation below uses the numerical values in those units. Any fixed coefficients therefore carry the units needed to make the relation consistent. A value supplied in another unit must be converted before it enters this expression.

\[f(q) = \frac{3 \pi^{2}}{2 q^{2}}\]

This is a function of one changing input. It is not a statement that the physical system has only one variable. We deliberately hold the other inputs fixed so that one cause of variation is visible. Changing several inputs at once would make it harder to tell which change produced the output difference. Write down the held-fixed choices before trying a different experiment.

At 1 scaled length units, the expression gives 14.8044 scaled energy units. This is our reference calculation. It is a prediction of the stated example, not a new measurement. Its displayed digits help us compare implementations. They should not be read as a claim that physical inputs are known to six significant figures.

import numpy as np
import sympy as sp
import matplotlib.pyplot as plt

q = sp.Symbol("q", real=True)
expression = sp.sympify("3*pi**2/(2*q**2)", locals={"q": q})
reference_input = 1.0
reference_output = float(expression.subs(q, reference_input))
print("Input:", reference_input, "scaled length units")
print("Predicted first excitation energy gap:", reference_output, "scaled energy units")

sp.Symbol declares a mathematical symbol. It does not assign a numerical measurement to that symbol. subs then replaces the symbol with our chosen input, and float converts the resulting symbolic number into a standard Python numerical value. Keeping these steps separate lets us inspect the equation before numerical substitution. It also prevents a later plot from becoming the only surviving record of the model.

Compare a few cases you can explain

Before drawing hundreds of points, calculate three. The lower endpoint gives 59.2176 scaled energy units. The midpoint, at 1.25 scaled length units, gives 9.47482 scaled energy units. The upper endpoint gives 3.7011 scaled energy units. Read these together with the assumptions: they describe different choices of well width within the same example, with the other inputs held fixed.

These three values are a useful first check, but they do not establish the shape between them. Two endpoints can be equal even when the curve bends or oscillates in between. Likewise, a large change between endpoints does not tell us whether the relationship is linear. We need the equation and intermediate samples to answer those questions.

evaluate = sp.lambdify(q, expression, modules="numpy")
inputs = np.array([0.5, 1.25, 2.0])
outputs = np.asarray(evaluate(inputs), dtype=float)
outputs = np.broadcast_to(outputs, inputs.shape)
for input_value, output_value in zip(inputs, outputs):
    print(
        f"{input_value:.6g} scaled length units -> "
        f"{output_value:.6g} scaled energy units"
    )
assert np.all(np.isfinite(outputs))

lambdify turns the symbolic expression into a numerical function. We explicitly select NumPy as its numerical backend so it can accept an array. The same expression now has two useful forms: one for algebra and one for calculating many cases. The assertion checks that the chosen inputs produce finite outputs. It would catch an infinity or an undefined numerical result, but a finite value can still be physically inappropriate.

Make a graph that answers the question

The horizontal axis shows well width; the vertical axis shows first excitation energy gap. Every plotted point is a prediction of the same expression. We mark the reference case separately so that a reader can connect the earlier printed value to its place on the curve. The axis labels include units because a shape without a scale cannot tell us the size of a physical effect.

input_grid = np.linspace(0.5, 2.0, 301)
output_grid = np.asarray(evaluate(input_grid), dtype=float)
output_grid = np.broadcast_to(output_grid, input_grid.shape)
fig, ax = plt.subplots(figsize=(7, 4))
ax.plot(input_grid, output_grid, label="Stated model")
ax.scatter([reference_input], [reference_output], label="Reference case", zorder=3)
ax.set_xlabel("Well width (scaled length units)")
ax.set_ylabel("First excitation energy gap (scaled energy units)")
ax.legend()
ax.grid(alpha=0.25)
fig.tight_layout()
plt.show()

Look for a sign change, a turning point, or a region where the curve becomes steep. Connect each feature to the expression rather than to the colour of the line. If the curve has a minimum or maximum, changing the input in opposite directions may have similar effects on the output near that point. If it is nearly straight over a short interval, a local linear approximation may be useful even when the complete expression is nonlinear.

Increasing the number of samples makes the line smoother and may reveal features that a coarse grid missed. It does not improve the physical inputs or enlarge the model's validity range. For quantities that can take only discrete values, use the line as a guide to the relationship and interpret only the allowed input values. A plotting function does not enforce such restrictions for you.

Measure the local sensitivity

A derivative asks a more specific question than the whole graph: how quickly does first excitation energy gap change near the reference input? Its units are the output unit divided by the input unit. For this calculation, the derivative at 1 scaled length units is -29.6088 in those ratio units. Locally, the output decreases as the input increases. This statement is local; the sign or size of the slope can be different elsewhere on the curve.

\[f'(q) = - \frac{3 \pi^{2}}{q^{3}}\]

For a small input change, multiply the derivative by that change to estimate the output change. Then compare that estimate with a fresh evaluation of the full expression. The distinction between these two calculations matters: the derivative gives a tangent approximation, while substitution evaluates the chosen expression at the new point.

slope_expression = sp.diff(expression, q)
slope_at_reference = float(slope_expression.subs(q, reference_input))
changed_input = 1.0075
linear_prediction = reference_output + slope_at_reference * (
    changed_input - reference_input
)
full_prediction = float(evaluate(changed_input))
print("Symbolic derivative:", slope_expression)
print("Tangent prediction:", linear_prediction, "scaled energy units")
print("Full expression:", full_prediction, "scaled energy units")
print(
    "Approximation difference:",
    full_prediction - linear_prediction,
    "scaled energy units",
)

Here the changed input is 1.0075 scaled length units. The tangent estimate is 14.5823 scaled energy units, while the full expression gives 14.5848 scaled energy units. If the two values are close, it means the chosen input change is small enough for this local approximation at this point. It does not mean the entire model is linear. If the slope is zero, a quadratic or higher-order term may supply the leading change instead.

This is also the beginning of uncertainty propagation. If the input has a small stated standard uncertainty, the magnitude of the slope times that uncertainty estimates one contribution to output uncertainty. Do not automatically use the same rule for a wide interval, a discontinuity, a turning point with zero first derivative, or several correlated uncertain inputs. Those situations need more of the model than one slope.

Check the derivative with numerical differences

We can estimate the same slope from values on either side of the reference point. Subtract the lower output from the upper output and divide by twice the input step. Parentheses are essential: the entire output difference must be divided by the entire input interval. Without them, Python can execute a different mathematical expression while still producing a plausible number.

The calculation below uses three decreasing step sizes. Each estimate is compared with the symbolic derivative, so the reference is independent of the numerical difference formula. Near an endpoint, it is acceptable here to evaluate a small extension only because the displayed mathematical expression is smooth there; such a check does not assert that extrapolated values describe additional physical cases.

input_span = 1.5
for fraction in [1e-2, 1e-3, 1e-4]:
    step = input_span * fraction
    upper = float(evaluate(reference_input + step))
    lower = float(evaluate(reference_input - step))
    numerical_slope = (upper - lower) / (2 * step)
    difference = numerical_slope - slope_at_reference
    print(f"step={step:.6g}: slope={numerical_slope:.6g}, difference={difference:.6g}")

For a smooth function, reducing the step often reduces the approximation error at first. Very small steps can eventually make subtraction of nearly equal floating-point values less reliable. Therefore “smaller” is not an unlimited guarantee of “better.” Compare the observed behaviour over a useful range of steps instead of choosing the smallest number the computer can represent.

An absolute slope difference is useful when the expected slope is near zero. A relative difference would divide by a very small reference and could look enormous even when the absolute discrepancy is tiny. Away from zero, a relative difference can help compare quantities with very different scales. The tolerance should reflect the question and the numerical method, rather than a universal decimal threshold copied into every test.

Change the example and preserve the reasoning

Make one copy of the reference calculation before editing it. Choose a second value of well width inside the stated interval, predict whether first excitation energy gap will rise or fall, and then evaluate the expression. Place the prediction and the result in a text cell. If they disagree, identify whether the mistake was in the sign, the unit conversion, the algebra, or the assumption about how the curve behaves.

Next choose a shorter plotting interval around the reference point. Compare the local curve with its tangent approximation. Then widen the interval again. The difference shows why a useful local estimate need not describe the whole range. Keep the axis labels and numerical scale visible when comparing the plots; automatic axis limits can make two different effects appear equally large.

Finally, return to the physical limit stated at the start: The transition energy does not by itself determine a transition probability or selection rule. Describe one change to the setup that would violate that limit. State what new input, equation, or observation would be needed before trusting an answer in the changed situation. This last step connects the Python experiment to the physics instead of treating successful execution as the only criterion for a useful result.

Before saving, restart the runtime and run all cells in order. A result that depends on an earlier, now-deleted input cell is not reproducible from the saved notebook. Keep unrounded values for later calculations, round only the reported output, and label any new data as measured, assumed, or generated. The graph and printed values should remain traceable to the same expression and the same choices of inputs.

Recover the output change by integrating the slope

There is another way to check that the expression and its derivative describe the same relationship. Add up the small output changes predicted by the slope across the chosen input interval. In the continuous limit, this integral equals the output at the upper endpoint minus the output at the lower endpoint. The result has units of scaled energy units: the input unit in the integration cancels the input unit in the denominator of the slope.

This statement is about the mathematics of this particular relationship. It does not assign a new physical meaning to an arbitrary area under a graph. For example, an area under force versus distance represents work, while an area under a different pair of quantities may represent something else or have no standard name. Always carry the axis units through the calculation before naming an integral.

slope_function = sp.lambdify(q, slope_expression, modules="numpy")
endpoint_change = float(evaluate(2.0) - evaluate(0.5))
for points in [101, 201, 401]:
    grid = np.linspace(0.5, 2.0, points)
    slopes = np.asarray(slope_function(grid), dtype=float)
    slopes = np.broadcast_to(slopes, grid.shape)
    integrated_change = np.trapezoid(slopes, grid)
    print(
        points,
        "integrated change:",
        integrated_change,
        "endpoint change:",
        endpoint_change,
    )

The trapezoidal rule joins neighbouring slope samples with straight segments and adds their signed areas. A negative contribution remains negative; replacing every slope by its magnitude would calculate a different quantity. Increasing the sample count provides a practical refinement check. If the values do not settle toward the endpoint difference, first inspect the interval, singularities, and array ordering.

Do not conclude that two agreeing calculations prove the model is physically complete. Both use the same selected relationship, so an omitted effect would be omitted from both. Their agreement is evidence that the numerical tools implement that relationship consistently. Comparing with an independent experiment or a more appropriate physical model is a separate test.

Keep this comparison in the notebook when you change the expression. It is particularly useful after adding a coefficient, changing a sign convention, or converting an input unit. A code cell that produces a smooth graph can conceal these mistakes; a second calculation of the same output change gives you another place to notice them.

Sources


Share to: