# Numerical Calculation for Work Done Near a Dipole

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:

$\Delta U_E = q\Delta V$

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):

$V = k\frac{q}{r}$

Where k is the Coulomb constant ($k = 9 \times 10^9 \text{ Nm}^2\text{/C}^2$ 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:

$V = V_1 + V_2 = k\frac{q_1}{r_1} +k\frac{q_2}{r_2}$

From the original problem, $q_1 = 2 \times 10^{-9}\text{ C}$ and $q_2 = -2 \times 10^{-9}\text{ C}$. The distance $r_1$ will be 6 mm and the distance $r_2$ 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 $r_1$ AND $r_2$ 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:

$W = \Delta E$

And the work can be defined as the following (if the force and displacement are constant):

$W = F\Delta s \cos \theta$

Oh, and the force will be the opposite of the electric force where:

$\vec{F} = q\vec{E}$

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 ($\Delta \vec{s}$) then the force is approximately constant. That means the tiny amount of work (which I will call $\Delta W$) would be equal to:

$\Delta W = eE\Delta s$

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.

Non-straight Path

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.

Like this.

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 $\cos \theta$. 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:

$W = \vec{F} \cdot \Delta \vec{s}$

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.

OK, let’s do it. Here is the code (warning—vector stuff in the code) and the output.

Wow. I didn’t think that would work the first time. I’m pumped.

OK, the real reason for this post was to look at the connection between the electric field and the change in electric potential. I’ll make that in a follow up post.

# Magnetic Field due to a Long Straight Wire

It seems that most of the second semester algebra-based physics is magic. Since you need calculus to derive many of the expressions, the students just get them magically instead.

NOT TODAY. Well, I hope not. Today I am going to use python and the Biot-Savart Law to find the magnetic field due to a wire. Here is the expression I want to show:

$B = \frac{\mu_0 I}{2 \pi r}$

Where I is the current in a wire and r is the distance from the wire. I guess I should start with the magnetic field due to a moving point charge.

$\vec{B} = \frac{\mu_0}{4 \pi} \frac{ q\vec{v} \times \vec{r}}{r^3}$

Yes, that’s sort of a crazy equation. The weird part is the cross product. Here are some notes:

• The “times” symbol is the cross product.
• The cross product is an operation between two vectors that returns a vector as the resultant (unlike the dot-product that returns a scalar).
• The resultant of this vector is perpendicular to both of the products—that makes this only work in 3D.
• The magnitude of the resultant depends on the magnitude of the products and the sine of the angle between them.

OK, that’s enough of that. Fortunately, we don’t really need to compute cross products since it’s built into VPython (Glowscript). Let me do one more thing before calculating stuff. Suppose I have a charge q moving with a velocity v over some short length of wire, L. I can write qv as:

$q\vec{v}=q\frac{\vec{L}}{\Delta t} = \frac{q}{\Delta t} \vec{L} = I\vec{L}$

So, instead of dealing with qv, I can use IL. Note that L is a vector in the direction of motion for the current. Now my magnetic field looks like this:

$\vec{B} = \frac{\mu_0}{4 \pi} \frac{ Id\vec{L} \times \vec{r}}{r^3}$

I changed from L to dL since it has to be a short wire. So, dL is just a way to emphasize that the wire is super short.

Let’s do this. Here is my first calculation. Let’s say I have a super short wire (0.01 m) with a current of 0.1 Amps. What is the magnetic field a distance of 0.02 meters from the wire? I left off something important—but I will show you that in a second. Here is the code to calculate this magnetic field.

It looks like this (this is just an image—you need to go to the trinket site to actually run this code).

If you run this, you get an output of <-2.5e-7,0,0> T. I think that’s correct. But let’s make this better. Let’s make a visual representation of the magnetic field. Really, that is the power of VPython anyway. Here is the new code and this is what it looks like when you run it.

I rotated the camera angle a little bit so you could see the wire and the magnetic field. OK, now for MORE VECTORS. Here is the sloppy code.

Oh. I like that. It’s pretty. But you can see that the magnetic field makes a circular pattern around the wire. But what about a long wire? Here comes the part where we NEED python. I want to be able to represent a long wire as a series of a bunch of small wires. Then I can calculate the magnetic field due to each of the small wires and then add them up to get the total magnetic field.

In order to simulate a “long wire” I need to have the “observation” location in the center of the series of short wires. Maybe this diagram will help. Here is a side view of 8 small wires together along with the observation location.

Each of these parts of a wire will have a magnetic field at the “obs” location. So, here is how this will work.

• Pick some distance from the wire (r) and create the observation location as a vector.
• Take the wire and break it into pieces. The more pieces, the better the answer.
• For each piece in the wire, calculate the vector r to the observation location.
• Calculate the magnetic field due to this piece and add it to the total.

Let’s do this. Here is the code. Oh, I am going to use the same wire as before but I will make it 1 meter long. Also note—I’m not going to display an image of the magnetic field (or even the wire). I’m going to try to make this as simple as possible.

Using 8 pieces, I get the following output.

Where the theoretical B is the value calculated from the scalar equation up top (magnetic field due to a long wire). So, this is the scalar value (ignore the negative sign). Also, it looks quite a bit off—but there are a couple of points.

• This calculation only uses 8 points.
• There is a slight error. I put the first I*dL at the position x = -L/N. That assumes a super tiny dL—and that’s not true when N = 8.
• The magnetic field due to a long wire equation (above) is for an infinite length wire.

Still, it’s pretty good. What happens as I increase the number of pieces? For that, I’m going to make this whole calculation a function. That way I can run it a bunch of times. Here is a refresher course on functions in python.

Check out this plot.

So, with 50 pieces you get a pretty good agreement with the theory. I like that.

But wait! The theoretical value says the magnitude of the magnetic field decreases as 1/r. Does that work for this model too? Let’s test it. Here is the code.

Surprising that the two calculations don’t quite agree at very close distances. I suspect that is because I have an even number of wire pieces (50) which puts the observation location between two wires segments. Or something like that. But otherwise, this works.

It’s too bad I can’t embed trinket.io right into this blog. I guess I will have to upgrade my wordpress at some point.

# RC Circuit as an Example of the Loop Rule

Batteries and bulbs are fun, but they can only go so far. How about a capacitor and a bulb? Yes, let’s do that.

Here is the setup.

This has a battery (2 1.5 volt batteries) connected to a 1 Farad capacitor with a switch. This capacitor is then in parallel with a light bulb. When the switch is closed, the capacitor is charged up to 3 volts. When the switch is opened, the capacitor discharges through the bulb. Notice how it slowly gets dim.

Here, I even made this same (almost the same) circuit in a PhET simulator (java warning).

Of course the full circuit doesn’t really matter. I don’t care about charging the capacitor, just the discharging. So here’s the important part.

Let’s start off by applying the Loop Rule to this circuit. If I start from the lower left corner and then go around counterclockwise, I get the following. Oh, I’m assuming zero resistance in the wires.

$\Delta V = \frac{Q}{C} - IR=0$

Where the voltage across the capacitor depends on the charge.

$\Delta V_C = \frac{Q}{C}$

But wait! The current is the flow of charge. Since there is a current, the will be a decrease in charge on the capacitor. A decrease in charge means there will be a lower voltage. This lower voltage makes a smaller current. Maybe you can see the problem. Don’t worry, we can still solve this.

Let’s create a numerical calculation to model the current running in this circuit. The key here is to break the problem into very small time steps. Let me start by using the loop rule and using the following definition of electric current.

$I = \frac{\Delta Q}{\Delta t}$

Now the loop rule looks like this.

$\frac{Q}{C} - \left(\frac{\Delta Q}{\Delta t}\right)R = 0$

If I use a very small time step, then I can assume that during this time interval the current is constant (it’s not, but this isn’t a bad approximation). From this I can solve for the change in charge.

$\Delta Q = \frac{Q}{RC} \Delta t$

But what does this change in charge do during this time interval? Yup, it decreases the charge on the capacitor—which in turn decreases the capacitor voltage—which in turn decreases the current. I think I already said that.

After this short time interval, I can find the new charge on the capacitor.

$Q_2 = Q_1 - \Delta Q$

Note: the minus sign is there because the current DECREASES the charge on the capacitor.

That’s it. We are all set. Here is the plan. Break this problem into small time steps. During each step, I will do the following:

• Use the current value of charge and the loop rule to calculate the change in charge during the time interval.
• Use this change in charge to update the charge on the capacitor.
• Repeat until you get bored.

OK. Suppose I am going to do this. I decide to break the problem into a time interval of 0.001 seconds. How many of these intervals would I need to calculate to determine the current in the circuit after 1 second? Yes. That would be 1000 intervals. Who wants to do that many calculations? I sure don’t.

The simplest way to do this many calculations is to train a middle school student how to do each step. It shouldn’t be hard. Oh wait, the middle school student is still busy playing Fortnite. Oh well. Maybe I will train a computer to do it instead. Yes, that’s exactly what I will do.

In this case, I’m going to use python—but you could use really any programming language (or even no computer programming language). The idea of a numerical calculation is to break a problem into small steps. The idea is NOT to use a computer. It just happens that using a computer program makes things easier.

Here is the code (below is just a picture of the code—but you can get it online too).

Let me just make a couple of comments on different lines.

• Line 4,5 just sets up the stuff to make a graph. Graphing in super easy in this version of python (Glowscript).
• Line 14 is the length of the time interval. This is something you could try changing to see what happens. Yes, if you use the trinket.io link above, you can edit the code.
• Line 21 looks tricky. It looks like Q will cancel in that equation. Ah HA! But that’s not an algebraic equation. In python, the “=” sign means “make equal” not “it is equal”. So this takes the old value of Q and then updates it to the new Q.
• Line 25—same thing happens with time. You have to update time or the loop will run FOREVER!
• Line 26. This is how you add a data point to the graph.

This is what you get when you run it.

OK. That looks nice. As we see in real life, the brightness of the light bulb dims rapidly at first and then slowly dies down. This plot seems to agree with actual data (always good for a model to agree with real life).

But what does the textbook say about a circuit like this (called an RC circuit because it has a capacitor and a resistor in it)? Note: this is an algebra-based physics textbook. It gives the following equation for a discharging capacitor.

$I(t) = \frac{V_0}{R} e^{-t/\tau}$ $\tau = RC$

In this case the $V_0$ is the initial voltage on the capacitor. Well, then let’s plot this solution along with my numerical calculation. Here is the code https://trinket.io/glowscript/f4a3ff8264—and I get the following plot.

Those two plots are right on top of each other. Winning. Oh, go ahead and try to change the time step. Even with a much larger step, this still works.

Some final notes. Why? Why do a numerical calculation?

• Numerical calculations are real. They are used in real life. There are plenty of problems that can only be solved numerically.
• I think that if physics students create a numerical calculation, they get a better understanding of the physics concepts.
• What if you want to treat the bulb as a real lightbulb? In that case the resistance is not constant. Instead, as the bulb heats up the resistance increases. With this numerical calculation you should be able to modify the code to account for a real bulb. It would be pretty tough if you solved this analytically.
• What is the point of having students (in an algebra-based course) memorize or even just use the exponential solution for an RC circuit. It might as well just be a magic spell if you just use the equation. I don’t really see the point. However, with the numerical calculation the students can do all the physics.

# What’s Wrong With Algebra-Based E&M?

It’s summer time. For me, that means I’m getting ready for summer classes. Yay! Well, at least I get paid—so that’s good, right? This year, I am teaching the physics for elementary education majors and the second semester of algebra-based physics (electricity and magnetism).

Just to be clear, there are usually two types of introductory physics at the college level. First, there is the calculus-based physics sequence. This course is for physics majors, chemistry majors, math majors…stuff like that. Of course it assumes that the students can use calculus.

The other version is the algebra-based. It does NOT use calculus. The students that take this (at least at my institution) are mostly biology, engineering technology. If you want to consider the course goals, you really need to know who is taking the course.

In order to see the problem with the algebra-based course, let me describe the second semester of the calculus-based course. For this course, I use Matter and Interactions (Chabay and Sherwood, Wiley). It’s a great textbook—here is my review of this textbook from 2014. Here is a short summary of the approach (for the second semester).

• What is the electric field?
• What is the magnetic field?
• How does matter interact with the electric and magnetic fields?
• What is the connection between electric and magnetic fields—Maxwell’s Equations.

For me, it’s all about building up to Maxwell’s Equations. Just to be clear, here are Maxwell’s Equations.

$\oint \vec{E} \cdot \hat{n} dA = \frac{1}{\epsilon_0} \sum q_\text{in}$

$\oint \vec{B} \cdot \hat{n} dA = 0$

$\oint \vec{B} \cdot \vec{dl} = \mu_0 \left[ \sum I_\text{in} + \epsilon_0 \frac{d}{dt} \int \vec{E} \cdot \hat{n} dA \right]$

$\oint \vec{E} \cdot \vec{dl} =- \frac{d}{dt} \int \vec{B} \cdot \hat{n} dA$

Of course there are many different ways to write these equations, however—one thing should be clear. You can’t really grok Maxwell’s Equations without calculus. You need to understand both derivatives, line integrals, and surface integrals.

Now for the algebra-based course. If you don’t have calculus, you can’t really get to Maxwell’s equations. Oh sure, you could do things like Gauss’s Law and Ampere’s law, but it would just be a “how do you use this equation”. Although it’s still true that Maxwell’s equations are sort of magical, without calculus they are just a game.

It’s sort of like teaching long division to 5th graders. Sure, they can learn the process of finding a division value but using the steps—but why? Why use long division when you could just use a calculator? However, if you use long division to understand the number system and division, that’s cool. But it seems that most classes just teach the “how to long divide” without going into the details.

This is exactly where most algebra-based physics textbooks end up. It becomes a giant equation salad. A bunch of equations that have no derivation. Yes, students can be “trained” to use these equations, but I really don’t see the point of that.

I should point out that there isn’t a problem in the first semester of algebra-based physics. A student can use the momentum principle or the work-energy principle without calculus. It’s not a big problem.

OK, so what am I going to do? Honestly, I don’t know. Here are some final thoughts.

• What is the ultimate goal of this course? Why do biology and engineering technology majors take this course? The course goal will shape the course material.
• I have two options for textbooks this semester. They both suck. OK, they don’t actually suck—but they are just a bunch of equations.
• It would be nice to just focus on observable stuff and modeling. Do something like measure current and voltage and produce a linear function relating the two. Oh, how about repeating historical experiments to see where all this stuff comes from?

I’ll keep you updated.

# MacGyver Season 3 Episode 22 Science Notes: Mason + Cable + Choices

Season 3 finale—but don’t worry, MacGyver has been renewed for a 4th season. Boom. Now for some science.

Descender Device

MacGyver needs to get down an elevator cable—to do this, he builds a descender. The basic idea is to “grab” hold of the cable to produce enough friction that it supports a human. That keeps you from falling. Of course you also want to move down, there needs to be some method to “inch” your way down. The one MacGyver builds looks like this.

Here is an early sketch for a type of descender

Of course the problem is that the elevator cable is under tension and very thick. It’s really more like a pole than a rope. That’s why the design in the episode would work better.

These aren’t bad hacks—they are hacks from the Bad MacGyver (Mason). First, there is the cable cutter. This is just a bolt cutter connected to an electric motor. That should work.

The other one is the hydrochloric acid in the basement of a building around support pillars. So, would this work? Well, hydrochloric acid does indeed dissolve concrete and cement—it’s not super fast though. Everyone likes to think of acid as being that kind in the movie Alien. It’s not like that.

Of course a pillar isn’t just cement. It has steel rods in there too. But acid will eat through steel as well—again, it just takes a while. But you don’t have to completely dissolve the pillars to cause destruction. Just making them weak could do the job.

Oh, it’s a good thing the hydrochloric acid is in plastic barrels. It would melt steel barrels.

Atwood Machine

MacGyver’s plan is to connect one elevator to the one next to it. When the cable is cut, the two elevators will create an Atwood machine. This is of course a real physics problem.

The idea is to have two different masses connected by a string. This string then runs over a pulley. If the masses are different, the two masses will accelerate (one up and one down) with a constant acceleration. The key is that this acceleration will be much smaller than the acceleration of a free falling object. That’s a good thing since waaaaay back in the day, it was very difficult to measure the motion of an object with a large acceleration.

I think I will save the physics of an “Atwood Machine Problem” (no one really calls it that) for a later post. Instead, here is my calculation.

But wait! There’s more! This calculation would give you the tension in the cable, but once there is a tension the cable would stretch. How much the cable stretches depends on:

• Tension
• Cable length
• Cable diameter
• Type of material

So you see that the stretch really depends on two things—the material and the size of the cable. For the material dependence on stretch, we call this Young’s Modulus.

There is one more thing—maximum tension before a cable breaks. This also depends on the type of material and the shape of the cable. Here is a sample calculation.

Too bad MacGyver never got a chance to put these calculations into practice. Of course it’s Mason’s fault.

Recover Serial Number

It is possible to recover a serial number that’s scratched off a metal. Essentially, when the number is stamped into the metal there is a more than just a surface effect. The deeper metal is also changed in some way. Using acid, it’s possible show these differences and find this number. Yes, this is real.

For a circuit chip, the serial number is not likely to be stamped—it will be printed. Still, it’s entirely plausible that you could still recover some type of artifact.

# Evolution of a Physics Lab

When I think about the physics labs I teach, I realize things have changed over the past 18 years. The way that I run introductory labs is different than when I first started. Here is a review of my lab philosophy over the years.

I’m going to leave off the labs I taught as a graduate student since I wasn’t really in charge of the lab design.

Phase 1: Mostly Traditional – But With Computers

Really, when you first start off with a tenure track position you have to go with the flow. You can’t jump in and start doing crazy stuff. There are too many other things to focus on (grants, papers, projects…). So, for me—I just took the departmental physics lab manual and started with that. It was pretty traditional.

But I quickly set out on my own. I stopped using the lab manual and made my own labs. Oh, they were still pretty traditional in the format of:

• Here is some physics theory.
• Here are detailed instructions on how to collect data.
• Here are detailed instructions on how to analyze the data.

However, my labs had data acquisition stuff to make it cooler. I found some money to put new (at the time new) iMacs in the room and used Vernier Logger Pro with sensors and stuff. Wait, I actually have a picture of this room from 2003.

Check that out. Those are some classic iMacs. Those suckers were in use for at least 10 years.

There was another important aspect of this “phase 1 lab”. I wanted to have the students work on the following:

• Physics concepts
• Data analysis
• Error analysis (uncertainty)
• Technical writing and communication
• Experimental design.

Note: you can not do this many things. It’s either a 2 or 3 hour lab. At most you could focus on two of these things.

In terms of writing, I think I was making excellent progress on this front. I was working on an idea about peer evaluation of writing. The basic idea is that students evaluate other students writings as a way of helping everyone write better. I still think this is a good idea, but I moved on (because of many issues and other things to work on).

Phase 2: Make Pre Lab Great Again

If you have taught labs, you know that students aren’t always properly prepared. Most faculty know this. They might spend the first 30 minutes of lab time with a lecture to cover the important points. But this still doesn’t work. It’s hard for the students to pay attention and to fully grok the lab. They end up just asking questions about stuff you just told them.

OK—I can fix this. I will just make super awesome lab materials and post it online. Note only that, I will include videos and everything. Students will look at this and then we can just rock and roll during lab.

Nope. That doesn’t work. It doesn’t matter how great the video teaches the concept if students never watch it. In fact, I would find many students watching the video IN LAB. This drives me crazy—mostly because I hate hearing my own voice.

I tried online pre-lab quizzes. That didn’t work. They would just do the bare minimum to get the stuff done before class. It was just a pain in the rear.

Oh, what about pre-lab quizzes in class? Again, those are more trouble than they are worth.

Phase 3: Play and Compete

This one works fairly well. Forget about the pre lab stuff. Drop the lecture at the beginning of lab too. Give the students stuff to play with and see if they can come up with their own questions.

Here is an example in the realm of 1-D collisions.

• Show students the tracks, carts, and different bumper options.
• Tell them “keep the track level”, but otherwise just play with it.
• Students love the magnetic bumpers. Many of them will try collisions between different mass carts.
• After they have played, suggest they try to calculate the kinetic energy and the momentum of the carts.
• Let them come up with their own methods for calculating velocities (I give some options).

That works fairly well. Some students don’t do too much, but for the students that find cool stuff it works great.

Here is another example with a competition. Again, no pre-lab.

• Show students an inertial balance (oscillates back and forth).
• Let them play with it.
• Now for the challenge. Can you use this to find the mass of 4 unknown masses? The quiz at the end of the lab is just finding the mass. Your score is based on your accuracy.

This works fairly well—but not every lab can be in the form of a contest. However, students love to compete and it’s fun.

Phase 4: Free-for-all

This is where I am at now. I don’t expect students to prepare for lab because I will just be disappointed. The labs are a combination of all types of lab. Sometimes they are just verifying an equation. Sometimes they get to build stuff. I don’t expect the lab to match up with the lecture course (because apparently that doesn’t matter).

Sometimes labs still suck, but sometimes they are awesome. I will keep changing my labs until everything is perfect.

Oh, here is a more recent picture of the lab.

This is a video

# Numerical Calculation of an Electric Field of a Half-Ring

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.
• The end.

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:

$d\theta = \frac{\pi}{2N}$

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.

Here is the code.

That works. Oh, and here is the link to the code. Go ahead and try changing some stuff. See what happens if you put N = 20.

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.

Homework

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.

# Elastic Collisions in 1D

I need a nice model to predict the final velocity when two balls collide elastically. Don’t worry why I need this—just trust me.

After working on this for a short bit and making an error, I realized what I need to do. I need to blog about it. A blog is the perfect place to work things out.

So, here is the situation. A ball of mass 10 kg (ball A) is moving with a speed of 0.1 m/s in the positive x-direction. This collides with a 1 kg ball (ball B) moving at 0.1 m/s in the negative x-direction. What is the final velocity of the two balls if the collision is perfectly elastic.

For a perfectly elastic collision, the following two things are true:

• Momentum is conserved. The total momentum before the collision is equal to the total momentum after the collision.
• Kinetic energy is conserved. The total kinetic energy is the same before and after the collision.

In one dimension, I can write this as the following two equations. I’m going to drop the “x” notation since you already know it’s in the x-direction. Also, I am going to use A1 for the velocity of A before the collision and A2 for after. Same for ball B.

$m_Av_{A1}+m_B v_{B1} = m_Av_{A2}+m_B v_{B2}$

$\frac{1}{2}m_A v_{A1}^2+\frac{1}{2}m_B v_{B1}^2 = \frac{1}{2}m_A v_{A2}^2+\frac{1}{2}m_B v_{B2}^2$

That’s two equations and two unknowns (the two final velocities). Before solving this, I want to find the answer with a numerical calculation.

Numerical Solution

Here’s the basic plan (I’m not going over all the deets).

• Model the two masses as points with springs on them (not really going to show the springs).
• When the two masses “overlap” there is a spring force pushing them apart. The strength of this force depends on the amount they overlap.
• Calculate the position and force on each ball (the force would be the zero-vector in cases where they aren’t “touching”).
• Update the momentum of the balls.
• Update the position of the balls.
• Repeat until you get bored.

Oh, make sure you set your fake spring constant high enough. If it’s too low, the two masses can just pass through each other (which would still be an elastic collision).

Here is what it looks like.

Here is the code (you should take a look). Oh, the final velocities are 0.0636 m/s for ball A and 0.2639 m/s for ball B. Also, here is a plot of the momentum so you can see momentum is conserved.

What about the kinetic energy? Here you go.

Actually, notice that KE is NOT conserved. During the collision there is a decrease in the total KE because of the elastic potential energy. I just thought that was cool.

Analytical Solution

Now let’s get to solving this sucker. I’m going to start with a trick—a trick that I’m pretty sure will work (but not positive). Instead of having the two balls moving towards each other at a speed of 0.1 m/s each, I am going to use the reference frame that has ball B with an initial speed of 0 m/s and ball A with a speed of 0.2 m/s.

Since I am switching reference frames, I am going to rename the velocities. I am going to call ball A velocity C1 and C2 and then ball B will be D1 and D2 (for final and initial). Technically, I should use prime notation – but I think it will just get messy.

So, here is how it looks in the new reference frame.

In general, the initial C velocity would be:

$v_{C1}=v_{A1}-v_{B1}$

Now I get the following for the momentum and kinetic energy conservation equations.

$m_A v_{C1}=m_A v_{C2}+m_B v_{D2}$

$\frac{1}{2}m_A v_{C1}^2=\frac{1}{2}m_A v_{C2}^2 +\frac{1}{2}m_B v_{D2}^2$

Now we have two equations two unknowns. I’m going to cheat. I worked this out on paper and I’m just going to take a picture of it.

Here is the final solution (in case you can’t read it).

$v_{C2} = v_{C1}-\frac{m_B}{m_A}v_{D2}$

$v_{D2} = \frac{2v_{C1}}{\frac{m_B}{m_A}+1}$

So, you can get a value for vD2 and then plug that into vC2. After that, you can convert them back to the stationary reference frame to get vA2 and vB2.

Boom. It works. Here is my calculation. Just to be clear, it looks like this:

The output looks like this:

Winning. That agrees with my numerical model.

# Projectile in Polar Coordinates

Why?  There is no why.

Suppose a ball is shot at an angle θ with an initial velocity v0.  What will the motion be like in polar coordinates?

First, let me start with Newton’s 2nd Law in polar coordinates (I derived this in class).

$F_r = m(\ddot{r}-r\dot{\theta}^2)$
$F_\theta = m(r\ddot{\theta}+2\dot{r}\dot{\theta})$

Once the ball is in the air (and ignoring air resistance) the only force on the ball is the gravitational force. Yes, this would be -mg in the y-direction, but we don’t have a y-direction. Instead, we have polar coordinates. Maybe this picture will help.

The r and θ components of the gravitational force will change as:

$F_r = -mg\sin\theta$
$F_\theta = -mg\cos\theta$

If I use these forces with Newton’s law in polar coordinates, I get:

$F_r = -mg\sin\theta=m(\ddot{r}-r\dot{\theta}^2)$
$F_\theta = -mg\cos\theta = m(r\ddot{\theta}+2\dot{r}\dot{\theta})$

Of course the mass cancels – but now I can solve the first equation for $\ddot{r}$ and the second equation for $\ddot{\theta}$.

$\ddot{r} = r\dot{\theta}^2-g\sin\theta$
$\ddot{\theta} = \frac{-2\dot{r}\dot{\theta}}{r} - \frac{g\cos\theta}{r}$

It doesn’t matter that these second derivatives depend on the other stuff – I can still calculate them. Once I have those, I can create a numerical calculation to update the velocities and positions. Suppose I have everything know at time(1), then the stuff at time(2) would be:

$\dot{r}_2 = \dot{r}_1 +\ddot{r}\Delta t$
$\dot{\theta}_2 = \dot{\theta}_1 +\ddot{\theta}\Delta t$
$r_2 = r_1+\dot{r}\Delta t$
$\theta_2 = \theta_1 +\dot{\theta}\Delta t$
$t_2 = t_1 +\Delta t$

Now I’m all set to do a numerical calculation. Well, I still need the initial conditions. I could use this:

$\dot{r}_0 = v_0$
$r_0 =0$
$\dot{\theta}_0 = 0$
$\theta_0 = \theta_0$

But wait! There’s a problem. The calculation for $\ddot{\theta}$ has a 1/r term. If r is zero the universe will explode. I can fix this by having the initial r a little bit bigger than zero. Problem solved.

Here is the program in Glowscript.

For the first run, I am going to calculate the x- and y-coordinates in each step and plot x vs y.  I know this should look like a parabola.

Boom.  That works.  Now for a plot of both r and theta as a function of time for a high launch angle.

Double boom.