01-13-2020, 03:25 PM
Hi. Good morning
The following code can be entered directly on the entry line, but only work in CAS and linear mode (Entry: algebraic/1D). Why? the definition failure in textbook mode (aka pretty print or 2D input)
Please copy and paste the following codes into the input line (simulator)
//deltalist(time(fract(320,240,10)));
fract(320,240,10)
from program editor with please add the header #cas ... #end
//deltalist(time(fract1(320,240,10)));
fract1(320,240,10)
The following code can be entered directly on the entry line, but only work in CAS and linear mode (Entry: algebraic/1D). Why? the definition failure in textbook mode (aka pretty print or 2D input)
Please copy and paste the following codes into the input line (simulator)
PHP Code:
function fract(X_,Y_,Nmax) // Mandelbrot fractal, not using symmetry.
local x,y,z,c,j,w,h,res1,res2;
freeze;
w:=2.7/X_;
h:=-1.87/Y_;
res1:=[];
Y_:=Y_-1;
for y from 0 to Y_ do
c:=-2.1+i*(h*y+0.935);
for x from 0 to X_-1 do
z:=0;
for j from 0 to Nmax-1 do
if abs(z:=z^2+c)>2 then break; end;
end;
res1.append(pixon_p(x,y,126*j+2079));
c:=c+w;
end;
end;
//return res1; // hpprime: comment on this line, 10 thousand elements maximum
return "Done"
end;
//deltalist(time(fract(320,240,10)));
fract(320,240,10)
from program editor with please add the header #cas ... #end
PHP Code:
function fract1(X_,Y_,Nmax) // Mandelbrot fractal, using symmetry.
local x,y,z,c,j,w,h,res1,res2;
freeze;
w:=2.7/X_;
h:=-1.87/Y_;
res1:=makelist(-ceiling(X_*Y_/2)-1);
res2:=res1;
Y_:=Y_-1;
for y from 0 to Y_/2 do
c:=-2.1+i*(h*y+0.935);
for x from 0 to X_-1 do
z:=0;
for j from 0 to Nmax-1 do
if abs(z:=z^2+c)>2 then break; end;
end;
res1.append(pixon_p(x,y,126*j+2079));
res2.append(pixon_p(x,Y_-y,126*j+2079));
c:=c+w;
end;
end;
//return res1,res2; // hpprime: comment on this line, 10 thousand elements maximum
return "Done"
end;
fract1(320,240,10)