home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / demo / ode.zoo / pendulum.ode < prev    next >
Text File  |  1990-01-11  |  617b  |  22 lines

  1. # PENDULUM.ODE
  2. # A real pendulum - a non-linear oscillator.
  3. # If amplitude is small (controlled by initial omega), output will be almost
  4. # sinusoidal, but not for large amplitudes.
  5. # If omega(0) is large enough (how large?), pendulum will go right round
  6. # instead of oscillating.
  7. # Notice how frequency depends on amplitude.
  8. # Plot theta against time.
  9.  
  10. # Solve with 4th order Runge-Kutta, fixed step size, to t=50, 200 steps
  11. $m -4
  12. $t 50
  13. $n 200
  14.  
  15. # theta is angle with respect to vertical (in radians)
  16. theta  = 0
  17. # omega is angular velocity
  18. omega  = 2, 1, 0.5
  19.  
  20. theta' = omega
  21. omega' = -sin(theta)
  22.