/usr/share/genius/examples/cantor.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 | # Category: Analysis
# Name: Cantor's devil staircase function (approximation)
function Ternary(x,n) = (
# only if x in [0,1)
out = null;
for k = 1 to n do (
x = x*3;
fx = floor (x);
x = FractionalPart (x);
out = [out, fx]
)
);
# Cantor function, only really for x in [0,1]
function Cantor(x) = (
if x >= 1 then return 1;
if x <= 0 then return 0;
# Number of steps, the higher the number the more precise the graph
n = 20;
t = Ternary(x,n);
N = n;
for k = 1 to n do (
if t@(k) == 1 then
(N = k; break)
);
1/(2^N) + sum k = 1 to (N-1) do (t@(k)/(2^(k+1)))
);
PlotWindowPresent(); # Make sure the window is raised
LinePlot(Cantor,[0,1]);
|