# Duffing equation ch1-duffing.ode # First, write the 2nd-order Duffing equation as a system # of two first-order ODEs as follows: dx/dt = y dy/dt = -beta*y + x - x^3 # Set the default value of the parameter beta: # Don't put spaces between the parameter name, the equal sign, and the parameter value! par beta=1.0 # Set the default initial conditions: init x=0.5 y=0.0 # Set the axes to plot a trajectory in the phase plane: @ xplot=x, yplot=y # Set the stopping time, time step, and default viewing window @ total=10,dt=.01,xlo=-2.0,xhi=2.0,ylo=-2.0,yhi=2.0 done