Laplace's Equation
When the temperature in a plate stops changing, , and the heat equation in two dimensions becomes Laplace's equation
Its solutions, harmonic functions, describe steady-state temperature, electrostatic potential, ideal fluid flow and the shape of a soap film with small slopes. Only boundary values are given; there is no time.
The Dirichlet problem on a rectangle
On , , suppose on three sides and on the top. Separation gives
The -problem with is the familiar eigenvalue problem, . Now the -equation has exponential (hyperbolic) solutions, and selects :
where are the sine coefficients of . Each mode decays away from the top edge, high modes fastest: the interior is smooth even if the boundary data are rough. For data on several sides, solve one side at a time and add (superposition).
import numpy as np
a = b = 1.0
n = np.arange(1, 200)
c = 2 * (1 - (-1)**n) / (n * np.pi) # sine coefficients of f(x) = 1 (hot top edge)
def u(x, y):
return np.sum(c * np.sinh(n * np.pi * y / a) / np.sinh(n * np.pi * b / a) * np.sin(n * np.pi * x / a))
print("centre:", round(u(0.5, 0.5), 6))
for y in (0.25, 0.5, 0.75, 0.95):
print(f"u(0.5, {y}) = {u(0.5, y):.4f}")centre: 0.25
u(0.5, 0.25) = 0.0954
u(0.5, 0.5) = 0.2500
u(0.5, 0.75) = 0.5405
u(0.5, 0.95) = 0.8997
The centre value is exactly by symmetry: putting the hot edge on each of the four sides in turn and adding gives everywhere, so each contributes a quarter at the centre.
The mean value property
A harmonic function's value at any point equals its average over any circle centred there (inside the domain). Consequences:
- Maximum principle: a harmonic function attains its maximum and minimum on the boundary, never strictly inside. A steady temperature has no hot spot in the interior.
- Uniqueness: two solutions with the same boundary values differ by a harmonic function that is 0 on the boundary, hence 0 everywhere.
The mean value property also gives an algorithm: repeatedly replace each grid value by the average of its four neighbours. That is the Jacobi iteration of Jacobi and Gauss-Seidel.
import numpy as np
N = 21
U = np.zeros((N, N))
U[-1, :] = 1.0 # top edge hot, others 0
for it in range(3000):
U[1:-1, 1:-1] = 0.25 * (U[:-2, 1:-1] + U[2:, 1:-1] + U[1:-1, :-2] + U[1:-1, 2:])
print("centre after relaxation:", round(U[N // 2, N // 2], 4))
print("interior max:", round(U[1:-1, 1:-1].max(), 4), "(below the boundary max 1)")centre after relaxation: 0.25
interior max: 0.8993 (below the boundary max 1)
Laplace's equation in a disc
In polar coordinates, . Separation gives and , so the solution in the unit disc with boundary values is
with the full Fourier series coefficients of . At the centre , the average of : the mean value property again.
In software
- Mesh smoothing and "harmonic" interpolation in graphics (Laplacian smoothing, harmonic coordinates for character deformation) solve discrete Laplace equations.
- Image inpainting fills a hole by solving with the surrounding pixels as boundary values; Poisson image editing (seamless cloning in photo editors) solves .
- Electrostatics and potential-flow solvers in engineering tools discretize the same equation (Two-Dimensional Poisson Problems).
Exercises
Exercise 1: Is it harmonic?
Which are harmonic: , , ?
Answer
and .
Solution
; ; .
Exercise 2: Disc
Solve in the unit disc with .
Answer
.
Solution
The boundary data is already a Fourier series with and ; multiply each term by . In Cartesian coordinates .
Exercise 3: Mean value (code)
Check the mean value property for on the circle of radius 0.5 around .
Answer
Both equal .
Solution
import numpy as np
th = np.linspace(0, 2 * np.pi, 100000, endpoint=False)
x, y = 0.3 + 0.5 * np.cos(th), 0.2 + 0.5 * np.sin(th)
print(round(np.mean(np.exp(x) * np.cos(y)), 6), round(np.exp(0.3) * np.cos(0.2), 6))1.322952 1.322952
Test yourself
Laplace's equation describes…
- time-dependent heat flow
- steady states: temperature, potentials, ideal flow
- waves
- population growth
By the maximum principle, a harmonic function on a bounded region…
- has its maximum inside
- takes its maximum and minimum on the boundary
- is constant
- has no maximum
In the rectangle solution, the -dependence of each mode is…
- (exponential growth away from the zero edge)
- constant