2

I wrote a mandelbrot set and I have read about the julia set that it's very similar but what is the relationship exactly? Can I use the mandelbrot formula to draw a julia set? What is the starting parameter? Read my code for a mandelbrot set:

     function complex_iterate($re,$im)
     {
           $re=strval($re);
           $im=strval($im);
           $zisqr = $zrsqr = $iter = $zIm = $zRe = "0";
           bcscale(50);

           while (floatval(bcadd($zrsqr,$zisqr)) < 4
               && $iter < $this->iterations
           )
           {
                 $zIm = bcmul($zIm,$zRe);
                 $zIm = bcadd($zIm,$zIm);
                 $zIm = bcadd($zIm,$im);
                 $zRe = bcadd(bcsub($zrsqr,$zisqr),$re);
                 $zrsqr = bcmul($zRe,$zRe);
                 $zisqr = bcmul($zIm,$zIm);
                 ++$iter;
            }
            return $iter;

I'm not sure what it means mandelbrot set is iterate for z and julia set is iterate for c? Do I need to change the code at all?

Update: I changed my code but it doesn't work. My idea is to start with $re and $im instead of 0:

    $zisqr = $zrsqr = $iter = 0;
    $zIm=$im;
    $zRe=$re;
    $re="-0.7";
    $im="0.27015";

Update 2: I forgot this:

    $zrsqr = $zRe*$zRe;
    $zisqr = $zIm*$zIm;
Micromega
  • 12,486
  • 7
  • 35
  • 72

1 Answers1

1

As I see you are new to Mandelbrot and Julia here are some definitions to see the relationship.

  • Mandelbrot map: the map you calculate and visualize graphically
  • Mandelbrot set: those points on the map that go to infinity (which you usually paint black. Those shiny colored parts on the usually displayed Mandelbrot pictures are not part of the Mandelbrot set)
  • Continous map: where points on the set lies next to each other (you can walk the whole map by starting from any point)
  • Island map: where points on the set lie isolated (you cannot walk the whole map from a starting point)

There is only one Mandelbrot set and there are infinite Julia sets and some definition says the Mandelbrot set is the index set of all Julia sets.

In other words: you can calculate a Julia set from any point within a certain limit (if you take large values the result might be empty, though). If your chosen point is not part of the Mandelbrot set (it is not a black pixel when visualized), the resulting Julia set will contain islands. However if you choose a point that is part of the Mandelbrot set (it is a black pixel when visualized) the resulting Julia set will be contiguous.

karatedog
  • 2,508
  • 19
  • 29
  • Thanks, but I'm so new to mandelbrot set but it says also the formula is the same like julia set? Basically mandelbrot set is useless and julia set, too. I just do it for fun. – Micromega Dec 18 '12 at 11:47
  • I wrote some times ago a little bit detailed answer about Mandelbrot. (http://stackoverflow.com/questions/9253208/having-trouble-calculating-mandelbrot-set-iterations/9941874#9941874) There is no real difference between Mandelbrot and Julia, just look at JasonD's comment. – karatedog Dec 18 '12 at 16:21
  • Success. I got my julia-set but it's not centered? I updated my question. Do you know why? Here is my example: http://www.phpdevpad.de/index.php?id=190. – Micromega Dec 18 '12 at 16:25
  • Julia sets will not be always symmetric as Mandelbrot will, and they are not always centered, they are much more chaotic. Anyway, being _centered_ is just a point of view, you can adjust your parameters and the actual rendering might look like it is centered. – karatedog Dec 18 '12 at 16:30
  • I tried to adjust them but it doesn't work? I'm not able to make it centered. This is why I asked about start values in my initial question. – Micromega Dec 18 '12 at 16:36
  • There is no magical, one-size-fits-all parameter to make every Julia set centered because they can look totally different, you can only make it by experimenting. Even the same Julia set with different iteration numbers (say, from 5 to 50) will look different (to make it visual: every version will occupy different pixels on your screen). – karatedog Dec 19 '12 at 12:49