Write a program to calculate and plot the field lines and equipotential curves due a collection of nq = 6 charges q[i], with
q[0] = q[2] = q[4] = 1.e-6;
q[1] = q[3] = q[5] = -1.e-6;
Charges 0 through 4 lie on the vertices of a pentagon, with
coordinates xq and yq given by
xq[i] = cos(2*i*M_PI/5);
yq[i] = sin(2*i*M_PI/5);
Charge 5 lies at the origin.
Start by plotting the charges as points and drawing the field
lines (take
starting points per positive
charge), with steps
,
as discussed in class. Use box limits of
,
and stop computing field lines that extend more than 4 units
from the origin.
An equipotential line may be defined by
Draw the equipotentials (in both directions from the
starting point if the line gets too far from the origin and
doesn't return) through the points
.
Turn in your program (or programs if you choose to perform the two calculations separately), as well as plots of the field lines and equipotentials, with the locations of the charges clearly marked. If possible, draw both sets of curves on a single graph.