TExcelTAD

Separation of Variables

Uniqueness tells us a boundary-value problem has exactly one answer; it does not tell us how to find it. For boundaries that follow coordinate surfaces (the walls of a rectangular box, a cylinder, a sphere) there is a systematic analytic method: look for solutions that are products of functions of one coordinate each, find the family that fits the zero-potential walls, and add them up as a Fourier series to fit the remaining wall. The result is an exact series solution, and it is the benchmark every numerical field solver in this course is checked against.

The rectangular trough

V = V0 (lid) V = 0V = 0V = 0 gapgap a b centre (0,0)

A long metal trough, infinite in zz, has width aa and height bb. The bottom and sides are grounded; the lid at y=by = b is held at V0V_0, insulated from the walls by thin gaps. Inside there is no charge, so ∇2V=∂2V/∂x2+∂2V/∂y2=0\nabla^2 V = \partial^2 V/\partial x^2 + \partial^2 V/\partial y^2 = 0 with

V(0,y)=0,V(a,y)=0,V(x,0)=0,V(x,b)=V0V(0, y) = 0, \quad V(a, y) = 0, \quad V(x, 0) = 0, \quad V(x, b) = V_0

Separate. Try V=X(x) Y(y)V = X(x)\,Y(y). Dividing Laplace's equation by XYXY gives X′′/X+Y′′/Y=0X''/X + Y''/Y = 0. A function of xx alone equals minus a function of yy alone only if both are a constant, the separation constant:

X′′X=−k2,Y′′Y=+k2\frac{X''}{X} = -k^2, \qquad \frac{Y''}{Y} = +k^2

Fit the homogeneous walls. X′′=−k2XX'' = -k^2X has solutions sin⁡kx\sin kx and cos⁡kx\cos kx. X(0)=0X(0) = 0 keeps only sin⁡kx\sin kx; X(a)=0X(a) = 0 requires k=nπ/ak = n\pi/a, n=1,2,3,…n = 1, 2, 3, \dots (the eigenvalues). Then Y′′=k2YY'' = k^2Y with Y(0)=0Y(0) = 0 gives Y=sinh⁡(nπy/a)Y = \sinh(n\pi y/a). Each product sin⁡(nπx/a)sinh⁡(nπy/a)\sin(n\pi x/a)\sinh(n\pi y/a) satisfies Laplace's equation and three of the four walls.

Fit the last wall with a Fourier series. Laplace's equation is linear, so any sum of these products is also a solution:

V(x,y)=∑n=1∞cnsin⁡nπxa sinh⁡nπyaV(x, y) = \sum_{n=1}^{\infty} c_n \sin\frac{n\pi x}{a}\,\sinh\frac{n\pi y}{a}

At y=by = b this must equal V0V_0 for 0<x<a0 < x < a: a Fourier sine series of a constant (Fourier Series). Using orthogonality of the sines, cnsinh⁡(nπb/a)=2a∫0aV0sin⁡(nπx/a) dxc_n\sinh(n\pi b/a) = \frac{2}{a}\int_0^a V_0\sin(n\pi x/a)\,dx, which is 4V0/(nπ)4V_0/(n\pi) for odd nn and zero for even nn:

V(x,y)=4V0π∑n odd1n sin⁡nπxa sinh⁡(nπy/a)sinh⁡(nπb/a)V(x, y) = \frac{4V_0}{\pi}\sum_{n\ \text{odd}} \frac{1}{n}\,\sin\frac{n\pi x}{a}\,\frac{\sinh(n\pi y/a)}{\sinh(n\pi b/a)}

