Finite Difference Methods
Finite difference methods approximate derivatives by differences of nearby grid values. In quantum mechanics, they turn differential Hamiltonians into sparse matrices that can be diagonalized, propagated in time by Time-Stepping Methods, or used in boundary-value calculations. The full PDE workflow is organized in PDE Solvers.
The core idea is local: if a wavefunction is smooth on the scale of the grid spacing , Taylor expansions relate derivatives at to samples at neighboring points. The numerical danger is equally local: if the grid does not resolve the wavefunction or the boundary condition is implemented incorrectly, the resulting matrix solves a different problem.
Why Quantum Mechanics Needs Them
Section titled “Why Quantum Mechanics Needs Them”Finite differences appear in:
- one-dimensional bound-state calculations;
- finite-box approximations to continuum problems;
- tunneling through smooth barriers;
- radial Schrödinger equations after coordinate reduction;
- time-dependent wave-packet propagation on grids;
- finite-volume or finite-element methods in more advanced settings;
- benchmark calculations for validating more elaborate codes.
They are not always the most accurate method for smooth periodic problems, where Spectral Methods may converge faster. But finite differences are transparent, sparse, local, and easy to inspect.
Uniform Grid
Section titled “Uniform Grid”On a uniform one-dimensional grid,
Taylor expansions give
and
Adding or subtracting these expansions produces derivative formulas.
First Derivatives
Section titled “First Derivatives”The centered first derivative is
One-sided formulas are useful near boundaries. The forward difference
is only first-order accurate. Higher-order one-sided formulas exist, but boundary accuracy and boundary conditions should be handled deliberately rather than patched after the fact.
In quantum mechanics, first derivatives appear in momentum operators, current densities, radial transformations, and gauge-coupled Hamiltonians. A careless first-derivative discretization can break Hermiticity or time-reversal properties.
Second Derivatives
Section titled “Second Derivatives”The centered second derivative is
For the one-dimensional Hamiltonian
this gives the grid action
where .
This is the standard starting point for finite-difference bound-state calculations.
Laplacian Matrix
Section titled “Laplacian Matrix”For interior grid points with Dirichlet boundary conditions at the endpoints, the second-difference matrix is
The Hamiltonian matrix is
For real , this matrix is real symmetric. With the usual uniform-grid inner product, it is Hermitian and can be passed to a Hermitian eigensolver.
The resulting matrix is sparse: each row couples only neighboring grid points. This sparsity is one reason finite differences scale to much larger grids than dense methods. The storage and matrix-vector-product language is developed in Sparse Matrices.
Boundary Conditions
Section titled “Boundary Conditions”Boundary conditions change the first and last rows of the matrix.
For Dirichlet boundaries, one often stores only interior points and sets the exterior boundary values to zero. For periodic boundaries, the first and last interior points are coupled:
For Neumann boundaries, one approximates a derivative condition such as . A simple ghost-point implementation sets
which enforces the centered derivative to vanish at the boundary point.
Boundary rows are common sources of errors because they are not the same as the interior stencil. Always state how the boundary condition was implemented.
Higher-Order Stencils
Section titled “Higher-Order Stencils”The basic centered second derivative is second-order accurate. A fourth-order version is
Higher-order stencils can improve accuracy for smooth wavefunctions, but they use wider neighborhoods. Wider stencils complicate boundaries, increase matrix bandwidth, and may behave poorly near nonsmooth potentials or discontinuities.
Order is not the only criterion. A lower-order method with correct boundary treatment can outperform a higher-order stencil with inconsistent boundary rows.
Multidimensional Laplacians
Section titled “Multidimensional Laplacians”On a rectangular two-dimensional grid with spacings and , a common Laplacian approximation is
where and are one-dimensional second-difference matrices and is the matrix Kronecker product.
This tensor-product structure is valuable. It gives sparse Hamiltonians and makes separable benchmark problems easy to check. On irregular domains or curvilinear coordinates, additional metric factors and boundary geometry must be handled carefully.
Accuracy and Convergence
Section titled “Accuracy and Convergence”For a second-order stencil, the local derivative error is when the wavefunction is sufficiently smooth. For eigenvalues, the observed convergence can depend on the state, boundary conditions, potential smoothness, and box size.
A standard grid-refinement test compares results at , , and . If the leading error is proportional to , then the error should shrink by about a factor of when is halved.
This is only meaningful after domain truncation error is under control. For bound states in a finite box, increase the box size and refine the grid separately.
For a systematic refinement workflow, see Convergence Tests.
Roundoff and Conditioning
Section titled “Roundoff and Conditioning”Derivative matrices grow as shrinks. The second-difference matrix has entries of size , so roundoff and conditioning can become more visible on very fine grids.
For a second derivative, a schematic error balance is
where is the unit roundoff. The first term decreases with refinement; the second can increase. See Floating-Point Arithmetic and Conditioning and Stability for the numerical background.
Physical Validation
Section titled “Physical Validation”Finite-difference Hamiltonians should be tested on known cases:
- infinite square well energies;
- harmonic oscillator low-lying levels;
- free-particle dispersion on a periodic grid;
- symmetry of even and odd states in symmetric potentials;
- normalization and orthogonality under the discrete inner product.
For the infinite well, the exact continuum energies are proportional to . A finite-difference grid should reproduce low- levels increasingly well under refinement, while high- levels near the grid cutoff converge poorly.
Common Mistakes
Section titled “Common Mistakes”- Using the interior stencil at a boundary without implementing the boundary condition.
- Forgetting the factor in the Laplacian.
- Assuming high-energy eigenvalues converge as quickly as low-energy eigenvalues.
- Treating a finite-box spectrum as a continuum spectrum.
- Refining while ignoring roundoff or box-size effects.
- Breaking Hermiticity with an asymmetric derivative stencil.
- Comparing grid wavefunctions without using the correct discrete inner product.
- Using a high-order stencil near a discontinuity and expecting high-order convergence.
Cross-Links
Section titled “Cross-Links”- Discretization
- Spectral Methods
- Floating-Point Arithmetic
- Conditioning and Stability
- Matrix Diagonalization
- Sparse Matrices
- Time-Stepping Methods
- PDE Solvers
- Convergence Tests
- Boundary Conditions
- Eigenvalue Problems
- Matrices as Linear Maps
- Infinite Square Well
- Quantum Harmonic Oscillator
- Imaginary-Time Projection Notebook
References
Section titled “References”- R. J. LeVeque, Finite Difference Methods for Ordinary and Partial Differential Equations, SIAM, 2007.
- J. M. Thijssen, Computational Physics, 2nd ed., Cambridge University Press, 2007.
- T. Pang, An Introduction to Computational Physics, 2nd ed., Cambridge University Press, 2006.
- W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery, Numerical Recipes: The Art of Scientific Computing, 3rd ed., Cambridge University Press, 2007.
- G. D. Smith, Numerical Solution of Partial Differential Equations: Finite Difference Methods, 3rd ed., Oxford University Press, 1985.
Exercises
Section titled “Exercises”- Derive the centered second-derivative formula by adding Taylor expansions at and .
Solution
Taylor expansion gives
and
Adding and solving for gives
- Write the second-difference matrix for three interior points with Dirichlet boundary conditions.
Solution
With three interior points, the matrix is
The missing boundary values are fixed to zero by the Dirichlet condition.
- For real , explain why the standard finite-difference Hamiltonian with Dirichlet boundaries is Hermitian.
Solution
The second-difference matrix is real symmetric, so . The potential matrix is also real diagonal, hence Hermitian. A real linear combination of Hermitian matrices is Hermitian, so
is Hermitian.
- A second-order finite-difference eigenvalue error is dominated by . If halving does not reduce the error by about a factor of , name two possible explanations.
Solution
One possibility is that another error source dominates, such as finite-box error, roundoff, or eigensolver tolerance. Another is that the assumptions behind second-order convergence are not met, for example because the potential or wavefunction is not sufficiently smooth or because the boundary stencil is only first-order accurate.
- How does a periodic boundary condition modify the one-dimensional second-difference matrix?
Solution
The first and last grid points become neighbors. In addition to the usual tridiagonal entries, the matrix has corner entries connecting the first row to the last column and the last row to the first column. These entries implement