home *** CD-ROM | disk | FTP | other *** search
- # PENDULUM.ODE
- # A real pendulum - a non-linear oscillator.
- # If amplitude is small (controlled by initial omega), output will be almost
- # sinusoidal, but not for large amplitudes.
- # If omega(0) is large enough (how large?), pendulum will go right round
- # instead of oscillating.
- # Notice how frequency depends on amplitude.
- # Plot theta against time.
-
- # Solve with 4th order Runge-Kutta, fixed step size, to t=50, 200 steps
- $m -4
- $t 50
- $n 200
-
- # theta is angle with respect to vertical (in radians)
- theta = 0
- # omega is angular velocity
- omega = 2, 1, 0.5
-
- theta' = omega
- omega' = -sin(theta)