The same method solves the heat equation in a plate (Laplace's Equation, Boundary Value Problems).

How fast does it converge? The factor sinh⁡(nπy/a)/sinh⁡(nπb/a)≈e−nπ(b−y)/a\sinh(n\pi y/a)/\sinh(n\pi b/a) \approx e^{-n\pi(b - y)/a} kills high harmonics quickly away from the lid; near the lid convergence is slow, and at the corners the boundary data jump from V0V_0 to 00, so the series shows the Gibbs overshoot there. Physically the corners are the gaps, where the field is very large.

Symmetry check: the centre of a square

For a square trough (a=ba = b), imagine four problems, each with a different wall at V0V_0 and the others grounded. Their sum has all four walls at V0V_0, whose solution is V=V0V = V_0 everywhere. By symmetry all four give the same value at the centre, so each is V0/4V_0/4. This is an exact check on any solution method.

Worked example

Given: a square trough, a=ba = b, lid at V0=10 VV_0 = 10\ \text{V}.

Find: the potential at the centre from the first two terms of the series.

Solve: at x=a/2x = a/2, y=a/2y = a/2:

n=1:4⋅10 Vπ⋅sin⁡π2⋅sinh⁡(π/2)sinh⁡π=12.732 V⋅1⋅2.301311.549=2.537 Vn=3:4⋅10 V3π⋅sin⁡3π2⋅sinh⁡(3π/2)sinh⁡3π=4.244 V⋅(−1)⋅55.656195.8=−0.038 VV≈2.537−0.038=2.499 V\begin{aligned} n = 1: &\quad \frac{4 \cdot 10\ \text{V}}{\pi} \cdot \sin\frac{\pi}{2} \cdot \frac{\sinh(\pi/2)}{\sinh\pi} = 12.732\ \text{V} \cdot 1 \cdot \frac{2.3013}{11.549} = 2.537\ \text{V} \\ n = 3: &\quad \frac{4 \cdot 10\ \text{V}}{3\pi} \cdot \sin\frac{3\pi}{2} \cdot \frac{\sinh(3\pi/2)}{\sinh 3\pi} = 4.244\ \text{V} \cdot (-1) \cdot \frac{55.65}{6195.8} = -0.038\ \text{V} \\ V &\approx 2.537 - 0.038 = 2.499\ \text{V} \end{aligned}

Check: the symmetry argument gives exactly 2.5 V2.5\ \text{V}; two terms are within 0.04 %0.04\ \%. A point closer to the lid needs many more terms.

In Python: partial sums and the field map

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

def trough(x, y, a=1.0, b=1.0, V0=10.0, nmax=199):
    n = np.arange(1, nmax + 1, 2)[:, None, None]                 # odd harmonics
    x, y = np.broadcast_arrays(np.asarray(x, float), np.asarray(y, float))
    # sinh ratio written with exponentials so large n does not overflow
    ratio = (np.exp(n*np.pi*(y - b)/a) - np.exp(-n*np.pi*(y + b)/a)) / (1 - np.exp(-2*n*np.pi*b/a))
    return np.sum(4*V0/(n*np.pi) * np.sin(n*np.pi*x/a) * ratio, axis=0)

print("terms   V(0.5,0.5)   V(0.5,0.75)   V(0.5,0.95)")
for terms in [1, 2, 3, 10, 100]:
    nmax = 2 * terms - 1
    vals = [trough(0.5, y, nmax=nmax).item() for y in (0.5, 0.75, 0.95)]
    print(f"{terms:5d}   {vals[0]:10.4f}   {vals[1]:11.4f}   {vals[2]:11.4f}")

xs = np.linspace(0, 1, 81); ys = np.linspace(0, 1, 81)
X, Y = np.meshgrid(xs, ys)
V = trough(X, Y)
Ey, Ex = np.gradient(-V, ys, xs)
fig, ax = plt.subplots(figsize=(5, 4.6))
cs = ax.contour(X, Y, V, levels=[0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], colors="tab:blue")
ax.clabel(cs, fmt="%.0f V", fontsize=8)
ax.streamplot(X, Y, Ex, Ey, color="tab:orange", density=0.8, linewidth=0.8)
ax.set_aspect("equal"); ax.set_xlabel("x / a"); ax.set_ylabel("y / a")
ax.set_title("Square trough, lid at 10 V: equipotentials and E")
plt.show()
terms   V(0.5,0.5)   V(0.5,0.75)   V(0.5,0.95)
    1       2.5372        5.7638       10.8740
    2       2.4990        5.3615        8.2247
    3       2.5000        5.4117        9.3858
   10       2.5000        5.4053        8.9831
  100       2.5000        5.4053        8.9966

At the centre three terms are already exact to four digits; at y=0.95ay = 0.95a the partial sums swing by tens of percent over the first three terms and are still 0.15 %0.15\ \% off after ten. The equipotentials crowd into the top corners, where the field lines (orange) leave the lid's edges almost horizontally into the grounded walls.

Other coordinate systems

The same three steps work wherever the boundaries are coordinate surfaces; only the functions change. In cylindrical coordinates with no zz dependence, separation gives ρ±n\rho^{\pm n} and cos⁡nϕ\cos n\phi, sin⁡nϕ\sin n\phi. A grounded conducting cylinder of radius aa placed across a uniform field E0 x^E_0\,\hat{\mathbf{x}} needs only n=1n = 1:

V=−E0(ρ−a2ρ)cos⁡ϕ,Eρ(a)=2E0cos⁡ϕ,ρs=2ε0E0cos⁡ϕV = -E_0\left(\rho - \frac{a^2}{\rho}\right)\cos\phi, \qquad E_\rho(a) = 2E_0\cos\phi, \qquad \rho_s = 2\varepsilon_0E_0\cos\phi

The surface field is twice the applied field at the front and back of the cylinder: the field-enhancement factor of a round conductor. A sphere in a uniform field gives a factor of 3 (separation in spherical coordinates, with Legendre polynomials). Such factors are why high-voltage conductors in a strong field are sized for their surface field rather than the average one.

Guided lab: conductive paper

Hand calculation. A 20×20 cm20 \times 20\ \text{cm} square of conductive (resistive) paper with silver-paint or copper-tape electrodes along its edges is a 2-D analogue of the trough: the steady current obeys the same Laplace equation (Resistance of Conductors of Any Shape). Lid at 10 V10\ \text{V}, three edges at 0 V0\ \text{V}, small gaps at the corners: the centre should read 2.50 V2.50\ \text{V} and the point a quarter of the side below the lid 5.41 V5.41\ \text{V}.

Simulation. The series above, or the finite-difference solver of the next lessons.

What you would measure. Power the electrodes from a bench supply at 10 V10\ \text{V} with the current limit at 50 mA50\ \text{mA} and probe with a multimeter (COM on the grounded edge). Expect the centre within about ±2 %\pm 2\ \% of 2.5 V2.5\ \text{V}; the paper's non-uniform sheet resistance and imperfect electrode contacts are the main errors. Mapping the 1,2,…,9 V1, 2, \dots, 9\ \text{V} equipotentials with the probe reproduces the contour plot.

Hazards and safe setup. Low voltage and current-limited. Silver paint is solvent-based: ventilate and let it dry before powering.

Pitfalls

  • Wrong choice of functions. The oscillating functions (sin⁡\sin) go along the direction with two zero walls; the growing/decaying ones (sinh⁡\sinh, e±e^{\pm}) across.
  • Even harmonics. For a constant lid they are exactly zero; including them with nonzero coefficients means an integration error.
  • Trusting the series near a discontinuity. At the lid corners, convergence is slow and oscillatory; quote values there with caution.
  • Overflow. sinh⁡(nπ)\sinh(n\pi) overflows for large nn; use the ratio written with decaying exponentials, as in the code.

Practice

  1. For a trough with b=2ab = 2a and lid at V0V_0, estimate VV at (a/2,a)(a/2, a) with one term.
  2. Why must every term of the series vanish at x=0x = 0 and x=ax = a?
  3. A grounded cylinder sits in a uniform field of 1 kV/m1\ \text{kV/m}. Find the largest surface field and charge density.
Answer
  1. V≈4V0πsinh⁡πsinh⁡2π=1.273V0⋅11.549267.74=0.0549V0V \approx \frac{4V_0}{\pi}\frac{\sinh\pi}{\sinh 2\pi} = 1.273V_0 \cdot \frac{11.549}{267.74} = 0.0549V_0.
  2. Those walls are at 0 V0\ \text{V} for all yy; a sum vanishes there for every yy only if each sin⁡(nπx/a)\sin(n\pi x/a) does.
  3. Emax=2E0=2 kV/mE_\text{max} = 2E_0 = 2\ \text{kV/m} at ϕ=0\phi = 0 and 180∘180^\circ; ρs=2ε0E0=17.7 nC/m2\rho_s = 2\varepsilon_0E_0 = 17.7\ \text{nC/m}^2.

Test yourself

In the trough with grounded walls at x=0x = 0 and x=ax = a, the allowed separation constants are…

  1. any real kk
  2. k=nπ/ak = n\pi/a
  3. k=nπ/bk = n\pi/b
  4. k=2nπ/ak = 2n\pi/a

For a square trough with the lid at V0V_0 and three grounded walls, the potential at the centre is…

  1. V0/2V_0/2
  2. V0/3V_0/3
  3. V0/4V_0/4
  4. V0/πV_0/\pi

Why does the series converge slowly near the lid's corners?

  1. the sinh terms grow
  2. the boundary data jump there (Gibbs behaviour)
  3. Laplace's equation fails at corners
  4. even harmonics are missing

A grounded conducting cylinder across a uniform field E0E_0 has a maximum surface field of…

  1. E0E_0
  2. 2E02E_0
  3. 3E03E_0
  4. E0/2E_0/2