Tyrone Curtis
2DPointCharges.nb - Mathematica
notebook (for Mathematica 5.1)
LabelContour.m
- Mathematica package required to label contour plots.
Summary of notebook contents
This is a Mathematica notebook for plotting equipotentials and
electric field lines for a series of point charges in the 2D
plane.
Equipotentials are plotted using the standard Mathematica ContourPlot
command, however extra commands found in the LabelContour
package are used to label contours. Field lines are plotted by
numerically solving the differential equations of the electric
field. Please note that this
notebook has been created using
Mathematica Version 5.1. As such there may be incompatibilities
with earlier versions of Mathematica.
Currently the notebook
creates a random charge distribution, however it is possible to
specify your own charge distribution. Instructions on how this
is done are included in the notebook.
You are able to plot
contour lines of the electric potential using two methods:
-
The first method places contour labels on the contour lines, with no contour shading. An example of this is shown in figure 1.

Figure 1 - Contour plot with labels on contour lines
-
The second method produces the contour plot with shading, along with a legend alongside the plot to indicate the levels of each contour. This is shown in figure 2.

Figure
2 - Contour plot with legend
Both of these methods require commands found in the LabelContour package.
This notebook also plots the electric field lines
for the system - these are able to be plotted with or without a
contour plot. Examples of these are shown in figure 3.
or 
Figure
3 - Field lines with and without contour plot.
Arrows are placed on the field lines indicating the
direction of force on a positive charge. It is possible to
specify the number of field lines starting around each charge.
Positive charges are plotted in blue, negative charges in red and
neutral charges in green.
The contour plots and field
lines for a random charge distribution are shown in figure 4.

Figure
4 - Field lines and contour plot for random charge distribution
