Skip to content
Tutorials Center
My learning

Topics

Lesson 35 of 39 · PDEs and Applications

Laplace's Equation and Potential Problems

Study Laplace and Poisson equations: harmonic functions, the maximum principle, a series solution on a rectangle and Jacobi relaxation on a grid with NumPy.

Wait long enough for the heat equation and everything settles: the temperature stops changing and u_t = 0. What is left satisfies Laplace's equation

TEXT
u_xx + u_yy = 0        (written Δu = 0, or ∇²u = 0)

It describes steady-state temperature, the electrostatic potential in a charge-free region, the velocity potential of ideal fluid flow and the shape of a soap film. Adding a source gives Poisson's equation Δu = f (charge density, heat sources, gravity). Because there is no time, the problem is an elliptic boundary value problem: the values of u on the whole boundary of a region determine the solution inside.

Harmonic functions

Solutions of Laplace's equation are called harmonic functions. Examples in the plane are x, x² - y², x y, e^x cos y and ln sqrt(x² + y²) (away from the origin). Real and imaginary parts of any analytic function of z = x + iy are harmonic, which links PDEs to complex analysis.

Harmonic functions are remarkably well behaved:

  • Mean value property: the value at the center of a disk equals the average over its boundary circle. Every point is the average of its neighbors, which is the key to the numerical method below.
  • Maximum principle: the maximum and minimum of u occur on the boundary, never in the interior (unless u is constant). No hot spots appear on their own.
  • Uniqueness: a Dirichlet problem (values on the boundary) has exactly one solution.
  • Smoothness: harmonic functions are infinitely differentiable.

A rectangle by separation of variables

Take the rectangle 0 < x < a, 0 < y < b, with u = 0 on the left, right and bottom, and u(x, b) = f(x) on top. Separate u = X(x) Y(y): X'' + λX = 0 with X(0) = X(a) = 0 gives X_n = sin(nπx/a), λ_n = (nπ/a)², and then Y'' = λ_n Y, with Y(0) = 0, so Y_n = sinh(nπy/a). The solution is

TEXT
u(x, y) = Σ b_n sin(nπx/a) sinh(nπy/a) / sinh(nπb/a),     b_n = (2/a) ∫_0^a f(x) sin(nπx/a) dx

Compare with the heat equation: the same eigenfunctions in x, but in the other variable the solutions grow and decay exponentially instead of oscillating. High-frequency details of the boundary data fade quickly as you move into the interior.

Python Square with one hot side: series solution

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

By symmetry, the four problems "one side at 1, the others 0" rotated into each other add up to the constant solution 1, so each contributes 1/4 at the center. The series reproduces this.

Relaxation: the mean value property as an algorithm

On a grid with spacing h the five-point formula says

TEXT
u_{i,j} = ¼ (u_{i+1,j} + u_{i-1,j} + u_{i,j+1} + u_{i,j-1})

(plus -h² f_{i,j}/4 for Poisson). Every interior value is the average of its four neighbors. This is a large linear system, but Jacobi iteration solves it with almost no code: start with any guess, replace each interior value by the average of its neighbors, and repeat. Information from the boundary slowly diffuses inward until nothing changes. Gauss-Seidel uses already updated values immediately and converges about twice as fast; SOR (successive over-relaxation) with a good relaxation factor is much faster again.

Python Jacobi relaxation versus the series

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The center value matches 0.25 almost exactly: the grid problem has the same four-fold symmetry as the real one, so the symmetry argument carries over. Values elsewhere carry the second-order discretization error O(h²). The maximum principle holds: all values lie between the smallest and largest boundary value. The slow part is the iteration count, which for Jacobi grows like N²; for big grids use SOR, multigrid or a sparse direct solver.

Poisson's equation and sources

For Δu = f with u = 0 on the boundary, the same grid formula applies with an extra term, and the solution is no longer harmonic: it can have interior maxima where the source is. A classic exact test is u = sin(πx) sin(πy) on the unit square with f = -2π² sin(πx) sin(πy).

Python Poisson solved with a sparse-style Gauss-Seidel sweep

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With SOR the iteration has converged to the discretization error (about 8e-4 at this resolution) within the first hundred sweeps and then stops improving: that remaining error comes from the grid, not from the iteration. Doubling N would cut it by a factor of 4.

Elliptic problems

Harmonic Every point equals its neighbors' average.
Maximum principle Extremes live on the boundary.
Whole boundary Data on all sides determine u.
Relaxation Iterate averages until nothing moves.

Poisson adds a source term; Laplace has none.

1 / 2

Other geometries

Separation of variables works whenever the boundary matches a coordinate system. In polar coordinates the equation is u_rr + u_r/r + u_θθ/r² = 0, giving solutions r^n cos nθ and r^n sin nθ inside a disk (the Poisson integral formula expresses the solution through the boundary values). In spherical coordinates the angular parts produce Legendre polynomials, as covered in Bessel and Legendre functions, so the potential of a charged sphere is a sum of r^n P_n(cos φ).

Common mistakes

  • Prescribing values on only part of the boundary. Elliptic problems need the full boundary (or a Neumann condition).
  • Applying the maximum principle to Poisson problems with sources.
  • Declaring convergence from a loose tolerance on the change; check the residual too.
  • Mixing up row and column indexing on the grid (u[j, i] with j for y).

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Which function is harmonic in the plane?

    The Laplacian of x² - y² is 2 - 2 = 0. The others give 4, 6x and 2e^(x+y).
  2. 2. The maximum principle for Laplace's equation says that the maximum of u occurs:

    A harmonic function has no interior extremum unless it is constant.
  3. 3. In Jacobi iteration each interior value is replaced by:

    This is the discrete form of the mean value property.
  4. 4. Laplace's equation describes:

    With no time dependence and no sources, steady temperature or potential satisfies Δu = 0.

Summary

  • Laplace's equation Δu = 0 governs steady states; Poisson's Δu = f adds sources.
  • Harmonic functions satisfy the mean value property and the maximum principle.
  • On a rectangle, separation of variables gives sin(nπx/a) sinh(nπy/a) series.
  • On a grid, each value is the average of its neighbors: Jacobi, Gauss-Seidel and SOR relax toward the solution.
  • Polar and spherical coordinates lead to powers r^n and Legendre or Bessel functions.

Next: Project: Predator and Prey