Table of contents
Download the provided Python program and run it. It is numerically models a simple pendulum. Your first task is to confirm this. Draw the free body diagram of a point mass at the end of a massless-rod and derive the equations of motion.
Next, find the part of the code where it says you may be asked to swap the order of two lines. Do so. What happens? If you are interested in learning more, check the Appendix.
Return the code to its original state. Your final task is use the code to sketch a plot of the period of the pendulum as a function of the initial amplitude. You may have taken physical data with a real pendulum. If so, compare your measurements with the results of this numerical simulation. Note: if you are comfortable using Python, it is pretty easy to have Python generate all the T(A) data at once and plot it for you. Otherwise you will have to run the program many times, take the data, and produce the graph by hand.
Is a simple pendulum a simple harmonic oscillator? Explain your conclusions with regards to what you know about simple harmonic motion and pendulums, referencing the derivation you were asked to do at the start of this activity. Sketch the potential energy of the pendulum as a function of angle. How does this graph compare with the graph of potential energy for a simple harmonic oscillator?
The original form of the Python code is called a semi-implicit Euler method, or sometimes a symplectic Euler method. When you switch the two lines of code it becomes an Euler method. Both of these methods are not very accurate, so you need pretty small time steps to keep the errors small. The main difference is that the symplectic Euler method (in fact, all symplectic methods) is time-reversible, whereas the Euler method is not. That is, if you start with some initial conditions, calculate the next 10 values, then "reverse" time, a symplectic method returns exactly to its starting location (except for some issues with regards to rounding errors due to limited precision floating point values) whereas the non-symplectic method does not.
It turns out that when your equations are time-reversible, then energy is conserved. Look up Noether's theorem for more information on this interesting observation. Symplectic integrators enforce energy conservation (sort of, there are a few small technical issues which make this statement not quite accurate). The regular Euler method, as you should find, does not conserve energy.