Application Center - Maplesoft

App Preview:

Ensemble de Mandelbrot

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

Ensemble de Mandelbrot 

by Prof. Samir KADDOURI  

Visualisation de l'ensemble de Mandelbrot 

Proc?dure tr?s lente : utilisation de evalf 

> mandelbrot1:=proc(c,maxit)
local j,mc,z;
mc:=max(2,abs(c));
z:=0;
for j from 0 to maxit  
   while abs (z) < mc do
       z:=evalf(z^2+c);
   od;
evalf(sqrt(j-1));
end;   
 

`:=`(mandelbrot1, proc (c, maxit) local j, mc, z; `:=`(mc, max(2, abs(c))); `:=`(z, 0); for j from 0 to maxit while `<`(abs(z), mc) do `:=`(z, evalf(`+`(`*`(`^`(z, 2)), c))) end do; evalf(sqrt(`+`(j, ...
`:=`(mandelbrot1, proc (c, maxit) local j, mc, z; `:=`(mc, max(2, abs(c))); `:=`(z, 0); for j from 0 to maxit while `<`(abs(z), mc) do `:=`(z, evalf(`+`(`*`(`^`(z, 2)), c))) end do; evalf(sqrt(`+`(j, ...
`:=`(mandelbrot1, proc (c, maxit) local j, mc, z; `:=`(mc, max(2, abs(c))); `:=`(z, 0); for j from 0 to maxit while `<`(abs(z), mc) do `:=`(z, evalf(`+`(`*`(`^`(z, 2)), c))) end do; evalf(sqrt(`+`(j, ...
`:=`(mandelbrot1, proc (c, maxit) local j, mc, z; `:=`(mc, max(2, abs(c))); `:=`(z, 0); for j from 0 to maxit while `<`(abs(z), mc) do `:=`(z, evalf(`+`(`*`(`^`(z, 2)), c))) end do; evalf(sqrt(`+`(j, ...
(1.1.1)
 

> mandelbrot1(5/8+I/8,50);
 

1.732050808 (1)
 

> restart:
 

Proc?dure rapide : utilisation de evalhf 

> mandelbrot2:=proc(a,b)
local j,mc2,x,y,x_i,y_i;
mc2:=max(4,a^2+b^2);
x:=0;
y:=0;
for j from 0 to maxit  
   while  evalhf(x^2+y^2) < mc2 do
       x_i:=evalhf(x^2-y^2+a);
       y_i:=evalhf(2*x*y+b);
       x:=x_i;
       y:=y_i;
           od;
evalhf((j-1)^(1/2));
end;
 

`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
`:=`(mandelbrot2, proc (a, b) local j, mc2, x, y, x_i, y_i; `:=`(mc2, max(4, `+`(`*`(`^`(a, 2)), `*`(`^`(b, 2))))); `:=`(x, 0); `:=`(y, 0); for j from 0 to maxit while `<`(evalhf(`+`(`*`(`^`(x, 2)), `...
(2.1)
 

> maxit:=100:
 

> mandelbrot2(5/8,1/8);
 

1.73205080756887720 (2.2)
 

Proc?dure pour faire un "zoom"  sur l'ensemble de Mandelbrot 

> zoomM:=proc(xc,yc,larg,mx,nbpix)
local xmin,xmax,ymin,ymax;
global maxit;
maxit:=mx;
xmin:=xc-larg/2;
xmax:=xc+larg/2;
ymin:=yc-larg/2;
ymax:=yc+larg/2;
plot3d(0,xmin..xmax,ymin..ymax,numpoints=nbpix^2,style=patchnogrid,orientation=[-90,0],scaling=constrained,color=mandelbrot2,axes=normal);
end;
 

`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
`:=`(zoomM, proc (xc, yc, larg, mx, nbpix) local xmin, xmax, ymin, ymax; global maxit; `:=`(maxit, mx); `:=`(xmin, `+`(xc, `-`(`*`(`/`(1, 2), `*`(larg))))); `:=`(xmax, `+`(xc, `*`(`/`(1, 2), `*`(larg)...
(2.3)
 

> zoomM(-0.5,0,2.5,200,300);
 

Plot
 

> zoomM(-1.356,0.0686,.0025,400,300);
 

Plot
 

 

Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.
 

Image