/usr/share/genius/examples/strange-attractor.gel is in genius-common 1.0.23-3.
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # Category: Chaos
# Name: Strange attractor (Duffing's equation)
#
# Creates a strange attractor by strobing the forced Duffing
# equation
#
# The Duffing equation (converted to an ODE system)
# x_1' = x_2, x_2' = -0.05x_2 - x_1^3 + 8cos(t)
#
function duf(t,x) = [x@(2),-0.05*x@(2)-(x@(1))^3+8*cos(t)];
# Strobe period
strobe = 2*pi;
# Initial time
t = 0.0;
# Steps to use in RungeKutta for each strobe
steps = 25;
# Number of points to compute
ptnum = 5000;
#initial position
x = [0.0,0.0];
LinePlotDrawLegends = false;
PlotWindowPresent(); # Make sure the window is raised
points = null;
k = 1;
for j=1 to ptnum do (
x = RungeKutta(duf,t,x,t+strobe,steps);
t = t+strobe;
# only plot points from the 100th on
if (j > 100) then (
points@(k,) = x;
increment k;
# every 500 point display intermediate picture
if j % 500 == 0 then (
DisplayVariables(`j);
PlotCanvasFreeze ();
LinePlotClear ();
LinePlotDrawPoints (points, "color", "blue", "window", "fit");
PlotCanvasThaw ();
)
)
);
# Display final picture
PlotCanvasFreeze ();
LinePlotClear ();
LinePlotDrawPoints (points, "color", "blue", "window", "fit");
PlotCanvasThaw ();
|