/usr/share/doc/plotutils/ode/coupled.ode is in plotutils 2.6-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # This example simulates two similar pendulums, coupled with a horizontal
# spring. The motion is taken to be undamped.
#
# The plot shows the displacement of one of the pendulums, as a function of
# time. It illustrates how energy (e.g. maximum displacement) oscillates
# back and forth between the two.
# You may run this example by doing:
#
# ode < coupled.ode | graph -T X -C
#
# or alternatively, to get a real-time plot,
#
# ode < coupled.ode | graph -T X -C -x 0 50 -y -0.6 0.6
# The equations are:
# m*x1'' = - m*g*x1/l + k(x2 - x1)
# m*x2'' = - m*g*x2/l - k(x2 - x1)
xone' = vxone
xtwo' = vxtwo
vxone' = -g*xone/lone + k/mone * ( xtwo - xone)
vxtwo' = -g*xtwo/ltwo - k/ltwo * ( xtwo - xone)
k = 1
g = 9.8 # acceleration due to gravity
lone = 5
ltwo = 5
mone = 1
mtwo = 1
xone = 0.0
xtwo = 0.3
vxone = 0
vxtwo = 0
print t, xone
step 0,50
|