I am reading Fractals from the Newton-Raphson method from Peter Young's page.
I've tried:
newtC = Compile[{{n, _Integer}, {z, _Complex}},
Arg[FixedPoint[# - (#^n - 1)/(n #^(n - 1)) &, N[z], 50]]/(2 Pi)]
And:
Timing[DensityPlot[newtC[3, x + I y], {x, -2, 2}, {y, -2, 2}, PlotPoints -> 300]]
Gave me this image in 3.96397:
Now, I tried:
newt[n_, z_] :=
Arg[FixedPoint[# - (#^n - 1)/(n #^(n - 1)) &, N[z], 50]]/(2 Pi)
Then, even when I eliminated the PlotPoints->300
, the following code will not work:
Timing[DensityPlot[newt[3, x + I y], {x, -2, 2}, {y, -2, 2}]]
I can't even abort the run: I have to quit the kernel. I'm really surprised at this huge difference. Am I missing something?
Comments
Post a Comment