3
$\begingroup$

I'm quite a beginner using Mathematica. I'd like to plot the fractals of higher degree polynomials.

I have an example for z^3 - 1 which looks like this:

F[z_] := z^3 - 1;
NewtonRaphsonStep[z_] := z - F[z]/F'[z]
NoOfIterations = 6; 
GridSize = .01
MatrixPlot[
  Table[
    θ = Arg[Nest[NewtonRaphsonStep, i + j I, NoOfIterations] /. 
      {Indeterminate -> 10}]; 
    If[θ > 1.8, 1, If[θ < -1.8, 2, 0]], 
    {j, -2., 2., GridSize}, {i, -2., 2., GridSize}], 
  Mesh -> None, Mesh -> False, ImageSize -> {500, 500}, 
  ColorRules -> {2 -> Red, 0 -> Orange, 1 -> Pink}]

And this works just fine. But for z^4 - 1 and higher degrees, I don't know how to plot the fractal, I'm not sure how to handle more roots.

Could you help me please?

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Nov 29 '15 at 21:04
  • $\begingroup$ You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful $\endgroup$ – Michael E2 Nov 29 '15 at 21:04
  • 5
    $\begingroup$ Have you searched on this site? Have you seen this and other related posts? $\endgroup$ – Michael E2 Nov 29 '15 at 21:06
3
$\begingroup$

Here is a simpler ListDensityPlot version using FixedPoint and avoiding indeterminate values by choosing a step size which skips 0 + 0 I. It is also much faster by mapping over precomputed coordinates.

ListDensityPlot[Arg @ FixedPoint[NewtonRaphsonStep, #] & /@ 
   Table[i + j I, {j, -2., 2., 0.011}, {i, -2., 2., 0.011}], 
     ColorFunction -> "Rainbow"]

enter image description here

$\endgroup$
  • $\begingroup$ Looks quite like this answer: mathematica.stackexchange.com/a/100055 ;) $\endgroup$ – Michael E2 Nov 29 '15 at 22:06
  • $\begingroup$ Oh, thanks, the link also answers the question how to plot z^4 etc. $\endgroup$ – eldo Nov 29 '15 at 22:15
  • $\begingroup$ I'm still trying to decide if it's a duplicate. With new users, I like to give them a chance to respond before I vote. $\endgroup$ – Michael E2 Nov 29 '15 at 22:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.