Mandelbrot

*To*: mathgroup at smc.vnet.net*Subject*: [mg13595] Mandelbrot*From*: Jon Prudhomme <prudhomj at elwha.evergreen.edu>*Date*: Mon, 3 Aug 1998 03:53:54 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Hello I was just curious if anyone had found a decent way to plot the Mandelbrot or Julia sets with Mathematica yet. I have been able to do it with DensityPlot and ListDensityPlot, but I can't help but wonder if there is an easier way than either of these: iterations=200; pointColor[c_]:=Module[{i,p}, For[i=1;p=0,i<=iterations&&Sqrt[Re[p]^2+Im[p]^2]<=2,i++,p=p^2+c];i] DensityPlot[pointColor[Complex[x,y]],{x,-2.5,1.5},{y,-1.5,1.5},Mesh->False, ColorFunction->Hue,AspectRatio->Automatic,PlotPoints->1000] (* or this for a ListDensityPlot... *) manSet=Table[pointColor[Complex[x,y]],{y,-1.5,1.5,.01},{x,-2.5,1.5,.01}]; ListDensityPlot[manSet,Mesh->False,ColorFunction->Hue,AspectRatio->Automatic] Anyone got any other ideas? Jon Prudhomme The Evergreen State College prudhomj at elwha.evergreen.edu PS - The algorithm for the Mandelbrot set is z[[n]]=z[[n-1]]^2+c where z[[0]]=0 and c is the point on the complex plain being tested as a member of the set. If after an arbitrary number of iterations the point is not 2 units away from the origin on the complex plain, the point c is a member of the set. Colors of non-member points are based on the iteration number that them as excluded from the set.