Looking for trainings on python I decided to draw the mandelbrot set using a script. Drawing it wasn't too complicated so I decided to use color and I discovered the smooth coloring algorithm. Using this question I was able to render something really beautiful and similar to this one.
To achieve that I set up a gradation color palette using three "steps" : From dark blue to light blue, then light blue to yellow and finally yellow to dark brown. The overall image is perfect.
Problem comes when I try too zoom in. Let's take the example of this area. When I'm at this level of zoom, my script doesn't draw dark blue anymore. I think I mis coded something because whereever you see dark blue on the wikipedia image, I have dark brown (so a color near the end of my palette). When I first thought about this I told myself if the pattern is going back to the original one, then it should use the same colors cause escape time should be the same.
So, was this coloring configured in the palette or is there something about escape time I didn't understand ?
Here is the code I use for the coloring :
def color_pixel(n, z):
smoothcolor = n + 1 - math.log(math.log(abs(z)))/math.log(2)
f = smoothcolor/iterate_max
i = int(f*500)
color = palette[i]
return color
500 is the number of colors in my palette (len(palette)-1
).
z the value of z when it escaped over 10.
I use 100 as the max iterations but same results with a higher value.
Thanks !