
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

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(2iM PI/5); yq[i] = sin(2iM PI/5);
Charge 5 lies at the origin.
Start by plotting the charges as points and drawing the field lines (take nθ = 16 starting points per positive charge), with steps δs = min(0. 02 , 103 V /|E|), as discussed in class. Use box limits of − 4 < (x, y) < 4, and stop computing field lines that extend more than 4 units from the origin. An equipotential line may be defined by
dX ds
Ey |E|
dY ds
Ex |E|
It will be sufficient to use the same step δs as in the field line computation. However, again as discussed in class, since the equipotential lines are closed loops, you will have to take special care to ensure that the calculation terminates. 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 {(x, ±1), x = − 4 , − 3 , − 2 ,... , 4 }. 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.