/*
batch file for Maxima CAS program
save it as a file with mac extension and open in Maxima
It creates l6.svg file in the directory path ( see below)
change the path directory if you save mac file in the different location
-----run -------
maxima
batch("l.mac");
*/
kill(all);
remvalue(all);
/* real quadratic diagram based on the code by Mario Rodriguez Riotorto using Maxima CAS draw packag */
pts:[]; /* points of the orbit */
ls:[];
kMax1:1000;
kMax2:500;
/* ------------- compute -----------------------------------*/
for c:-2.0 while c <= 0.25 step 0.001 do
(
z: 0.0,
l:0, /* Lyapunov exponent */
for k:1 thru kMax1 do
(
z: z * z+c, /* to remove points from image compute and do not draw it */
l:l+log(abs(2*z))
),
for k:1 thru kMax2 do
(
z: z * z+c, /* compute and draw it */
pts: cons([c,z], pts),/* save points to draw it later */
l:l+log(abs(2*z))
),
ls:cons([c,l/(kMax1+kMax2)],ls) /* save points to draw it later */
);
/* ================= draw ======================================*/
path:"~/maxima/batch/lyapunov/"$ /* result of pwd; to save image in the same directory as mac file */
FileName:"l6"$ /* without extension which is the terminal name */
load(draw);
draw(
terminal = 'svg,
file_name = concat(path,FileName),
dimensions=[1900,2600], /* y = x*rows */
gr2d(points_joined =false,
title = "Bifurcation diagram, z[i+1] = z[i]*z[i] +c",
xlabel = "c parameter",
ylabel = "z ",
point_type = filled_circle,
point_size = 0.2,
color = black,
points(pts)
),
gr2d(title = " Lyapunov exponent ",
points_joined =true,
yaxis = true,
xaxis = true,
xlabel = "c parameter",
ylabel = " lyapunov exponent ",
yrange = [-4,1],
color = red,
point_size = 0.5,
point_type = filled_circle,
points(ls))
);
Licencja
Ja, właściciel praw autorskich do tego dzieła, udostępniam je na poniższej licencji
dzielić się – kopiować, rozpowszechniać, odtwarzać i wykonywać utwór
modyfikować – tworzyć utwory zależne
Na następujących warunkach:
uznanie autorstwa – musisz określić autorstwo utworu, podać link do licencji, a także wskazać czy utwór został zmieniony. Możesz to zrobić w każdy rozsądny sposób, o ile nie będzie to sugerować, że licencjodawca popiera Ciebie lub Twoje użycie utworu.
na tych samych warunkach – Jeśli zmienia się lub przekształca niniejszy utwór, lub tworzy inny na jego podstawie, można rozpowszechniać powstały w ten sposób nowy utwór tylko na podstawie tej samej lub podobnej licencji.