Two parallel line charges with ± Charge.

PROBLEM:  

Consider two infinitely long line charges parallel to each other and the z axis, passing through the x-y plane at Points {–a,0,0} and {+a,0,0} (e.g., separated by a distance 2a), where the line passing through {–a,0,0} has a linear charge density of –λ and the line passing through {+a,0,0} has a linear charge density of +λ.  The geometry is illustrated in the figure below.  The line charges themselves extend into and out of the plane of the figure.

(a) Find the potential at an arbitrary position in the x - y plane, that is, at the Point P {x, y, 0}, using the Superposition Principle and your previous work on the potential due to an infinitely long, linear charge distribution.  
  
  [Choose an expression with the zero of potential at the origin of the coordinate system, {0, 0, 0}. ]

<Input text here>  

We need only find the potential at P;  all the rest we can to with Mathematica. 

Before looking at equations, consider what we can conclude about the geometry of the problem.  Moving an infinite wire in a direction parallel to its length (along the z axis) does not change the distribution of charge. The same can be said for two wires parallel to the z axis.  Since the charge distribution does not depend on z, neither does the resulting electric potential.  That is, the resulting electric potential does not depend on z.  (Symmetry also shows that the z component of the electric field must be zero.  Start the argument by rotating the charge distribution 180° about the x or y axis. This operation does not change the distribution of charge.)

