| 1 |
.PS |
| 2 |
# chaos.m4 |
| 3 |
# Example simulation of chaos equations. |
| 4 |
gen_init |
| 5 |
scale = 10 |
| 6 |
define(`FF',`dnl |
| 7 |
`$4' = `$1'+dt*10*(-`$1'+`$2') |
| 8 |
`$5' = `$2'+dt*(28*`$1'-`$2'-`$1'*`$3') |
| 9 |
`$6' = `$3'+dt*(-8*`$3'/3+`$1'*`$2') ') |
| 10 |
[ |
| 11 |
x0 = 1 |
| 12 |
y0 = 0 |
| 13 |
z0 = 0 |
| 14 |
dt = 0.005 |
| 15 |
nN = 100 |
| 16 |
for i = 1 to nN do { |
| 17 |
for j = 1 to 8 do { |
| 18 |
FF(x0,y0,z0,x1,y1,z1) |
| 19 |
FF(x1,y1,z1,x2,y2,z2) |
| 20 |
FF(x2,y2,z2,x3,y3,z3) |
| 21 |
FF(x3,y3,z3,x4,y4,z4) |
| 22 |
spline from x0,y0 to x1,y1 then to x2,y2 then to x3,y3 then to x4,y4 |
| 23 |
x0 = x4; y0 = y4; z0 = z4 |
| 24 |
} |
| 25 |
} |
| 26 |
arrow from (-15,0) to (15,0); "$x$" ljust |
| 27 |
line up 1 from (10,0); "$ 10$" at last line.start below |
| 28 |
line up 1 from (-10,0); "$-10$" at last line.start below |
| 29 |
arrow from (0,-15) to (0,15); "$y$" above |
| 30 |
line right 1 from (0,10); "$ 10$" at last line.start rjust |
| 31 |
line right 1 from (0,-10); "$-10$" at last line.start rjust |
| 32 |
"$ 0$" at (0,0) below rjust |
| 33 |
] |
| 34 |
`"\parbox{2.5in}{\begin{eqnarray*} |
| 35 |
\dot{x}_1 & = & 10(-x_1+x_2)\\ |
| 36 |
\dot{x}_2 & = & 28x_1-x_2-x_1x_3\\ |
| 37 |
\dot{x}_3 & = & -8x_3/3+x_1x_2 |
| 38 |
.\end{eqnarray*}}"' at last [].s below |
| 39 |
.PE |