Suppose there is a charge distribution that is half a circle with uniform charge. How do you find the electric field due to this half-ring? Here is a picture.
If you wanted to find the electric field at the origin (center of the half-ring), you could do this analytically. If you want to find the electric field somewhere else, you need to do a numerical calculation.
Here is the plan for the numerical calculation.
Break the ring into N pieces (where N can be whatever number makes you happy).
Treat each of these N pieces as though they were point charges.
Calculate the electric field due to each of these pieces and add them all up.
Maybe this updated picture will be useful.
Let’s say the total charge is 5 nC and the ring radius is 0.01 meters. We can find the electric field anywhere, but how about at < 0.03 ,0.04, 0 > meters.
I’m going to break this ring into pieces and let the angle θ determine the location of the piece. That means I will need the change in angular position from one point to the next. The total circle will go from θ = π/2 to 3π/2. The change in angle will be:
I know it’s wrong, but I will just put the first piece right on the y-axis and then space out the rest. Here is what that looks like for N = 7.
But there is a problem. If I make these charge balls, I need to also calculate the electric field due to each ball. I was going to make a list (a python list) to put all these balls in, but I don’t think I need it.
Here is my updated code.
With the output of:
I think this is working, but let me go over some of the deets.
Line 13: you need to know the charge of each piece—this depends on the number of pieces.
Line 12: We need to add up the total electric field from each piece. This means that we need to start with a zero electric field.
Line 15: I named the point charges so I can reference them. But here you can see that with this method, there is only one charge—it just moves.
Line 16: calculate r from a piece to observation location.
Line 17: electric field due to a point charge.
I’m stopping here. You can do the rest as homework.
How do you know this answer is correct? Hint: put the observation location at the origin.
How many pieces do you need to get a valid answer?
Make a plot of E vs. distance along the x-axis. This graph should show E approaching zero magnitude as you get farther away.
What about electric potential with respect to infinity? Oh yeah. That’s a good one.
Display the electric field as an arrow at different locations.
Suppose I have an electrically charged ring. The radius of this ring is R and the total charge is Q. The axis of the ring is on the x-axis. What is the value of the electric field along this x-axis?
You can’t directly find the electric field due to a charge distribution like this. Instead, you have to break the object into a bunch of tiny pieces and use the superposition principle. The super position principle says that the total electric field at some point is the vector sum of the electric field due to individual point charges.
Of course the electric field due to a single point change can be found as:
So, if I break this ring into a bunch of tiny points I can find the electric field due to each of these points and add them up. Yes, the smaller the points the better the answer. In fact, if I take the limit in which the point size goes to zero I will turn this into an integral. Calculus for the win (CFTW).
Let’s take a look at one of these pieces on the ring of charge. Here is a view of the ring from the side.
I can find the little bit of electric field from this little bit of charge at the top of the ring. This electric field would be:
Of course the direction of r and thus the electric field will change directions as you go around this ring and add up tiny electric fields. But WAIT! We can cheat. OK, it’s not cheating–it’s just being smart. What if you also consider the tiny piece of charge at the bottom of the ring? This would also make a tiny electric field at this same location. It would have the same magnitude as the electric from the top piece since it’s the same charge and distance. However, the y-components of these two electric fields would cancel and leave only an x-component of the field.
In fact, for every tiny piece on the ring there is a corresponding piece on the opposite side of the ring. The only surviving components of electric field will be in the x-direction. So that’s all we need to calculate.
Looking at the diagram above, I can find the x-component of this tiny electric field by using the angle θ (which I don’t explicitly know). However, I can still write down this new x-component of the tiny electric field.
Yes, this is no longer a vector. It’s the x-component of the electric field such that it’s just a scalar. But there’s still a problem. I want to add up (thus integrate) all these tiny electric fields due to the tiny charges. However, I have these two variables that I don’t like. There is θ and r. I need to replace those.
For the r, it’s clear that I can use R and x and the pythagorean triangle to get:
I can also replace the θ by again using the right triangle to write:
Updating the tiny x-electric field:
This simplifies to:
Now we need to get a better integration variable—we can’t integrate over dq. Or can we? Yes, we can. Take a look at the equation above. As you move around the circle, which of those variables change? The answer: none of them.
As I integrate over dq, I just get the sum of the dq’s—which would be Q. Boom. That’s it. Here is my final expression for the x-component of the electric field along the x-axis of this ring.
Now for a couple of checks on this result. I will let you make sure these are ok.
Does this expression have the correct units for electric field?
What about the limit that x>>R? Does this expression look like the field due to a point charge?
What is the electric field in the center of the ring?
One last thing to think about. What if you want to find the electric field at some location that is NOT on the x-axis? Then the above derivation wouldn’t work. Too bad.
Let’s do this again. However, this time I am going to create a numerical calculation instead of an analytical calculation. What’s the difference?
The analytical calculation takes the sum of charge pieces in the limit as the size of the pieces goes to zero.
The numerical calculation uses numerical values for a finite number of pieces to calculate the electric field.
That’s really the only difference.
OK, let’s just get into this. I’m going to give you a link to the code and then I will go over every single important part of it. Honestly, you aren’t going to understand this code until you play with it and probably break it.
I like to start with some constants and stuff. Here I am using k for the constant. I also had to pick a value for the total charge and the radius of the ring. Remember, you can’t do a numerical calculation without numbers.
This isn’t really needed for the calculation—but it allows us to make a visualization of the thingy.
“ring” is a built in object in VPython (glowscript).
The important attributes of this object are the position (pos), the axis—which is a vector in the direction of the axis of the ring. Radius and thickness and color should make sense.
For the next part, I need to break this ring into pieces. If I use N pieces, then I can find the location of each of the tiny charges by using an angle to indicate the location. I also need to find the charge on each tiny piece. Here is the important code.
The “dtheta” is the angular shift between one piece and the next. It’s like a clock. It’s a clock that only ticks N times and doesn’t really tell time. But each “tick” is another tiny charge. Maybe that’s a terrible analogy.
But how do we deal with all these tiny charges? What if N is equal to 50? I don’t want to make 50 variables for the 50 charges. I’m too lazy. So instead, I am going to make a list. Lists in python are super awesome.
I won’t go into all the details of lists (maybe I will make tutorial later), instead I will just show the code and explain it. Here’s where I make the tiny charge pieces.
First, I made an empty list called “points”.
Next I went through all the angular positions around the ring. That’s what the while loop does.
Now I create a sphere at that angular position and add it to the points list.
Update theta and repeat.
In the end I have a list of points—the first one at points.
Next part—make the observation location. This is the spot at which I will calculate the electric field.
The “E” is the base electric field, it starts at the zero vector.
Now for the physics.
for p in points:
print("E = ",E," N/C")
Here you can see the full power of a list. Once I make the list of tiny charges, it is very simple to go through the list one tiny charge at a time—using the “for loop”.
Essentially, this loop does the following:
Take a tiny charge piece.
Find the vector from this piece to the observation location
Find the tiny component of the electric field using the equation for a point charge.
Add this tiny electric field to the total electric field and then move on to the next piece.
Boom. That’s it. Print that sucker out. Maybe you should compare this electric field to the analytical solution. Oh wait. There’s a bunch of homework questions. Actually, I was going to do some of these but this post is already longer than I anticipated.
Pick a value of N = 10 and an observation location of x = 0.1 meters. How well does the analytical and numerical calculations agree? What if you change to N = 50? What about N = 100?
Create a graph that shows the magnitude of the electric field as a function of x (along the ring axis). In this graph include the analytical solution and plots for N = 10, 30, 50, 100.
Actually, I wanted to make that last graph. It would be great.
Oh wait! I forgot about the most important thing. What if I want to calculate the electric field at a location that is NOT on the x-axis? Analytically, this is pretty much impossible. But it’s pretty easy with a numerical calculation. Here’s what that would look like.
Oh, if you like videos—here is the video version of this post.