home *** CD-ROM | disk | FTP | other *** search
- # DUFFING.ODE
- # Duffing oscillator
- # A driven nonlinear oscillator with chaotic solutions.
- # Try plotting v against x.
-
- # Use 5th order Runge-Kutta, fixed step size, 100 steps
- $m -5
- $n 200
- $g d
-
- # Solve to 100
- $t 200
-
- x = 1
- v = 0
- t = 0
- a = 0.3 # a is drive amplitude
- twopi = pi(2)
- x' = v/twopi
- v' = (-cub(x) + x - 0.25*v + a*cos(t))/twopi
- t' = 1