home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / demo / ode.zoo / duffing.ode < prev    next >
Encoding:
Text File  |  1990-03-15  |  378 b   |  22 lines

  1. # DUFFING.ODE
  2. # Duffing oscillator
  3. # A driven nonlinear oscillator with chaotic solutions.
  4. # Try plotting v against x.
  5.  
  6. # Use 5th order Runge-Kutta, fixed step size, 100 steps
  7. $m -5
  8. $n 200
  9. $g d
  10.  
  11. # Solve to 100
  12. $t 200
  13.  
  14. x  = 1
  15. v  = 0
  16. t  = 0
  17. a  = 0.3      #  a is drive amplitude
  18. twopi = pi(2)
  19. x' = v/twopi
  20. v' = (-cub(x) + x - 0.25*v + a*cos(t))/twopi
  21. t' = 1
  22.