The Superposition Principle requires that the potential due to two known charge distributions be simply the sum of the potentials produced by each charge distribution.  (You must take care to use the same coordinate system in taking the sum.  It is not fair to use one coordinate system for one charge distribution and another coordinate system for the other charge distribution.  

Recall that the electrical potential at a distance s from an infinitely long line of charge, having charge density (+)λ is just:  
  
                 (Subscript[V, one wire])[s] = 2 k λ Log[((Subscript[s, o])/s)].         (k = (1/(4 π ϵo)))

The factor of  (Subscript[s, o]) in the argument of the logarithm ensures that the potential is zero when s = (Subscript[s, o]).  ALSO:  if we do not introduce such a reference “point” (a point where we fix V — here V[(Subscript[s, o])] = 0 which means a cylinder oriented symmetrically about the line charge with radius (Subscript[s, o])), we run into V going to infinity, e.g., as s -> ∞.

Quick interlude — when s = (Subscript[s, o]), (Subscript[V, one wire])[(Subscript[s, o])] = 2 k λ Log[1]; evaluating Log[1]:

Log[1]  (*  execute  *)

As Desired.

The distance s in (Subscript[V, one wire])[s] is the distance from the wire [from any source point {x’, y’, z’} on the wire which corresponds to a vector (OverVector[r'])] to the Point P [the field point, {x, y, z} which corresponds to the vector (OverVector[r])].  (OverVector[r])- (OverVector[r']) is Griffiths separation vector which we identify as the vector (OverVector[ℝ]) =  (OverVector[r])- (OverVector[r']) with scalar magnitude ℝ.

NOTE:  In M, the position vector (OverVector[r]) = {x, y, z} is a List containing the x, y, z coordinates of a point P.  x,y,z are of course the components of (OverVector[r]).  You can either think of it as simply the coordinates of the point P (which we often write as (x, y, z)) or the components of the vector (OverVector[r]) pointing from the origin to P.  In M code, it is often necessary to use the curly brackets.  

Example:  For (OverVector[r]) = {x, y, z}, we can find the length of (OverVector[r]) several ways, including the ones shown here:

ClearAll["`*"]
(OverVector[r])= {x, y, z};    (* Most of the time we leave off the arrow above r and just remember that r is a 3D vector once we define it  *)

(OverVector[r])[[1]]
(OverVector[r])[[2]]  (*  These are the three components of the vector (OverVector[r])  *)
(OverVector[r])[[3]]


L = (Sqrt[((((OverVector[r])[[1]])^2) + (((OverVector[r])[[2]])^2)+ (((OverVector[r])[[3]])^2))])       (* notice I use L for the length of (OverVector[r]) rather than r -- you can see how you can get messed up *)
LL = (Sqrt[(OverVector[r]).(OverVector[r])])
LLL = Norm[(OverVector[r])]   (* This uses the M function Norm --  Look it up *)
(* plug in some numbers just for laughs  *)
x = 20; y = -3; z = 55.;
L
LL
LLL

If you are curious about the M function Norm, a quick fix is to use ?  and clicking on the <<:

?Norm   (*   Execute;  click on << for more info;   Works on any M Function *)

Now the two wire problem:

We have two wires and two distances.  Here, the distance between the negatively charged wire at {(Subscript[x, –]^∣), (Subscript[y, –]^∣), (Subscript[z, –]^∣)} and the fieild point {x, y, z)} is called (Subscript[ℝ, –]), and the distance between the positively charged wire at {(Subscript[x, +]^∣), (Subscript[y, + ]^∣), (Subscript[z, +]^∣)} and the point {x, y, z} is called  (SubPlus[ℝ]).

In Cartesian coordinates, (Subscript[ℝ, –]) and (Subscript[ℝ, –]) can be written as:

(Subscript[ℝ, –])= (Sqrt[(((x - (Subscript[x, –]^∣)))^2) + (((y - (Subscript[y, –]^∣)))^2) + (((z - (Subscript[z, –]^∣)))^2)])  
(SubPlus[ℝ])=  (Sqrt[(((x - (Subscript[x, +]^∣)))^2) + (((y -(Subscript[y, +]^∣)))^2) + (((z - (Subscript[z, +]^∣)))^2)])

Since we know the field does not depend on z or z', we can simplify our equations by assigning them simple values, e.g.,  z = z' = 0.  That is, we can restrict our attention to the x-y plane, as in the figure above.  The negatively charged wire is normal to the x,y plane at the point (–a,0,0) and the positively charged wire at point (a,0,0).  The simplified values of (Subscript[ℝ, –]) and (Subscript[ℝ, –]) become

(Subscript[ℝ, –])= (Sqrt[(((a+x))^2) + (y^2) ])  
(SubPlus[ℝ])= (Sqrt[(((a - x))^2) + (y^2) ])

The Superposition Principle requires that the potential due to the two wires equals the sum of the potentials of each wire alone.  We have two potentials, one with s = (Subscript[ℝ, –]) and one with s =  (SubPlus[ℝ]).

(Subscript[V, –])[s] = 2 k (-λ) Log[((Subscript[s, o])/s)] = 2 k (-λ) Log[((Subscript[s, o])/(Sqrt[(a+x)^2 + y^2 ]))].
(SubPlus[V])[s] = 2 k (+λ) Log[((Subscript[s, o])/s)] = 2 k (-λ) Log[((Subscript[s, o+])/(Sqrt[(a-x)^2 + y^2 ]))].

The sum of these two potentials can be rewritten (Know Thee Thy Log Expressions) as:

(Subscript[V, Total])[x,y]=2 k λ Log[((Subscript[s, o])/s)] = 2 k λ Log[((Subscript[s, o+])/(Sqrt[(a-x)^2 + y^2 ]))] - 2 k λ  Log[((Subscript[s, o–])/(Sqrt[(a+x)^2 + y^2 ]))]
            = 2 k λ Log[(((Subscript[s, o+])(Sqrt[(a+x)^2 + y^2 ]))/((Subscript[s, o–])(Sqrt[(a-x)^2 + y^2 ])))]  = k λ Log[(((a+x)^2 + y^2)/((a-x)^2 + y^2))]+2 k λ Log[((Subscript[s, o+])/(Subscript[s, o–]))]
(Sneaky move - we took the square roots out of ↑ the Log argument of this term 

which is like multiplying the Log by 1/2; thus the factor of 2 disappears!)


We still need to choose the constants (Subscript[s, o–]) and (Subscript[s, o+]) so that (Subscript[V, Total])[x,y] = 0 at the origin, where x = y = 0. Since Log[a/a] = Log[1] = 0, we need to only to choose (Subscript[s, o–]) = (Subscript[s, o+]).  Then 

(Subscript[V, Total])[x,y] = = k λ Log[(((a+x)^2 + y^2)/((a-x)^2 + y^2))]

We now have (Subscript[V, total ])[x,y] so we can do the plots using M.

(b)  Use M to produce a 3D plot and a contour plot of the potential due to the two wires.

You will have to assume values for k, a, and |λ|.  (I set k = a = |λ| = 1.)  

You may find it convenient to define a constant (e.g., MM) for the plot range; for instance, {x, MM, MM} and {y, MM, MM}.  This makes it easy to experiment with the plot range.  The contour plot will be useful later, so be sure to give it a name.  For instance, the command  

contour = ContourPlot[V[x,y],{x, -MM, MM}, {y, -MM, MM}, ColorFunction->"Rainbow"]

This will both draw the ContourPlot and give it the name "contour."

Clear["Global`*"];
V[x_,y_] := k λ Log[(((((x+a))^2) + (y^2))/((((x-a))^2) + (y^2)))];
k = 1; λ = 1; a = 1; MM =2;
Plot3D[V[x,y], {x, -MM, MM}, {y, -MM, MM},PlotRange->{-10,10},MaxRecursion->5, AxesLabel->{"x", "y", "V[x,y]"}]
contour = ContourPlot[V[x,y],{x, -MM, MM}, {y, -MM, MM}, ColorFunction->"Rainbow",Contours-> 26,PlotRange->{-10,10},FrameLabel->{"x", "y"}]

(c)  Interpret your results in a text cell.

<Interpret*your*results*in*this*cell>

First: Remember that we have set z = 0.  This represents V in the (x,y) plane and is the same for all z (no z dependence).  In the Plot3D chart, we are looking at V (in the "z" direction) vs. (x,y).  

The 3D plot of V shows an off-scale, spike-like peak (positive potential) at position {x,y} = {0,1}, and an off-scale, spike-like hole (negative potential) at position {x,y} = {0,-1}.  Our experience with (Subscript[V, one wire])[s] leads us to expect that the potential goes to +∞ as you approach a positively charged wire and goes to –∞ as you approach a negatively charged wire.  This would account for the peak and the hole.  The off-scale parts of the peak and the hole appear as white disks in the contour plot.  The peak is surrounded by an reddish disk, indicating a high, positive potential, and the hole is surround by a dark bluish disk, indicating a low, negative potential.  

Both the 3D and the contour plot indicate a zero potential at the origin, (0,0), as expected from symmetry.  

Interestingly, the potential appears to be zero all along the y-z plane (through x = 0).  (On the contour plot, point your mouse at the contour line passing through the origin- it "reads" the value of that contour; i.e., 0).  

Along this plane, the positive potential due to the positively charged line cancels the negative potential due to the negatively charged line.  This tells us that in theory, one could place a grounded metal sheet at this position, keep one of the line charges, say the positive wire at (a,0), and not change the resulting potential on the x > 0 side of the metal sheet.

This behavior can be compared to the potential along a perpendular plane half-way between dipole (point) charges.  

As you move alway from the charged wires, the potential gradually goes to zero (because we were careful to use Reference "Points" -- Cylinders at (Subscript[s, o+]) and (Subscript[s, o-])).    

Remarkably, the equipotentials in the contour plot appear as circles, where the center of each equipotential is offset from the wire position.  As the magnitude of the potential goes down, the offset increases so that the circular equipotentials never touch the zero-potential plane through the center.  Since the surface of a conductor is always an equipotential, this feature suggests that we may be able to express the potential and field around a pair of parallel circular cylinders (conductors) with equations related directly to the equations for a pair of line charges.  

In a later exercise we will take advantage of the above to determine the capacitance of two parallel cylindrical conductors.  It is outrageously convenient to notice that near each wire the circles of equipotential maintain very nearly the same CENTERS, namely (± a, 0).  You will forget this gem of an observation but we'll remind you.

It might also be noted that the potential (vs. (x, y) due to parallel cylinders is important for the design of transmission lines.

(d)  Now use M to compute the electric field due to the pair of parallel +±line charges. Plot the resulting field in a 2D vector plot.  We expect the field to be perpendicular to the equipotentials (countour lines) plotted above.  Is it?  To check this, name your Efield plot when your draw it.  For instance, 

Efield = VectorPlot[EE, {x, -MM, MM}, {y, -MM,MM},VectorPoints->{12,12}]

Then you can superimpose the Efield plot and the contour plot using the Show[] command; for instance.

Show[contour, Efield, PlotRange-> Automatic]

The relationship between the contour plot and the direction of the electric field is more clear if you draw electric field lines rather than the grid of vectors.  (There are issues with field line plotting, but this geometry is pretty safe.) The field lines can be drawn with the StreamPlot command.  For instance, 

Streamlineplot = StreamPlot[EE, {x, -MM, MM}, {y, -MM,MM}]

Clear[a, k , λ ];
EE= -{D[V[x,y],x],D[V[x,y],y]}    (*  You can also use EE = - Grad[V[x,y],{x, y}]; this is the 2D gradient of V in Cartesian Coordinates *)
Simplify[EE]
k = 1; λ = 1; a = 1;
Efield = VectorPlot[EE, {x, -MM, MM}, {y, -MM,MM},VectorPoints->{12,12}]
Show[contour, Efield, PlotRange-> Automatic]
Streamlineplot = StreamPlot[EE, {x, -MM, MM}, {y, -MM,MM}]
Show[contour,Streamlineplot ,  PlotRange-> Automatic,Contours-> 26]

(e)  Interpret your results in a text cell.

<Interpret*your*results*in*this*text*cell>

Again, these plots are in a plane cut through the wires and normal to the wires (recall above:  we set z = 0).  You get the same plot for a plane through any z because there is NO z dependence in V nor E.

The electric field and field streamline plots clearly show the field directed from the positive line charge to the negative line charge, as expected.  The large variation in field strength is difficult to portray the vector field accurately using vector arrows.  Some arrows are huge, while most are quite small.  The StreamPlot is prettier because it doesn't attempt to show the variation in field magnitude.  (If you account for the creation of new field lines as the field strength weakens, the distance between field lines gives some indication of strength.)  

As near as the eye can see, the electric field are perpendicular to the voltage equipotentials in the superimposed StreamPlot and Contour plots.  This includes the V=0 equipotential at x = 0.  

Remarkably, the field streamlines appear (to the eye) to be circles.  The exception is the field  streamline along the y-axis, which is straight.  This field line can be viewed as a circle of infinite radius.