This is really a note for Future Rhett. You’re welcome, Future Rhett. If anyone else wants to read this, please have fun.
OK, here is the problem. How do you describe the electric field around some region? Maybe that region is a dipole, or parallel plates, or some other random charge distribution?
Here are some options:
Equipotential lines. I assume you know what these are.
Electric field lines.
Electric field vector plot.
Let’s talk about these three. I don’t think I’m going to make example plots because I’m not sure what I want to do. Yes, I will probably do something in the near future.
Electric Field Vector Plot
Imagine you have a dipole (a positive and negative charge separated by some distance). The electric field vector can be calculated at any position (x,y,z). So for every location, there’s a vector.
But how do you display this visually? Well, you could just pick some points and plot the electric field as an arrow. Actually, I’ve done this before so I have a picture.
Another option is to just plot the E field every cm (or some other set distance). Of course, this too has problems:
What about 3D?
What if the electric field gets too big and you have giant arrows?
What if the arrows are too small?
Can you do this on paper?
Still, I think this is probably the best option. Historically, no one ever did it this way because you pretty much need a computer to draw all those tiny arrows.
I want to draw a picture here. OK, this is just a rough sketch.
Each of these lines represents a series of points at the same electric potential (with respect to infinity). They are fairly easy to draw and they give a good representation of the field—even though they aren’t the field. It’s just like getting the idea of a the shape of a mountain by looking at a topographical map. It’s the same thing.
How would you create these with a computer? That’s really what I want—that will make it useful for some strange charge distribution that you would have to calculate the field using a numerical calculation. Here’s what I would do:
Decide on the voltage line values. Do I want to do every volt or every 0.1 volts?
Pick a point. I don’t know where you would start—maybe near one of the charges?
Calculate the electric potential. I assume it’s not an even value of the potential lines. If you get 5.5 volts, you want to move down to 5 volts.
Now move in some direction. Check the voltage again. Did it go down? Keep moving that way. If it goes up, go the other way. If it didn’t change, turn 90 degrees.
Once you get to 5 volts, plot a point.
Move again, but find another point that is at 5 volts. Plot it.
Keep doing this until you get some set distance away from the starting point or you get back to the starting point.
This seems unnecessarily complicated. There’s got to be a better way. Figure it out Future Rhett.
Oh! What about this method?
Calculate the electric field every dx, dy point (so like on a cm grid). If the potential is a whole number 5, 4, 3, 2, 1 volts – plot a point.
I like this method better. More brute force.
Electric Field Lines
I feel like electric field lines are dumb. Oh sure, they give a good sketch of the electric field, but what do they mean? From my intro physics course (many years ago), I remember the following:
Field lines are always perpendicular to equipotential lines.
When field lines are closer together, the value of the electric field is greater.
The electric field vector is tangent to the electric field lines.
That’s about it. But how do you create these with a computer?
Here’s what I want to try:
Start at some point near a charge.
Calculate the value of the electric field vector.
Move in the direction of the electric field vector (some distance dr)
Again calculate E and make another move.
Keep doing this until either the electric field gets too big (in case you get near another charge) or the distance from the starting point gets over some distance.
I think this would work. I want to try it. That’s for you, Future Rhett.
I’m way behind on this one. My plan was to write up something when this question came up in the summer section of algebra-based physics. It was a great question and deserved a full answer. Also, I wanted to make this a tutorial on trinket.io—but maybe I will do that after I write about it here.
So, here’s how it goes. We start off the semester calculating the electric field due to a point charge and then due to multiple point charges (you know—like 2). After that we get into the electric potential difference. Both the potential and the field follow the superposition principle. If you calculate the value due to two charges individually, you can add these together to get the total field or potential.
But there is a big difference. The electric potential difference is a scalar value where as the electric field is a vector. That means that when using the superposition with electric fields, you have to add vectors. Students would prefer to just add scalars—I’m mean, that seems obvious. Does that means that you could just find the electric potential difference for some set of point charges and then use that potential to find the electric field? Yup. You can. And we will.
Let me start with the definition of the electric potential difference. Since it’s really just based on the work done by a conservative force (the electric field), this looks a lot like the definition of work.
Yes, that’s an integral. Yes, I know I said this was for an algebra-based course. But you can’t deny the truth. The “a” and “b” on the limits of integration are the starting and ending points—because remember, it’s really an integral. Also, the “dr” is in the direction of the path from a to b. It doesn’t technically have to be a straight line.
What about an algebra-based course? Really, there are only two options. The most common approach gives the following two equations for electric potential.
The first expression is the electric potential of a point charge with respect to infinity (so the starting point for the integral is an infinite distance away). The second expression is the change in electric potential due to a constant electric field when there is an angle between the field and the displacement.
Oh wait! I forgot to list the value of k. This is the Coulomb constant.
Students can understand the second expression because it’s pretty much the same as the definition of work (for a constant force). The first equation is mostly magic. The one way you can show students where it comes from is to do a numerical calculation of the electric potential difference since they can’t integrate. Did I write about that before? I feel like I did.
Ok, that’s a good start. Now for a problem.
Electric potential due to two point charges
Suppose I have two charges that are both located on the x-axis. Charge 1 is at the origin with a charge of 6 nC. Charge 2 is at x = 0.02 meters with a charge of -2 nC. Here’s a diagram—just for fun.
Let’s start off with the electric potential—as a warm up. What is the value of the electric potential (with respect to infinity) at the location of x = 0.02 meters? Using the equation above for the electric potential due to a point charge, I need to find the potential due to point 1 and then the potential due to point 2—then just add them together (superposition).
First for point 1.
Now for point 2.
This gives a total electric potential:
Finding the Electric Field
Now to find the electric field at that same point. I don’t know how to say this in a nice way, so I will just say it. Since the electric potential is calculated based on an integral of the electric field, the electric field would be an anti-integral. Yes, this means it’s a derivative. But wait! The electric field is a vector and the electric potential is a scalar? How do you get a vector from a scalar? Well, in short—it looks like this.
That upside delta symbol is the del operator. It also looks like this:
Yes, those are partial derivatives. Sorry about that. But you do get a vector in the end. But how can we do this without taking a derivative? The answer is a numerical derivative. Here’s how it works.
Suppose I find the electric potential at three points on the x-axis. The first point is where I want to calculate the electric field. I will call this . The next point is going to be a little bit higher on the x-axis at a location of . The final point will be a little bit lower on the x-axis at . Maybe this diagram will help.
When I take these two end points (not the middle one), I can find the slope. That means the x-component of the electric field will be:
Let’s do this. I’m going to find the x-component of the electric field at that same location (x = 0.02 meters). I don’t want to write it out, so I’m going to do it in python. Here is the link (I wish I could just embed the trinket right into this blog post).
Umm..wow. It worked. Notice that I printed the electric field twice. The first one is from the slope and the second one is by just using the superposition for the electric field. Yes, I knew it SHOULD work—but it actually worked. I’m excited.
Also, just for fun—here is a plot of the electric potential as a function of x. The negative of this slope should give you the x-component of the electric field.
Here you can see something useful. Where on this plot is the electric field (the x-component) equal to zero? Answer: it’s where the slope of this plot is zero (yes, it’s there). Remember, just because the electric field is zero that doesn’t mean the electric potential is zero.
How about this? See if you can find the electric field due to these two charges at a location y = 0.01 and x = 0.0 meters. This is right on the y-axis, but now the electric field clearly has both an x and a y-component. That means you are going to have to do this twice.
I’ll be honest. This connection between the electric potential (change in electric potential) and the electric field can get sort of crazy. But let’s just start with a problem and then solve it in more ways than you wanted.
Here is the problem.
Let’s start with the energy to bring an electron to point B. The energy needed would be equal to the change in electric potential energy which is equal to:
That means I just need to calculate the change in electric potential from infinity to point B. Yes, you could also calculate the work needed to move the charge—I’ll do that also.
Since I am dealing with two point charges, I can use the following expression for the potential due to a point charge (with respect to infinity):
Where k is the Coulomb constant ( and r is the distance from the point charge to the final location. Since there are two point charges, the total potential will just be the sum of the two potentials. Let me call the positive charge “1” and the negative charge “2”. That means the total potential will be:
From the original problem, and . The distance will be 6 mm and the distance will be 4 mm (need to convert these to meters).
Putting this all together, I get the following. I will do my calculations in python. Here is the code.
Running gives the following output.
Boom. There is your first answer. What about point A instead of B? Well, in this case, I just have different distances. The distance for both AND are the same. Since they have the same distances but equal and opposite charges, the two potentials will be opposite. When added together, the total potential is zero volts. Yes, the energy needed to put a point charge at A from infinity is zero Joules.
What? Yes. How about this? Suppose you take the electron from infinity on the positive y-axis. As you move down the axis to point A, the electric field is in the x-direction. That means the electric force is in the negative x-direction. You would have to push it in the positive x-direction and move in the y-direction. But that requires ZERO work since the force and displacement are perpendicular.
Oh. You want to get to A from a point of infinity on the positive x-axis? OK. That still works. Remember that for electric potential, the path doesn’t matter—only the change in position (path independent). I can take whatever path I like. I’m going to move in a circle from positive infinity x to positive infinity y. The electric field is zero out there, so that requires zero work. Now I’m at positive infinity y—and I just did that problem. Zero work.
Another way—by calculating the work
Remember that work-energy principle? It says this:
And the work can be defined as the following (if the force and displacement are constant):
Oh, and the force will be the opposite of the electric force where:
So, as you push a charge towards point B (point A is boring—for now) the electric field changes. That means we have a problem. We can’t use the above formula to calculate the work—unless we cheat. Let’s cheat.
Instead of calculating the total work to move the charge to point B, I’m just going to move it a tiny bit. During this tiny move, the electric field (and thus the force) will be approximately constant. Then I can do another tiny move. Keep repeating this until I get to point B. Here is a diagram.
If this distance is short () then the force is approximately constant. That means the tiny amount of work (which I will call ) would be equal to:
OK, just to be clear. This is the force needed to PUSH the electron (with a charge e)—it’s not the electric force on the electron (which is in the opposite direction). Also, the angle between F and the displacement is zero. That means the cosine term is just one. I wrote the force and displacement as scalars because it’s just the magnitude that matters.
Now we are ready for some stuff. Here are the steps I am going to use.
Start at some position far away (but not actually infinity because that would be crazy). It just needs to be far enough away such that the electric force is negligible.
Calculate the total electric field and the force needed to push the electron at this point.
Move some short distance towards point B.
Over this distance, assume the force is constant and calculate the small work done—add this to the total work.
Repeat until you get to point B.
Before making this one program, I’m going to just make a program to plot the electric field from some value up to point B. Here is the plot from that program. (here is the code)
Note that I started from just 5 cm away from the origin—which is TOTALLY not infinity. However, it makes the graph look nice. But still, this is good because it looks like the calculation is working. Now I can use this same calculation go find the work needed to move the electron. Here is the code.
And the output:
Notice that gives a close, but wrong answer (compared to my previous calculation). Why is it wrong? Is it because I started at y = 0.5 meters (I just realized I’ve been using the variable y instead of x—but it should be fine). Or is it wrong because my step size is too big?
The answer can be found by just changing up some stuff. If you move the starting point to 1 meter, you get about the same answer. However, if you change dy to 0.0001, you get the following output.
That works. Oh, I added some more stuff to the output.
One more thing (and then I will look at the electric field in another post). What if I use a different path to get to point B? Instead of coming along the x-axis (which I previously called “y”), I come parallel to the axis a distance of 2 mm above it. Once I get right over point B, I turn down.
This introduces some “special” problems.
I can break this path into two straight pieces (path 1 is parallel to x-axis and path 2 is parallel to y-axis).
Along path 1, the force needed to push the electron is NOT parallel to the path. So, the angle is not zero in . This means I’m going to have to calculate the actual vector value of the electric field at every step along this path.
The same is true along path 2.
But in the end, I should get the same work required—right?
OK, hold on because this is going to get a little more complicated. Let me just include one sketch and then I will share the code for this new path. Here is how to calculate the electric field and work for a particular step in path 1.
Here’s what needs to happen to calculate the electric field (and force) for each step:
Find the vector from the positive charge to step location.
Use this vector to find a unit vector (to give the electric field a direction).
Use that vector to also find the magnitude of the electric field.
Calculate the electric field due to the positive charge (as a vector).
Repeat this for the negative charge.
Add the two vector values for the electric field to get the total electric field.
Multiply by the charge to get the force (which would be in the opposite direction).
Now, to calculate the work done during each small step, I could use the angle between the force and displacement. But I don’t know that. Instead, I can use the vector definition of work:
Yes, that is the dot product. Fortunately, the dot product is already built into VPython (Glowscript). So, once I get a vector value for the force and the displacement I can just use the “dot()” function.
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.
It’s too late to change now—but I wish I had planned better for my titles for these science notes. I just don’t like the way it looks. Oh well. On to the science.
Jumping out of window with a TV cable
MacGyver yanks a TV cable from the wall and ties it around him. Then boom—he’s out of the second story window to catch a bad guy. As he falls, the cable gets pulled from the wall and sort of prevents him from a full force impact with the ground.
The basic idea is to take a conducting sheet and lay it on top of the area where you want to find a print (finger print or shoe print). When a large electric field is applied, the dust literally gets lifted and stuck to the conducting sheet. Boom. There is your print. Oh, you need about 800 volts to get a high enough electric field (according to one paper that is no longer online for some reason).
For the MacGyver version, he uses some mylar for the sheet. In order to create the large electric field, he can use the charging capacitor for the flash in a disposable camera. That might not get up to 800 volts, but it’s a good start. Yes, it’s also true that you can get fairly high voltages just by rubbing two different materials together—as long as the air is dry. This is exactly what happens when you rub your feet across a carpeted floor and then shock the bejeezus out of someone. Same idea.
One more thing. The official version of the electrostatic dust print lifter is pretty expensive. But someone made one for just 50 dollars using a stun gun. Here is the hackaday.com link, but it looks like the original post has link rotted.
Just to show you some more electrostatic stuff—here are some demos that you could try.
Open an envelope with steam from a radiator
Yup, this works.
Wifi wall detector
OK, it doesn’t detect walls. Instead, the wifi can find empty spaces behind walls. MacGyver takes a wifi router with a partially parabolic dish (using aluminum foil) over the antenna. He then connects the output to a speaker (for a cool effect).
Yes, wifi is essentially a radio wave (it is a radio wave). Radio waves mostly pass through walls—but you have wifi in your house and you know that sometimes you don’t get a great signal. This shows that wifi is at least partially blocked by walls. The wifi can also reflect off stuff.
It is this reflected wifi that MacGyver uses to find the hidden room. When there is nothing on the back side of a wall, you don’t get a good reflected signal and that changes the sound of the connected speaker.
OK, this probably wouldn’t work—but it’s still based on this idea that wifi can interact with walls in different ways. Anyway, MIT has created a tool to use wifi to see through walls. Note, this show came out before that. I’m not saying MIT based that wifi thing on this episodes. I’m just sayin.
Movie film roll for distracting fire
MacGyver takes one of those movie film rolls. Adds some stuff and then lights it on fire. When he rolls it down to the front of the movie theater—boom. Distracting explosion. Yeah, lots of stuff burns. No problem here.