Solving Laplace's equation

Step
Overstep
Reset
Laplace's equation is $\frac{\partial^2f}{\partial x^2}+\frac{\partial^2f}{\partial y^2}=0$. A function $f(x,y)$ is said to be harmonic if it satisfies this equation. Roughly speaking, this means that for every point $(x,y)$, the value $f(x,y)$ is the average of the values of $f$ at the points around $(x,y)$.

In the picture, we know the values of $f$ on the boundary of the disc: these are represented by the dark band. We want to find the values of $f$ inside the disc; these are represented by the mesh. Initially we take these values to be zero so the mesh is flat.

Clicking the Step button replaces the values on the mesh by the average of the values at the neighbouring points. If we do this repeatedly, the mesh will eventually settle down to a shape that is close to the solution of Laplace's equation. However, convergence is slow.

Clicking the Overstep button implements a faster algorithm. Suppose that the value at position $(i,j)$ is $z_{ij}$, and the average of the neighbours is $z'_{ij}$, and put $r_{ij}=z'_{ij}-z_{ij}$. The previous method is equivalent to adding $r_{ij}$ to $z_{ij}$. For the overstep method we add $1.9r_{ij}$ to $z_{ij}$, but only if $i+j$ is even (if the time step is even) or if $i+j$ is odd (if the time step is odd).