# Modfied pendulum equation ch1-pendulum.ode # This script simulates a modified version of the pendulum equation x'' + sin(x) = 0 in which # friction is included and we allow the pendulum pin to be vibrated vertically. # (See Chapter 1 Exercises in the textbook.) There are three parameters: beta (the friction coefficient), # alpha (proportional to amplitude of vibration) and omega (frequency of vibration). The variable x is the # angle relative to the downward vertical position, and y = x'. dx/dt=y dy/dt=-beta*y-(1.0+alpha*omega^2*cos(omega*t))*sin(x) # Set the default value of the parameters: # Don't put spaces between the parameter name, the equal sign, and the parameter value! par beta=0.05,alpha=0.1,omega=0.5 # Set the default initial conditions: init x=3.1 y=0.0 # Set the axes to plot displacement x versus time t: @ xplot=t, yplot=x # Set the maximum number of data points to store, stopping time, time step, and default viewing window @ maxstor=50000,total=200,dt=.005,xlo=0,xhi=200,ylo=-2.0,yhi=2.0 done