Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => Mandelbrot & Julia Set => Topic started by: kronikel on October 03, 2013, 04:36:01 AM




Title: Coloring points inside the Mandelbrot set
Post by: kronikel on October 03, 2013, 04:36:01 AM
I'm sure this has been done, and there are probably other ways to do it also, but I've never found any info on how to do it.
Points that are inside the mandelbrot set are usually colored black. But that's boring! Here is an easy way to get a value for ALL points.
Just keep track of the distance that z moves while iterating z = z^2+c
Then use the total distance each point traveled to look up a color.
(http://i200.photobucket.com/albums/aa143/kronikel/mainset.jpg)

The minibrots that once all looked the same have a little more character
(http://i200.photobucket.com/albums/aa143/kronikel/minis.jpg)

There are two other differences with using distance instead of iteration count.
With the usual iteration count, you will see bands of a certain value, so you end up with a solid color in that area. But with distance the values you get are a little more unique.
The other advantage is with points in the set that would escape to infinity but don't because your bail out value wasn't high enough.
Normally these would be solid colored like points that are a part of the set, but when using distance you get some pretty interesting detail.

This picture will demonstrate both. On the left is iteration based coloring and on the right is distance based. The bail out is 500 iterations for both.
(http://i200.photobucket.com/albums/aa143/kronikel/compare.jpg)

The only problem I ran into is that the distances found for points inside the set vary greatly from the points outside the set. This would make it hard to do a straightforward lookup into a color table.
There are a few easy ways to fix this.
You can multiply the distances found of points in the set by one number and points outside the set by another number. Something like ~5 for outside points and 100+ for inside points.
Another thing you can do is to only apply the distance based coloring to points that reach the bail out, then color the rest of them like normal. This can actually be better for some images. Because the distance based method gives more unique values, you can sometimes have too much contrast and a chaotic look in areas where the distances change quickly.
Here is a hybrid using distance and iteration based coloring
(http://i200.photobucket.com/albums/aa143/kronikel/hybrid.jpg)
This way shows less detail but has smoother transitions between different areas.

One last picture. Purely distance based coloring.
(http://i200.photobucket.com/albums/aa143/kronikel/big.png)

Feel free to post some pics if you have ever made fractals like this, or know other ways to give value to the points inside the set. I'd like to see how it looks with other types of color palettes.


Title: Re: Coloring points inside the Mandelbrot set
Post by: Kalles Fraktaler on October 03, 2013, 07:31:00 PM
Cool!
I did something similar before I started exploring the pertubation method of rendering mandelbrot fractals.
But with pertubation it seemed that the distance get instable and chaotic, but I haven't investigated that much.

How do you calculate the distance?
Like sqrt(zr*zr+zi*zi) or sqrt((zr-c)*(zr-c)+(zi-c)*(zi-c)) ?


Title: Re: Coloring points inside the Mandelbrot set
Post by: kronikel on October 03, 2013, 11:23:23 PM
it's the distance between z and z^2+c on every iteration
so something like sqrt( (oldZR - zr)^2 + (oldZI - zi)^2 )
in other words, how much the complex point moves after each iteration is added up cumulatively to give a final distance that the point traveled


Title: Re: Coloring points inside the Mandelbrot set
Post by: lkmitch on October 04, 2013, 07:58:46 PM
Neat idea!  I generalized it a bit to color by total angle turned through (sum of angles between z and zold).  Here is a Mandelbrot zoom using that idea.


Title: Re: Coloring points inside the Mandelbrot set
Post by: kronikel on October 17, 2013, 01:48:41 AM
Nice! I imagine there are probably other ways to get an interesting value for each point also.

I've been trying to find a way to make it fade smoothly between colors.
The distance method gives non integer values so it seems like you could do it similar to the continuous smoothing method n - log(log(modulus)) / log(2) if I remember correctly... something like that.
The problem is that where two bands meet, the high values of one band are against the low values of the next. So it is basically the exact opposite of "continuous"
I haven't looked much into it but it seems like you could flip every other band and get a nice look.


Title: Re: Coloring points inside the Mandelbrot set
Post by: claude on October 17, 2013, 10:07:24 PM
I wrote something about interior coordinates :

http://mathr.co.uk/blog/2013-04-01_interior_coordinates_in_the_mandelbrot_set.html

You only need to consider periods p where |z_p| reaches a minimum, dramatically reducing the effort required.

Not sure if it's possible to adapt it to perturbation technique (it probably is, but I haven't done the maths).


using b as hsv gradient

(http://mathr.co.uk/misc/2013-04-01_mandelbrot_interior.png)

using b as image coordinates (plus exterior distance estimation)

(http://mathr.co.uk/misc/2013-04-02_moondelbrot.jpg)

using b as image coordinates, video

http://mathr.co.uk/misc/2013-04-02_mandelbrot_mandelbrot.ogv


Title: Re: Coloring points inside the Mandelbrot set
Post by: Dinkydau on October 17, 2013, 10:46:46 PM
Nice image!


Title: Re: Coloring points inside the Mandelbrot set
Post by: Nahee_Enterprises on October 18, 2013, 03:13:44 AM
    I wrote something about interior coordinates :
            http://mathr.co.uk/blog/2013-04-01_interior_coordinates_in_the_mandelbrot_set.html (http://mathr.co.uk/blog/2013-04-01_interior_coordinates_in_the_mandelbrot_set.html)
    You only need to consider periods p where |z_p| reaches a minimum, dramatically reducing the effort required.
    Not sure if it's possible to adapt it to perturbation technique (it probably is, but I haven't done the maths).
    using b as hsv gradient
            http://mathr.co.uk/misc/2013-04-01_mandelbrot_interior.png (http://mathr.co.uk/misc/2013-04-01_mandelbrot_interior.png)
    using b as image coordinates (plus exterior distance estimation)
            http://mathr.co.uk/misc/2013-04-02_moondelbrot.jpg (http://mathr.co.uk/misc/2013-04-02_moondelbrot.jpg)
    using b as image coordinates, video
            http://mathr.co.uk/misc/2013-04-02_mandelbrot_mandelbrot.ogv (http://mathr.co.uk/misc/2013-04-02_mandelbrot_mandelbrot.ogv)

I like the use of a photograph used to build the interior!!!    :D
 


Title: Re: Coloring points inside the Mandelbrot set
Post by: xenodreambuie on November 11, 2015, 05:03:58 AM
I wrote something about interior coordinates :

http://mathr.co.uk/blog/2013-04-01_interior_coordinates_in_the_mandelbrot_set.html

You only need to consider periods p where |z_p| reaches a minimum, dramatically reducing the effort required.

Not sure if it's possible to adapt it to perturbation technique (it probably is, but I haven't done the maths).


This is the only reference I've found so far that gets the correct angle for all interior points. Without testing it directly, it appears to generalize to higher degrees of zn+c, but not so well to general rational formulas. Is that possible? In particular, I suspect the criteria for |b|<1 isn't right in the general case.

The method as is doesn't quite suit my purposes, which is to integrate into an existing method for finding the convergent cycle. That is, iterating the first critical point to z1, and if it doesn't escape to infinity, iterating the second critical point until it approaches z1, then iterating again to find the cycle length. The problem then is that we don't know which point in the cycle is the one to use for the angle. I tried calculating z' for each point in the cycle and choosing one with |z'|<1, which gives the right result for the largest cardioids but not the smaller ones. It even shows some improvements with the general rational case, but often spoiled by a discontinuous disc due to |z'|<1 not matching the actual regions.


Title: Re: Coloring points inside the Mandelbrot set
Post by: xenodreambuie on November 14, 2015, 10:12:26 PM
I have found a reasonable solution for a general convergent Mandelbrot method.

To recap the general method:
Iterate the first critical point until it either escapes to high bailout or reaches max iterations. If not escaped, call the point z1.
Iterate the second critical point (possibly same as the first) until it converges to z1.
Iterate z1 until it returns to z1, to find the cycle length.
That gives enough information to calculate the DE and potential.

To calculate the angle (for texture or field lines), the problem is that we don't know which point in the cycle corresponds to the "base region". I'm guessing that a good definition for the base region is the one with cycle length 1. This is true for zn+c but I don't know if one always exists in the general case or whether every cycle includes a region with cycle length 1. Even if not, it should be the region with the smallest cycle.

In the general case the only way to identify the attracting point of the base region would be some prior analysis, and I have no idea whether that is possible other than by brute force.

However, the simplest answer is to just find the point in the cycle with the smallest z and use that. It gives the correct result for zn+c, and pretty good results for a number of rational functions that I've tried, but not so good for some others.


Title: Re: Coloring points inside the Mandelbrot set
Post by: Adam Majewski on November 15, 2015, 08:17:43 AM
Interesting
do you have any images ?


Title: Re: Coloring points inside the Mandelbrot set
Post by: xenodreambuie on November 15, 2015, 10:16:19 AM
Here are examples using rainbow hues for angle. All the cardioids are correct for z4+c (up to a cycle length of 160 if I zoomed in that far.) The other example is (z3-1)/(z3+1)+c, which is all interior. Not all cardioids get their own center for the angle.


Title: Re: Coloring points inside the Mandelbrot set
Post by: therror on October 11, 2016, 06:37:42 PM
In this pictures (Multibrot set )exterior points are coloured with the escape time algorithm, colour of interior points is determined by period, brightness by distance estimation.


Title: Re: Coloring points inside the Mandelbrot set
Post by: therror on December 30, 2016, 06:16:00 AM
I am trying to use angle. Code with minimum |z| gives not correct result at high resolution.
Code:
  
    x2y2=x*x+y*y;
    if (x2y2<modmin)
    {
      modmin=x2y2;
      dzpmin=dzp;
      dzqmin=dzq;
    }


Title: Re: Coloring points inside the Mandelbrot set
Post by: therror on December 30, 2016, 06:20:00 AM
Code wih mininum p is more correct
Code:
    if (!dzpmin)
    {
      if (dzp*dzp+dzq*dzq<1)
      {
        dzpmin=dzp;
        dzqmin=dzq;
      }
    }


Title: Re: Coloring points inside the Mandelbrot set
Post by: therror on December 30, 2016, 09:34:19 AM
Combination is much better
Code:
    x2y2=x*x+y*y;
    if (x2y2<modmin&&dzp*dzp+dzq*dzq<1)
    {
      modmin=x2y2;
      dzpmin=dzp;
      dzqmin=dzq;
    }


Title: Re: Coloring points inside the Mandelbrot set
Post by: claude on December 30, 2016, 03:43:13 PM
.


Title: Re: Coloring points inside the Mandelbrot set
Post by: therror on March 30, 2017, 10:29:20 PM
Hi! I am trying to implement angle and interior distance estimation for z^n+c. The result is correct for case n=2, but at higher (positive and negative) powers both angle and distance much more than must be. (Maybe you saw it in my animations).  I think maybe second derivatives are incorrect or main formula for DE, because exterior DE is correct at any power. Help me,  please. What formulae for general case z^n+c?