Hi again,

Here is a small code doing the graphic job:

function  X=anglePath(r, th)
    cumth  =  cumsum(th);
    X  =  cumsum([0  r.*cos(cumth);0  r.*sin(cumth)],  2);
end

function  N=collatz(n)
    N  =  n;
    while  n<>1
        if  modulo(n,2)  ==  0
            n  =  n/2;
        else
            n  =  3*n+1;
        end
        N  =  [n  N];
    end
end

a=0.08;
e=1.2;

clf
gcf().color_map=graycolormap(128);
for  i=1:100
    r=collatz(ceil(rand()*2000000000));
    X=anglePath(r./(1+r.^1.2),a*%pi*(0.35-modulo(r,2)));
    plot(0.01+X(1,:),-0.01+X(2,:));
end collatz

--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to