Docsity

Physics Lab: Homework 1 - Field Lines & Equipotential Curves for Charges, Assignments of Physics

Toggle sidebar
bg1
PHYS 306: Computational Physics Lab
Winter 2009
Homework #1
(Due: January 23, 2009)
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 nθ= 16 starting points
per positive charge), with steps δs = min(0.02,103V /|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.

Partial preview of the text

Download Physics Lab: Homework 1 - Field Lines & Equipotential Curves for Charges and more Assignments Physics in PDF only on Docsity!

PHYS 306: Computational Physics Lab

Winter 2009

Homework

(Due: January 23, 2009)

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.