Eigenproblems: bound states

An eigenproblem asks for a function and a number together: the states of a potential with their energies, the lowest eigenvalues of an operator with their eigenfunctions. This page says how one is stated and what comes back, in free space and on periodic domains. Between walls, on round domains and on shapes an eigenproblem asks for the modes of the domain, which have a page of their own.

import numpy as np
import sympy as sp
import pdemagic as pm

x, y = sp.symbols("x y", real=True)
E = sp.Symbol("E")

An eigenvalue is an unknown

You write the equation as it stands, with a symbol for the eigenvalue, and say with eigenvalue= which symbol that is and how many of the lowest eigenvalues you want. The harmonic oscillator, \(-\tfrac12\psi'' + \tfrac12 x^2\psi = E\,\psi\):

psi = sp.Function("psi")(x)

oscillator = pm.Problem(
    sp.Eq(-psi.diff(x, 2) / 2 + x**2 / 2 * psi, E * psi),
    domain=pm.FreeSpace(x),
    eigenvalue=(E, 5),
)
states = pm.solve(oscillator)

assert np.allclose(states.eigenvalues, [0.5, 1.5, 2.5, 3.5, 4.5], atol=1e-9)
states.plot()
The figure that the example above draws. The figure that the example above draws.

states.eigenvalues holds the eigenvalues, from the lowest. states[psi] holds the eigenfunctions, with the first axis counting them: states[psi][0] belongs to states.eigenvalues[0].

assert states[psi].shape == (5, 96)

# The lowest state is exp(−x²/2)/π^(1/4).
(xs,) = states.axes
assert abs(states[psi][0] - np.exp(-(xs**2) / 2) / np.pi**0.25).max() < 1e-8

An eigenfunction is fixed up to a factor. Here each has the integral of its square over the domain equal to one, and its largest value positive. Eigenfunctions of the same eigenvalue are some orthonormal choice among them.

Bound states in free space

In free space the states that are found are the bound ones: those that fade far away. The planner finds where the potential is lowest, and solves on a box that reaches as far as the highest state that you asked for:

plan = pm.plan(oscillator)
assert plan.grid.lower[0] < -8 and plan.grid.upper[0] > 8
assert states.diagnostics["solution_boundary_ratio"] < 1e-9

The diagnostic solution_boundary_ratio says how far the states have faded at the faces of the box. The potential need not be symmetric, nor stand at the origin. A Morse well, the model of a bond between two atoms, is steep on one side and flat on the other, and binds a finite number of states, \(E_n = 4(n + \tfrac12) - \tfrac12(n + \tfrac12)^2\):

bond = pm.Problem(
    sp.Eq(-psi.diff(x, 2) / 2 + 8 * (1 - sp.exp(-x)) ** 2 * psi, E * psi),
    domain=pm.FreeSpace(x),
    eigenvalue=(E, 3),
)
vibrations = pm.solve(bond)
assert np.allclose(vibrations.eigenvalues, [1.875, 4.875, 6.875], atol=1e-9)

# The box is short where the well is steep, and long where it is flat.
box = vibrations.plan.grid
assert -box.lower[0] < box.upper[0] / 4

A potential that binds fewer states than you ask for is refused, with the eigenvalue at which the states stop fading. A state that is not bound has no box: it fills all of space.

In the plane and in space it is the same: pm.FreeSpace(x, y), with pm.laplacian in the equation. A potential with a singularity, such as \(-1/r\), is refused in free space, because a uniform grid does not resolve it. In a ball it is solved.

Periodic domains

A domain that is periodic is a crystal. An electron in a lattice of wells, in the plane:

phi = sp.Function("phi")(x, y)
cell = pm.Space(x, y, periodic={x: (0, 2 * sp.pi), y: (0, 2 * sp.pi)})

lattice = pm.Problem(
    sp.Eq(-pm.laplacian(phi) / 2 - 2 * (sp.cos(x) + sp.cos(y)) * phi, E * phi),
    domain=cell,
    eigenvalue=(E, 4),
)
bands = pm.solve(lattice)

# The second and the third state have the same energy: one along x, one
# along y.
assert abs(bands.eigenvalues[1] - bands.eigenvalues[2]) < 1e-9
assert bands.eigenvalues[0] < bands.eigenvalues[1] < bands.eigenvalues[3]
bands.plot(state=3)
The figure that the example above draws. The figure that the example above draws.

In two dimensions a plot draws one state, the lowest unless state= names another. Plotting has the rest.

What the equation may be

In free space and on periodic domains the operator is \(H = -\sum_i a_i\,\partial_i^2 + V(\mathbf{x})\), with positive constants \(a_i\), which may differ from coordinate to coordinate, and a real potential \(V\): a formula, or an array. The eigenvalue stands as a factor in front of the unknown. How the equation is arranged is up to you. Mathieu’s equation in its usual form reads

u = sp.Function("u")(x)
a = sp.Symbol("a")
circle = pm.Space(x, periodic={x: (0, 2 * sp.pi)})

mathieu = pm.Problem(
    sp.Eq(u.diff(x, 2) + (a - 2 * sp.cos(2 * x)) * u, 0),
    domain=circle,
    eigenvalue=(a, 3),
)
characteristic = pm.solve(mathieu).eigenvalues
assert np.allclose(characteristic, [-0.4551386, -0.1102488, 1.8591081], atol=1e-6)

Not taken yet: first derivatives in the operator, such as a magnetic field brings, second derivatives with coefficients that vary, a potential that is not real, an operator that depends on its own eigenfunctions, and eigenvalues other than the lowest. The known limits list them all.

What the planner chose

The planner solves on one grid after another, and takes the first on which the eigenfunctions are resolved. pm.solve without a plan returns what the planner found on that grid:

assert plan.method.kind == "fourier_subspace"
assert plan.grid.shape == [96]
assert states.diagnostics["residual"] <= plan.method.tolerance

The eigenvalues come from an iteration. method.tolerance and method.max_iterations say when it stops. The diagnostics residual and iterations report what it reached, and solution_tail how well the grid resolves the eigenfunctions.

A solution of an eigenproblem is integrated, saved and handed to other tools as any other, state by state: states.integral() gives five numbers. Solutions has more.

See also