Re: mandelbrot in version 7 & Ruskeepaa version 3
- To: mathgroup at smc.vnet.net
- Subject: [mg120425] Re: mandelbrot in version 7 & Ruskeepaa version 3
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
- Date: Fri, 22 Jul 2011 03:42:02 -0400 (EDT)
- References: <j0aivf$ghq$1@smc.vnet.net>
There is a space missing between I and y in the expression mandelbrot[x + Iy] (should be mandelbrot[x + I y]). Also, you should omit the semicolon after DensityPlot, otherwise the plot will not be shown. Incidentally, tabulating the values and then plotting them with ArrayPlot is faster for this example than using DensityPlot. That is, ArrayPlot@Table[ mandelbrot[x + I y], {y, -1.5, 1.5, 0.005}, {x, -2.0, 1.0, 0.005} ] On Fri, 22 Jul 2011 02:15:27 +0100, DaleJenk <dale.jenkins8 at deletegooglemail.com> wrote: > I bought Mathematica 7 Home Edition last year. I'm trying to plot the > Mandelbrot Set following the instructions in Ruskeepaa's Mathematica > Navigator version 3. I'm getting an error message. > > Here's what I am introducing: > > mandelbrot = Compile[{{c,_Complex}}, > Module[{z=0+0I, n=0}, While[Abs[z]<2 && n<50, z=z^2+c; n++]; n]]; > > DensityPlot[mandelbrot[x+Iy], {x,-2,1},{y,-1.5,1.5}, PlotPoints->200, > Mesh->False, FrameTicks->{{-2,-1,0,1},{-1,0,1}}]; //Timing > > I get the message: > > CompiledFunction::cfsa: > Argument -1.99998 + Iy at position 1 should be a machine-size complex > number. > > Where am I going wrong? > > Thanks. >