8
$\begingroup$

On the document of MandelbrotSetPlot, it said:

With ColorFunction->f, where f is a function, the argument of f is a real number in proportional to the number of iterates, and f must return color directives, such as RGBColor and Hue, or named colors, such as Red and Blue.

It seems to have only one argument. But an example uses the third argument:

enter image description here

So I tried evaluating

Reap[MandelbrotSetPlot[{-2 - 2 I, 2 + 2 I}, 
       ColorFunction -> ((Sow[{##}]; If[#1 == 1, 
                                        Black,
                                        RGBColor[(1 - #3)^2, (1 - #3)^3, 1 - #3]]) &)
       ]
     ]

enter image description here

and noticed that it has exactly five arguments. The first, second and third arguments are real numbers between 0. and 1., while the fourth is an integer and the fifth is a complex number.

I think the third argument is proportional to the number of iterations. What do the other arguments mean?


Update:

I think Mathematica just calculates the upper half of the Mandelbrot set.

Graphics[{PointSize@0, 
  Point[{Re@#, Im@#} & /@ 
    Reap[MandelbrotSetPlot[ColorFunction -> (Sow@#5 &)]][[2, 1]]]}]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ I think the statement in docs that: "ColorFunction->"name" is equivalent to ColorFunction->(If[#==1,Black,ColorData["name"][#]]&)." is not true. There should be #3 not #. First and the second arguments are coordinates. Here they are in (0,1) interval because ColorFunctionScaling is True. $\endgroup$ – Kuba Nov 29 '14 at 9:28
  • 1
    $\begingroup$ The fourth argument is 1 if the point is in the Mandelbrot set, and 0 otherwise. $\endgroup$ – alephalpha Nov 29 '14 at 10:19
7
$\begingroup$

Just to summarize the comments by @alephalpha and @Kuba for

MandelbrotSetPlot[{xmin + ymin I, xmax + ymax I}, ColorFunction -> (f[#,#2,#3,#4,#5]&)]
  1. Slot #1 corresponds to the horizontal coordinate x.

    • If ColorFunctionScaling -> True, then #1 ranges from 0 to 1 as x ranges from xmin to xmax.
    • If ColorFunctionScaling -> False, then #1 ranges from 0 to 1 as x ranges from 0 to 1. The value of #1 is 0 for x <= xmin and is 1 for x >= xmax.
  2. Slot #2 corresponds to the vertical coordinate y.

    • If ColorFunctionScaling -> True, then #2 ranges from 0 to 1 as y ranges from ymin < 0 to ymax < 0. However, #2 ranges from 1 to 0 to ymax as y ranges from ymin < 0 to 0 to ymax > 0, unless ymax > -ymin, plus yet more bizarre conditions ...
    • If ColorFunctionScaling -> False, then #2 ranges from 1 to 0 to 1 as y ranges from -1 to 0 to 1. The value of #2 is 1 for y <= ymin and is 1 for y >= ymax.
  3. Slot #3 is roughly proportional to the log of the number of iterations.

    • If ColorFunctionScaling -> True, then #3 ranges from 0 and 1, logarithmically.
    • If ColorFunctionScaling -> False, then #3 ranges from 0 to MaxIterations (default 100), logarithmically.
  4. Slot #4 is 1 if the point is in the Mandelbrot set, and is 0 otherwise.

  5. Slot #5 is apparently the final iterated value of complex iterate z, whose absolute value exceeds the EscapeRadius (default 2). Although, the magnitude of this z is much greater than the escape radius...

$\endgroup$
  • $\begingroup$ I think Slot #2 corresponds to the absolute value of the vertical coordinate. The Mandelbrot set is symmetric, so Mathematica might just calculate the upper half. $\endgroup$ – alephalpha Jan 23 '15 at 5:59
  • $\begingroup$ Ahhh, thanks for that. The Abs may explain the bizarre behaviour. @Kuba: thanks for the edits! I will use them in future. $\endgroup$ – KennyColnago Jan 30 '15 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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