+
Visualizing the offaxis electric field due to a ring of electric charges
Developed by Patrick Kelley  Published January 15, 2020
This exercise set is designed to calculate and pictorially visualize the offaxis electric field that is produced by a ring of charges. The graphical portion of the code plots electric field vectors which display the direction of the field, and the relative magnitude, at various points in space. The novelty of the exercise set lies in being able to calculate the offaxis E field, which is hard to analytically, and then visualize it in 3D.
Subject Area  Electricity & Magnetism 

Level  First Year 
Available Implementation  MATLAB 
Learning Objectives 
Students that complete this exercise will be able to
1. Use computer code to visualize in 3D magnitudes and directions of vector quantities they calculate computationally (Exercises 17)
2. Write the pseudocode for calculating the offaxis electric field due to a charge distribution (Exercise 1).
3. Using the pictures of Efield, develop qualitative reasoning skills, such as using the symmetry of the charge distribution to answer questions (exercise 4)
4. Investigate the effect of a ring consisting of both positive and negative charges, something difficult to do analytically (exercises 57)

Time to Complete  90 min 
These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
## Exercise 1
Write the pseudo code to compute and plot the electric field on a meshgrid.
## Exercise 2
Plot the electric vector field for a positive point charge using a $7\times7\times7$ meshgrid. Do the same for a negative point charge.
## Exercise 3
Plot the onaxis electric field versus distance from center of a uniformly charged ring with a linear charge density of $\lambda = \frac{10}{2\pi R}$, where $R$ is the radius of the ring.
Recall the electric field for a uniformly charged ring is:
$\overrightarrow{E}=k\frac{2\pi R\lambda z}{(R^2+z^2)^{3/2}}\hat{z}$
where $k$ is the Coulomb constant, $R$ is the radius of the ring, and $z$ is the onaxis coordinate.
## Exercise 4
Plot the electric field vectors in 3D for N number of positive point charges (discrete ring of charges). The N charges should be equidistant from each other and lie on a circle. For example, for N=2, the charges would lie on the ends of the diameter of the circle, i.e. 180 degrees from each other. See Theory section on Discrete Ring of Charges for illustration of N=4.
Start with N = **2** and use a $7\times7\times7$ meshgrid.
Do the same for :
* N=**5**
* N=**10**
* N=**100**
for a $7\times7\times7$ grid.
Compare the electric field onaxis results to the analytical expression found in **Excercise 3** and explain your observations. Make sure to change the linear charge density $(\lambda=\frac{N}{2\pi R})$.
***Note***: You will have to look at electric field values, both for discrete charges and the continuous ring, on the meshgrid vertices. That means for more values, you have to increase the meshgrid space. Try a size of $27\times27\times27$ and see how that compares with the smaller meshgrid space of $7\times7\times7$.
##
# Power of Computational Physics: Other Charge Configurations
##
## Excercise 5
Now assign alternating negative charges (indicate with a red color) and positive charges (indicate with blue color) around the ring.
Show electric field vectors in 3D for N number of charges, as follows:
* N=**5**
* N=**10**
* N=**100**
for a $7\times7\times7$ grid.
## Exercise 6
Now assign one half of the ring with negative charges (red) and the other half of the ring with positive charges (blue).
Show electric field vectors in 3D for N number of charges, as follows:
* N=**5**
* N=**10**
* N=**100**
for a $7\times7\times7$ grid.
## Exercise 7
Now assign one fourth of the ring with negative charges (red) and the next fourth of the ring with positive charges (blue), and so on.
Show electric field vectors in 3D for N number of charges, as follows:
* N=**4**
* N=**16**
* N=**100**
for a $7\times7\times7$ grid.
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
Patrick Kelley, "Visualizing the offaxis electric field due to a ring of electric charges," Published in the PICUP Collection, January 2020.
The instructor materials are ©2020 Patrick Kelley.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license