Divergence and Laplace's Equation
Field plots may be pretty to look at, but in some ways they are misleading. The field lines for the -Q, 2Q, -Q charge array were all started at the positive charge, and although many went offscale, all returned to end on the negative charge. This general property of inverse square law fields is known as Gauss' Law, and requires field lines not to 'diverge' from points where there is no charge. The requirement can be expressed mathematically in terms of the divergence of the field or Laplacian of the potential:
On the other hand, field lines for an equilateral array of equal like charges (or masses) converge at the origin in spite of the fact that there is no charge there. We can investigate this behavior by calculating the second derivatives of the potential at the origin. We can cancel any common factors and write the potential:
At the origin the second derivatives with respect to x and y both evaluate to 3/2, so field lines enter equally from both x and y directions. The second derivative with respect to z evaluates to -3, so as many field lines exit along the z axis as enter in the x-y plane, and Gauss' law is satisfied.
Even the field plot for an isolated point charge is a bit misleading. As field lines radiate out equally in all directions, it is the number per unit area that gives the strength of the field, not the number per unit circumference in a two-dimensional plot. The color plot of potential gives a better indication of field strength (provided the scaling is linear). Each color band spans the same change in potential, so the field in a band is inversely proportional to its width.
The interpretation of field plots is unambiguous in two-dimensional systems. Point charges and spherical charge distributions are inherently three dimensional, but metallic conductors can be arranged in such a way that charge on their surfaces sets up a field with no appreciable z-component in a specified region. For the equilateral array, we can bound the plotting region by a long open-ended copper box, and replace the point charges by long copper rods. To establish a two-dimensional field, we ground the box and charge the rods to 100 volts. We do not know how charge is distributed on the copper, but we know the potential on the boundary of our plotting region, and this is all we need to know to make a potential color plot with Laplace's equation. We set up a square grid in the x-y plane (our usual pixel grid), and use Laplace's equation to relate potential values at neighboring points:
To start the calculation off, we set the potential in the plotting region to an intermediate value (50 volts), then repeatedly scan the region replacing the potential at a point with the average of the values at the four adjacent points. A 'relaxation method' of this type is very time consuming, and works best if it starts with a coarse grid and iterates until the pattern becomes stable before reducing the step size. There are 128 iterations on a 4-pixel grid, followed by 16 on a 2-pixel grid, and six on a 1-pixel grid. (The width and height of the plotting area are half what was used previously.)
The relaxation method is useful for more than just plotting potential. Consider the problem of calculating the capacitance per unit length of concentric square conducting prisms of sides L and 2L. (The corresponding problem for cylinders is one of the simplest applications of Gauss's law.) The prism capacitor is an old problem that was treated by both analytic and relaxation methods in the pre-computer era. The grid used in the relaxation calculation had to be fairly coarse, and attempts were made to increase accuracy by fitting the functional dependence of the potential to more than just the closest points on the grid. Results obtained by analytic and relaxation methods typically differed by 2%. It is not difficult to estimate what the answer should be. One would expect the capacitance for prisms to be between 1 and 4/p (the perimeter ratio) times the value for cylinders with diameters L and 2L. The mid-point of this range turns out to be within 1% of the actual value.
The prism capacitor is started out with a linear potential gradient, and the full resolution is used from the outset. Over 5000 passes are used, and the potential is plotted after the first 20 passes and whenever the number of passes doubles thereafter. Symmetry is used to restrict the calculation to 1/8th of the plotting region. The capacitance is calculated using a Gaussian surface midway between the prisms, and the result is expressed as a multiple of the value for cylinders.