You can also enjoy the 3d version: function X=anglePath3(r, th, ph) cumth = cumsum(th); cumph = cumsum(ph); X = cumsum([0 r.*sin(cumph) 0 r.*sin(cumth).*cos(cumph) 0 r.*cos(cumth).*cos(cumph)], 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.1; e=1.3; clf NCOL=512; gcf().color_map=parulacolormap(NCOL); drawlater for i=1:200 r=collatz(grand(1,1,'uin',1,1000000)); m1=modulo(r,4); m2=m1; m1(m1>1)=0; m2(m2<=1)=0; X=anglePath3(r./(1+r.^e),a*%pi*(0.352-modulo(m1,2)),a*%pi*(0.352-modulo(m2,2))); x=rand(3,1)/8; param3d(x(1)+X(1,:),x(2)+X(2,:),x(3)+2*X(3,:)) gce().foreground=min(NCOL,length(r)) end isoview on drawnow Le 14/04/2022 à 09:46, Stéphane Mottelet a écrit :
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 -- 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 https://antispam.utc.fr/proxy/v3?i=Zk92VEFKaGQ4Ums4cnZEUWMTpfHaXFQGRw1_CnOoOH0&r=bHA1dGV3NWJQVUloaWNFUYH-0fCrCfKNwGzaHK3mGAF34Dbd5QpdXfVRjdiNrR7K&f=SlhDbE9uS2laS2JaZFpNWvypxfeihkZF7xphlFhpLfOsI1HEbZ2YCuIwSI8iQL53&u=http%3A//lists.scilab.org/mailman/listinfo/users&k=XRKU
-- 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