home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Education
/
collectionofeducationcarat1997.iso
/
SCIENCE
/
ODE25.ZIP
/
PENDULUM.ODE
< prev
next >
Wrap
Text File
|
1990-01-11
|
617b
|
22 lines
# PENDULUM.ODE
# A real pendulum - a non-linear oscillator.
# If amplitude is small (controlled by initial omega), output will be almost
# sinusoidal, but not for large amplitudes.
# If omega(0) is large enough (how large?), pendulum will go right round
# instead of oscillating.
# Notice how frequency depends on amplitude.
# Plot theta against time.
# Solve with 4th order Runge-Kutta, fixed step size, to t=50, 200 steps
$m -4
$t 50
$n 200
# theta is angle with respect to vertical (in radians)
theta = 0
# omega is angular velocity
omega = 2, 1, 0.5
theta' = omega
omega' = -sin(theta)