Boundary Value Problems and Eigenfunctions
So far conditions were given at one point: and . In a boundary value problem (BVP) they are given at two ends, such as the temperature at both ends of a rod or a string fixed at both ends. BVPs behave very differently from initial value problems: they may have no solution, one, or infinitely many. That last case, the eigenvalue problem, is the key to solving PDEs with Fourier series.
Existence is not guaranteed
Consider with different boundary conditions. The general solution is .
| Conditions | Result |
|---|---|
| , | , : unique solution |
| , | , arbitrary: infinitely many |
| , | and : no solution |
The eigenvalue problem
Find all for which
has a nonzero solution. Such are eigenvalues and the solutions eigenfunctions, by analogy with : here the "matrix" is the operator with the boundary conditions.
- : ; the conditions force .
- : ; again only .
- : . gives , and with needs .
These are the shapes of a vibrating string's harmonics.
Eigenvalues numerically: a matrix approximation
Replace by the finite difference on interior grid points. The problem becomes a matrix eigenvalue problem , and the smallest eigenvalues approximate (more in Finite Differences for Boundary Value Problems):
import numpy as np
L, N = np.pi, 200
h = L / (N + 1)
D = (np.diag(-2 * np.ones(N)) + np.diag(np.ones(N - 1), 1) + np.diag(np.ones(N - 1), -1)) / h**2
lam = np.sort(np.linalg.eigvalsh(-D))
print("numerical:", lam[:5].round(4))
print("exact n^2:", [n**2 for n in range(1, 6)])numerical: [ 1. 3.9997 8.9984 15.9948 24.9873]
exact n^2: [1, 4, 9, 16, 25]
Other boundary conditions
Changing the conditions changes the eigenfunctions:
| Conditions | Eigenvalues | Eigenfunctions |
|---|---|---|
| (Dirichlet) | , | |
| (Neumann) | , | (including the constant) |
| periodic on | , | and |
The Dirichlet sines lead to sine series, the Neumann cosines to cosine series, and the periodic case to full Fourier series (Fourier Series).
Orthogonality
Eigenfunctions with different eigenvalues are orthogonal: for . This mirrors the fact that a symmetric matrix has orthogonal eigenvectors, and it is what makes Fourier coefficients easy to compute.
import sympy as sp
x = sp.symbols("x")
L = sp.pi
for m, n in ((1, 2), (2, 5), (3, 3)):
print(f"m={m}, n={n}:", sp.integrate(sp.sin(m * x) * sp.sin(n * x), (x, 0, L)))m=1, n=2: 0
m=2, n=5: 0
m=3, n=3: pi/2
In software
scipy.integrate.solve_bvpsolves nonlinear two-point boundary value problems by collocation.- Structural engineers compute the vibration modes of beams and buildings as eigenvalue problems of this kind, with sparse eigensolvers on discretized operators.
- Quantum mechanics: the energy levels of a "particle in a box" are exactly the Dirichlet eigenvalues above (times ).
Exercises
Exercise 1: Solve a BVP
Solve , , .
Answer
.
Solution
. and .
Exercise 2: Eigenvalues on a different interval
Find the eigenvalues and eigenfunctions of , .
Answer
, .
Solution
Use the general formula with .
Exercise 3: Mixed conditions (code)
For , , , show that , and check the first three numerically.
Answer
with .
Solution
and needs . Numerically, the Neumann end can be handled with a ghost point (), which doubles one off-diagonal entry; the matrix is no longer symmetric, so use eigvals:
import numpy as np
N = 400; h = np.pi / N
D = (np.diag(-2 * np.ones(N)) + np.diag(np.ones(N - 1), 1) + np.diag(np.ones(N - 1), -1)) / h**2
D[-1, -2] = 2 / h**2 # ghost point at x = pi
print(np.sort(np.linalg.eigvals(-D).real)[:3].round(4))[0.25 2.25 6.2498]
Test yourself
The eigenvalues of , are…
- for
- all real numbers
- only 0
Unlike an initial value problem, a boundary value problem…
- always has a unique solution
- may have no solution or infinitely many
- never has a solution
- is always nonlinear
Neumann conditions give eigenfunctions…
- including the constant
- polynomials