Electric Potentials and Fields


Over-relaxation factor: 1.0



Tools: Draw electrode
Erase electrode
Tool size: Electrode potential: 0 V

Canvas is not supported by this browser.


Resolution: 128 X 128

Number of colors: 512
Color scheme:
(positive, 0, negative)


Show field
Show probe
Probe potential:
Probe field strength:
Degree of convergence:

This program computes and displays the electric potential from a given pattern of “electrodes” (i.e., areas with a constant voltage) in a 2-D world. This world is represented by a grid of square cells, with the boundaries always held fixed at 0 V. Color represents potential as given in the color scheme drop-down box.

Some background info:

Using Gauss' law, a boundary condition of 0 charge density between electrodes, and the relationship between the electric potential (V) and electric field, we can find Laplace's equation for the electric potential. Using approximations for the partial derivatives, we can show that in two dimensions, the electric potential at any given cell is the average of the electric potentials of the four adjacent cells.

With this result, we can use the relaxation method to approximate the electric potential of all the cells on the grid. This program loops over every cell in the grid and calculates the electric potential as the average of the potential of its four neighboring cells. After several times looping over the grid, this approximation converges to the solution for the given pattern of electrodes.

To work the program:

Choose the electrode pattern from a list of presets, or use the draw and erase tools to create your own pattern. Adjust the tool size for drawing and erasing electrodes with the tool size slider, and select the potential of the electrode to be drawn with the electrode potential slider. Clear all the electrodes (except the boundary “electrodes”) at once using the “Clear Electrodes” button.

Compute the electric potential either step-by-step, until convergence, or continuously using the appropriately labeled buttons. The word "calculating" will appear when the program is calculating the potential. Pause, resume, or reset computation in any of these three modes with the “Pause”/“Resume” and “Reset fields” buttons. “Convergence” is here defined as when the largest change in potential for any cell in a given calculation step (the “degree of convergence” in the Data box) rounds to 0.000 V. Use the over-relaxation slider to help speed convergence. Setting the over-relaxation factor too high (usually no less than 2.0) makes the computation unstable.

To see the electric field, check the "Show field" checkbox. To see the field vector and potential for a given cell, turn on the probe using the “Show probe” checkbox and then click/tap and drag the probe to the cell. Potentials are given in volts, and fields are given in V/cell; one cell can be any unit of distance.

Use the resolution slider to change the resolution of the grid. If computation is too slow, try starting at a lower resolution and then increasing the resolution from there. Change the number of colors used in the display with the appropriately named slider. This can be effectively used to see a contour map of the potential by using lower numbers of colors. Change the color scheme used with the color scheme drop-down box.

For the best performance on desktop computers, use Chrome.

By Nathaniel Klemm, Weber State University, using funds from the Beishline Fellowship award