A basic pendulum is a mass at the end of a string that swings back and forth. It seems simple, and it appears in most introductory physics textbooks. But it's not a trivial problem to solve for the motion of this mass on a string.
Traditionally, the introductory view of the pendulum is to show that for small amplitudes the motion of the mass is like a simple harmonic motion (motion of a mass on a spring) with a period of oscillation that depends on the length of the string and the local gravitational field.
Here is an extra fun fact. A pendulum with a length of 1 meter has a period of about 2 seconds (so it takes about 1 second to swing across an arc). This means that there is a relationship between the gravitational field (g) and Pi. But really, it's fairly difficult to lead a student through the derivation of this expression for the period (at least it's difficult for an introductory physics student). It's still useful to look at pendulums in the physics lab because you can very easily measure both the period and the length and see if they do indeed fit the expression above.
The real problem is the nature of the tension force in the string. In order to model the motion of an object (like a mass on the end of a string), you need to find all the forces on that object. These forces fall into two types:
- Deterministic Forces. These are forces for which I can get a vector value based on the mass, position, or velocity of an object or pair of objects. Here are some examples: the spring force, the gravitational force, air resistance, electrostatic force.
- Forces of Constraint. These are forces that do not have an explicit expression but instead have a magnitude and direction to constrain the motion of an object in some way. Two examples: tension in a rope and normal force.
If you want to model the motion of an object with deterministic forces, it's fairly straightforward. Just use the following recipe. Break the motion into small time steps. During each time step:
- Calculate the net force (this is the part where it's easy if you have deterministic forces).
- Use the net force to calculate the change in momentum of the object.
- Use the momentum to calculate the new position of the object.
- Update the time.
But this doesn't work with the pendulum. The tension in the string of a pendulum is clearly a force of constraint. Sure, the direction of this tension force is in the same direction as the string but the magnitude changes to whatever value it needs to be to keep the mass at the same distance from the pivot point. This means that in order to make a numerical model for a pendulum, you need to use a trick.
There are three different ways you can model the motion of a pendulum. I have looked at these methods before, so let me just give a short review. Notice that the title of that post is "a third way." In that case, I was counting two different methods to get a differential equation---but now I'm calling those the same method.
If you assume the mass is confined to move in a circular path, then you can reduce this to a one dimensional problem with the angle of the pendulum as the only variable. The only force that changes this angular position is the angular component of the gravitational force. With θ being the angle of the string as measured from the vertical, I can get the following expression:
There is a simple solution to this differential equation by assuming a small amplitude of oscillation (and thus a small angle). In this case, sin(θ) is approximately equal to θ and you get the same expression that you have for simple harmonic motion.
The problem with the pendulum motion is that the tension is a constraint force. Well, what if we make it a deterministic force? If the string is replaced with a very stiff spring, it should be an easier problem.
This method can work fairly well. Here is a numerical model that displays the angular position for both method 1 and 2.
Just click the "play" button to run this. If you want to change some of the code (and you probably should), I have left comments to indicate which things you could change. Don't worry, you won't break anything. Just click the "pencil" icon to switch to the code mode to edit.
Really, you should play around with the values for mass, spring constant (k) and time step (dt) to see how well this model agrees with the differential equation. Hint, try looking at both models to see which one is better at conserving energy. Yes, you can consider that a homework assignment if you like.
I can use the usual numerical model method if I can find an expression for the tension during each time step. Let's take a look at the forces on the mass during a swing.
I already know the direction of this tension force---it has to be in the same direction as the string (because strings only pull). But what about the magnitude? Suppose this mass is at some angle θ and moving with a velocity magnitude of v. In that case, I can add up the forces in the direction of the string (I will call this the r direction).
With the net force in the r-direction, I know this must also be equal to the mass of the object multiplied by the acceleration in the r-direction. Since the object is moving in a circle with a radius of L and a speed of v, it will have a centripetal acceleration towards the center of the circle (in the direction of the tension).
Now I have an expression for both the magnitude and direction of the tension force (based on the angle and the velocity). With this, I can just add a line into my numerical calculation loop and determine the vector value for the tension force. After adding this to the gravitational force, I can use the momentum principle---that should work.
Here is this method as a numerical calculation. I have again included the solution for the differential equation (for comparison).
Again, click the play button to start this. Also, you should play around with the code.
Why does anyone need to use this third method for the motion of a pendulum? Really, it's all about introductory physics courses. Although the real solution to the pendulum motion is complicated, it's still a great experiment for lab. It's very easy for students to measure the period of oscillation of the pendulum and to change things like string length or amplitude.
With this third method, students can also create a numerical model for the motion using a method similar to the that for calculating the motion of a mass on a spring. Better yet, they can easily change the starting angle for the pendulum and see that the period does indeed depend on amplitude, especially with the angle gets large.
Now for some homework questions.
- Include a graph of total energy as a function of time for all three methods. Is energy conserved?
- At what starting angle does the pendulum not agree with a simple harmonic motion model?
- Run the pendulum model for a much longer time than just 10 seconds (easy to change in the code above). You might find that the mass on the string starts to misbehave in certain ways. See if you can fix this.
- What if you want to include air resistance into this model? Oh, go ahead and do that. You can pick whichever method you like.
- What happens if you change the order of calculations in any of these methods? Do you get better or worse results?