Prof. Todd B. Krause's Phys 310 Home Page: Spring 2009
Computational Projects in Classical Mechanics
The following consists of projects of a computational nature which relate to topics covered in our classical mechanics course and which the student might find rewarding exercises. They are designed as avenues through which the student may both build up a background in basic computational procedures applied to physics and in which to apply the concepts learned in this course in a way not too far removed from current research methods in mechanics and dynamical systems.
Each topic provides program templates in each of three computer languages: C++, Python, and Mathematica. I cannot stress enough how much more useful in the long term it would be to work with either the C++ or Python versions for this type of numerical work. However at this point I have not had the opportunity to make sure that the students have easy access to these systems on department computers. Therefore I have left a Mathematica version for those who would prefer to use that, or who have no other recourse.
Each program template begins with preparatory comments that provide the equations to be simulated, along with the underlying logic. The body of the program contains the overarching control structures (e.g. if-then, while, for, etc. statements) that provide the backbone of the program. Within these the student will find hints as to what variables should be declared, updated, checked or computed. Depending on the student's background, these may be too sparse or too verbose. In the former case, please do not hesitate to seek help from me personally; at the same time keep in mind that the web is one of the greatest resources any would-be programmer can employ. Be creative!
- The Pendulum
This project involves applying our discussion of harmonic motion to a computational system. In particular, the student should use the forward Euler integration scheme to compute the phase space trajectory of the pendulum as a function of time. That is, the program should treat the equation of motion for the pendulum in terms of phase space coordinates as in the class notes, and use the forward Euler scheme to compute the angle and angular velocity at a given time step based on their values at the previous time step. Moreover, we estimate the period by tracking when the pendulum angle changes sign. As an estimate of the effectiveness of the method, the student should also compute the initial and final total energy and the relative error between the two. The phase space data should be output to a separate file for plotting, or directly plotted within the program; the crossing times and relative error in the energy should be output to the screen.