Electric Field and Potential along z-axis due to Uniformly Charged Ring

PROBLEM:
Consider the following classic problem:  Find the E field along the symmetry axis of a uniformly charged ring. The ring has a radius a and a uniform line charge density λ.  We will denote the distance along the z-axis from the center of the ring to the point P (on the z- axis) by z.

(Suggest you use the angle ϕ in your solution and k for (1/(4 π (Subscript[ϵ, o]))).)
A couple of reminders:

1.   (* This is a comment *)   

and 

2.  If you get some weird results at some point, try going back and re-executing all the previous cells to reset your functions and variables.  As an absolute last resort, close down and reopen M to get a fresh start.

(a) Start by finding the electric potential. Since potentials are scalars, they are easier to calculate that fields, which are vectors. Using the notation in the diagram below, write the differential of electric potential dV[z] (dV as a function of z) at the point P due to a differential of charge dq on the ring. (You can treat dq as a point charge.)

<this is a text cell — type in your response>
							
Let ϕʹ be the angle defined by a position vector pointing from O to a point on the ring.  (dϕ)' and adϕʹ define the differential angle and differential length, respectively,  along the ring as shown.  Then dq = λ a dϕ' and the distance t = ((((z^2) + a))^(1/2)).  

NOTE:  I have put a prime (′) on ϕ because it is a source coordinate (referring to the position of a charge element).  In this problem, ϕʹ is the variable of integration.  This is consistent with most textbooks.

