Don't panic. We will work up to this exercise slowly by solving a number of ODE's in class starting with the coffee cooling problem. You may also want to review the mass on a spring section in your introductory physics book.
See the lecture notes for a discussion of the numerical methods that can be used to solve these types of problems.
Solve the differential equation for a pendulum with a small displacement. (This problem is identical to a mass on a spring.) There are two variables, q, and t corresponding to angle and time. If we assume that the length, mass of the pendulum, and acceleration of gravity are 1 (in some odd units!) then the ODE for this system is:
d / d t ( d q / d t ) = -q
The angle, q, should of course oscillate. This equation is Newton's second law for this sytem.
In order to find a computer solution it is useful to break this equation up into three first order equations. This can be done if you define a new variable, w, corresponding to the angular frequency. The equations for the pendulum can now be written as:
| d w / d t = - q |
| d q / d t = w |
| d t / d t = 1 |
Prove to yourself that these three equations are equivalent to the simple second order differnetial equation given above.
Be sure and add the ability to start the system with initial values, w 0 and r0, when you code your program
Solve the differential equation for a pendulum without the small angle approximation. There are three variables, q, w, and t corresponding to angle, angular frequency and time. If we assume that the length, mass of the pendulum, and acceleration of gravity are 1 (in some odd units!) then the ODEs for this system are:
| d w / d t = - Sin( q ) |
| d q / d t = w |
| d t / d t = 1 |
What should happen if the initial position of q is Pi?
Solve the differential equation for a pendulum without the small angle approximation. If we assume that the length and mass of the pendulum are 1 and a frictional force proportional to the angular frequency w, then the ODEs for this system are:
| d w / d t = - Sin( q ) - w * Q |
| d q / d t = w |
| d t / d t = 1 |
The coefficient of friction is called Q in this program. It should take on a value from 0 to about 2.
Solve the differential equation for a pendulum without the small angle approximation. If we assume that the length and mass of the pendulum are 1 and a frictional force proportional to the angular frequency w, then the ODEs for this system are:
| d w / d t = - Sin( q ) - w*Q + A Sin(2 t / 3 ) |
| d q / d t = w |
| d t / d t = 1 |
I have choosen a fixed driving frequency of 2/3 Rad/Sec to keep things simple. The amplitude should vary from 0 to about 2 for interesting results.
Your program can show many different types of graphs. One graph should be the position of the pendulum in radians vs time. Angular velocity vs time is another possibility. An interesting graph might be the position of the pendulum in radians vs the angular velocity of the pendulum. This is called a phase space plot.
==================================================================
Start with easy changes to the program and only make one change at a time.
It might be fun to add animation showing a pendulum oscillating on the screen. You will need Graphics Primitives, such as line, to do this. If you have trouble with animation I'll help but only after you have written the differential equation portion of the homework. Start with a procedure that draws a line and a circle on a screen at an angle theta with respect to the vertical. Look in the Delphi book for an animation example.
Do one change at a time and make sure it works before you go on to the next change. This is the longest exercise so far. Start early.