Relaxation Method for Electrostatic Problems
We use the relaxation method to approximate solutions of Laplace's equation. Starting with a grid of points with fixed values at the boundaries, the value of the solution at a point is the mean of its four neighbors. (This can be seen with a Taylor series expansion around that point.)[more]
This implementation starts with random and unsorted values in a square plate with a square hole in the center; the mean of the neighbors at each point is calculated repeatedly. Because of symmetry, only an eighth of the plate needs to be calculated; you can see either a quarter or the full plate. With increasing steps the values converge to a smooth surface.
The solution is equivalent for soap bubbles and elastic membranes that minimize the energy yielding a minimal surface. Relaxation is also related to diffusion phenomena.[less]