Then the differential of potential, dV, due to the differential charge dq ( = λ a (dϕ)') on the differential length a (dϕ)' is given by:

(Subscript[dV, ring]) = k(dq/t) =  ((k λ a dϕʹ)/( ((((z^2) + (a^2)))^(1/2))))   where t = the distance from the element of charge, dq, to the point P.

We integrate over ϕ' to find (Subscript[dV, ring])[z].  Realize this equation for dV is only valid along the z axis.

(b)  Find V[z] by integrating your expression for dV[z].  You can do this by entering your equation for dV[z] in the cell below and integrating.

A word about the prime (ʹ).  Mathematica usually interprets the prime symbol as a derivative.  We recommend replacing symbols like ϕʹ with ϕprime in M. 

A series of assumptions (more than you need) are provided that make the integration run like a champ.  They start with:  “ $Assumptions = “

To execute each cell, click your mouse anywhere inside the cell and then hit Shift-Return.

ClearAll["Global`*"]
$Assumptions = a> 0 && a ∈ Reals && z ∈ Reals && λ > 0 && λ ∈ Reals && k > 0 && k ∈ Reals&&ϕprime ∈ Reals &&  ϕprime > 0 ;

(*  Write an integral expression for (Subscript[V, ring]) and enter it on the rhs of the equal sign and execute; if it runs, the resulting scalar function defines V[z] for the rest of the problem  *)

Vring[z_] =   (∫_0^(2π)) ((k λ a )/( ((((z^2) + (a^2)))^(1/2))))\[DifferentialD]ϕprime 
(*  Above is the integral of dV =  ((k λ a dϕ)/( ((((z^2)+(a^2)))^(1/2)))) over ϕ'.  
The output below is V[z] *)    
(*Often it's helpful to label output using a print statement as follows: *)
Print["Vring[z] = ", Vring[z]]

Vring[z] gives us the value of the potential as a function of k, a, λ, and the variable z for points along the z-axis.
By symmetry, we can conclude that for all points on the z-axis, Vring is a function of z only.  Likewise, the only nonzero component of the electric field for points that lie on the z-axis is the z-component of the field.

(c) Now find the Electric Field (OverVector[E])ring[z] corresponding to (OverVector[E])ring at the point P on the z axis.


When we seek the E field for these particular points using –Grad[V[z]], we will obtain a Vector of the form {0, 0, Eringz[z]}. 

Convince yourself that the vector (OverVector[E])ring[z] = Eringz[z] (OverHat[z]).    {Eringz[z] is the magnitude (therefore a scalar) of the zth component of (OverVector[E])ring[z].}  For your sake, enter your very complete and concise arguments below.  You may refer to the figures below or draw your own.

this is a text cell — type in your arguments

Symmetry requires that the z-component of (OverVector[E])ring[z] is in the z-direction.  For every patch of charge dq on the ring, there is an equivalent patch dq located diametrically opposite the first.  The x- and y-components of the electric fields of patches on opposite sides of the ring will be equal and opposite, and therefore sum to zero.  Only the z-component remains; therefore (Subscript[E, total]) is in the z direction.

The only other variable that could enter into an equation for Ering is ϕ (ϕ').  BUT if you rotate the ring by any angle Δϕ, the charge distribution does not change.  If the charge distribution does not change, the electric field cannot change, so the field does not depend on ϕ.  Thus, the magnitude of the z-component of (Subscript[E, total]), Eringz[z], depends only on z.   This is a symmetry argument; a very simple one.

(d) Now use Mathematica to find (OverVector[E])ring[z]from V[z].

this is a text cell so you can introduce your M code

We use the Mathematica function Grad which takes the gradient of Vring[z].  In Cartesian coordinates:

(*  you can use this input cell *)
Ering[z_]= -Grad[Vring[z],{x,y,z}]    (* I've dropped the arrow above the E; Ering[z] is a 3D vector*)
(*  This yields a 3D vector (like (OverVector[V]) = {Vx, Vy, Vz} ) -- note that the z component is the only non-zero component  *)

Note that Grad[V[z]] is a 3D vector, here in Cartesian Coordinates.  The third component is the z-component; it is the only non-zero component.

(e) Either by hand or using M , enter/define (Subscript[Ez, ring])[z]  (the z component of  (Subscript[(OverVector[E]), ring])[z] ) in this cell:

We use M to find (Subscript[Ez, ring])[z] by just taking the 3rd element of the vector (OverVector[E])[z]:

(*  you can use this input cell *)
Eringz[z_] =   Ering[z]  [[3]]            (* selects out the third component of (Subscript[(OverVector[E]), ring])[z] which is the scalar function below  *)

(Subscript[Ez, ring])[z] is also simply = - ((d Vring[z])/dz);  in M this would be:

-D[Vring[z],z]  (* gives the same as above *)
-(∂_z)Vring[z]      (*  this is another way of writing it in M; as a single variable derivative *)

(f) In preparation for plotting, give the parameters k, λ, and a numerical values.  As below, I suggest you set all of them = 1.  Note that  λ  > 0; a positive charge distribution.

Plot Vring[z] vs. z (from some negative value of z to some plus value of z. What do the ± values of z represent and how does that influence your plot of V[z]?

(* you want to use Plot in this input cell*)
k = 1; λ = 1;a= 1; 
Plot[Vring[z],{z,-20,20}, PlotRange-> {0,7},PlotLabel->Style[Framed["Vring[z] = \!\(\*FractionBox[\(2\\ a\\ k\\ π\\ λ\), SqrtBox[\(\*SuperscriptBox[\(a\), \(2\)] + \*SuperscriptBox[\(z\), \(2\)]\)]]\)"],16,Purple,Bold,Background->Lighter[Green]],AxesLabel->{"z", "Vring[z]"}] 
(* I threw in some bells and whistles;  This first part would have worked:  Plot[V[z],{z,-20,20}, PlotRange-> {0,7}] *)

(g) Comment on the behavior of V[z] as you move away from the ring in both directions.

this is a text cell — type in your analysis of the z-dependence

The ± z simply represent the two sides of the ring. For a positive charge density, Vring[z] becomes more positive as you approach the ring from either “side”.  Also, we note that as |z| increases, V[z] falls.  

More importantly, look at the slopes of V[z] on both sides of the ring.  The negative of these slopes determines the E-field.  For λ > 0, we see that E points away from the origin on both sides.  

Note that for z >> R, the ring starts looking like a point charge with Q = 2 π R λ.

(g) continued.  Compare Vring[z] and the potential of a point charge for the same total charge:  ((k Q)/(Abs[z])).   Plot them both on the same axes.  (We insert the Abs because for +Q, V of a point charge is positive for both +z and –z;  Abs[z] takes care of this.)

(* Use this input cell for your Plot code*) 

Q = 2 π a λ;
Plot[{Vring[z], ((k Q)/(Abs[z]))}, {z,-20,20},PlotRange-> {0,10}]

this is a text cell for your conclusion

As expected, the two potentials (for the ring and the point charge) are indistinguishable at sufficiently large |z|.

(h) Now plot the magnitude of  (OverVector[E])ring[z]  = Eringz[z]:

(*  Again, you want to use Plot  *)
Plot[Eringz[z], {z,-10,10},PlotLabel->Style[Framed["The magnitude of (Subscript[(OverVector[E]), ring]):  Eringz[z] =\!\(\*FractionBox[\(2\\ π\\ z\), SuperscriptBox[\((1 + \*SuperscriptBox[\(z\), \(2\)])\), \(3/2\)]]\)"],16, Bold,Red,Background->Lighter[Yellow]],AxesLabel->{"z","Eringz"}]

(i) Write down a brief interpretation/discussion of the two plots (e.g., SIGNS and the sign of λ).  How are these two plots are related (hint:  SLOPE of one of them)??

this is a text cell — type in your interpretation

Interpretation:  First, comparing this curve with the above Vring[z],

We see that for z < 0, the slope of V is negative, consistent with the negative values of Eringz observed for z < 0.  This is consistent with the direction of the force on a positive test charge q on the two sides of the ring—q would be repelled from the ring for all z ≠ 0. Finally, note that the the slope of V is zero at z = 0 (at the center of the ring).  This implies that (OverVector[E])ring[z] = - Grad[V] should also be zero, as seen in the plot of Eringz[z].

Somewhat repetitive:   By looking at Vring[z], we see that where the slope of Vring[z] is positive, Eringz[z] is also positive. Similarly, where the slope of Vring[z] is negative, Eringz[z] is also negative. The direction of (OverVector[E])ring[z] must change as you pass through z = 0 because (for a positive λ), (OverVector[E])ring[z] must point AWAY from the origin.

We also see that the potential reaches a maximum value at z = 0 (at the center of the ring). Here the gradient of the potential (which is simply -D[Vring[z], z] (OverHat[z ]) = – ((d Vring[z])/dz)(OverHat[z ]) ) is zero. Therefore Eringz[z] must also be zero at z = 0, as seen in the plot.  The symmetry of the ring also requires this, since the E-Field due to each differential charge on the ring must lie in the x-y plane (no z component). Further, the field due to any charge element on one side of the ring is canceled by an equal charge element on the opposite side of the ring. Therefore (Subscript[(OverVector[E]), ring])[at z = 0] = {0, 0, 0} (a vector!).

(j) No Brainer - Click inside the cell below (or select it by clicking on the bracket to the right) and execute it (Shift-Return);  Answer Boxes will appear; Click on the one you think is correct answer for this question:

Statement (Agree or Disagree):  Off this symmetry axis (that is, off the z-axis), I expect (Subscript[V, ring]) and (Subscript[E, ring]) to depend on z only.  [Live it up! Click both.]

Button["1  I agree.  Off the symmetry axis, (Subscript[V, ring]) and (Subscript[E, ring]) depend on z only",{Print["  Wrong --The symmetry of the problem is broken: in Cartesian Coordinates, we therefore expect x and/or y dependence to creep in. "]}]
Button["2 I disagree; Off the symmetry axis, (Subscript[V, ring]) and (Subscript[E, ring]) generally do not depend on z only ",{Print["  Correct -- The symmetry of the problem is broken; in Cartesian Coordinates, we therefore expect x and/or y dependence to creep in.\n\nIn Spherical Coordinates one would expect θ dependence in V and E, but no ϕ dependence."]}]