# The Mandelbrot Set as seen on the Complex Plane

I nearly forgot to post before bed T_T

I made this for a school project, but now that it is graded and fully optimized, I want to post it here ^..^

This uses a quite inefficient method for rendering the Mandelbrot set, in Python Turtle. It almost works like a printer. It took me eight days from when I started to complete the very first version, and then took me until yesterday to fully optimize it (It used to take an hour and a half to finish running T^T). It took my teacher's old iPad **4 minutes** to render it in its current state!

Please enjoy .^ ^.

EDIT: Wow, this is on the hot tab. Everyone, thanks. ^ ^"

Not bad. It's very satisfying to be honest. XD

I can tell that you are rendering on the complex plane and that you are using z=z^2+c and iterating n times until z is greater than index n of the MAG list and using setting the color to color n from the COLOR list, but do you by any chance know how the fractal itself works? I'm guessing it has something to do with the exponentiation of complex numbers, but I'm not completely sure. Also, I had no idea that Python could handle complex numbers! I know JavaScript can't without an external library (if you try to find the square root of -1, it returns "NaN"). By the way, this would also be great for the "learn" section if you know how the fractal itself works.

Think of it this way: Each and every point on the complex plane has an individual, unique Julia Set, right? Well, those Julia Sets are like a bunch of mirrors: Reflections, of reflections, of reflections, etcetera etcetera.

(Sorry, I am not good with words _ _ This is difficult to explain)

Although before I go on, I must ask, what do you mean by "works?" Do you mean, why does it have such complicated patterns despite only changing the initial value by such minuscule amounts? Or, do you mean, why does it form any pattern at all?

Unfortunately, that is pretty much one of the only things I do not fully understand about the Mandelbrot Set. Although, now that you've mentioned it, I am pretty sure it has something to do with Complex Exponentation (or something equivalent).

Really sorry, but I do not know the exact answer to this..

`i^(a+bi)=(cos(a*pi/2)+i*sin(a*pi/2))(cos(b*i*pi/2)+i*sin(b*i*pi/2))`

. Also, `x^(a+bi)=x^a(cos(b*ln(x))+i*sin(b*ln(x)))`

. I also have a formula for any logarithm if that may help, but it is VERY long.If you don't mind, I'd love to see the formula for any log! Only if it is not too much of a burden, though.

`log_(a+bi)(c+di)=((log(c^2+d^2))/2+(i*arccos(c/(10^(log(c^2+d^2)/2)))/ln(10)))/((log(a^2+b^2))/2+(i*arccos(a/(10^(log(a^2+b^2)/2)))/ln(10)))`

I said it was long... By the way, `log_(a+bi)(c+di)`

means the log, base `a+bi`

of `c+di`

.Thank you! ^__ ^*

wow, this is very amazing and satisfying! To be honest, I could watch this all day on repeat.

(If you can, do not feel pressured [> _ < "])

Homework right now but in an hour or so...

I'll comment it

Wow! You are very talented!

omg

This is a cool program, could you explain how it works? I'm familiar with the equation f(z) = z^2 + c or something like that, but I'm not sure I quite understand what's happening in this program.

Since you already know the equation, I assume you know about complex numbers and the complex plane.

The program sets the turtle to the top left of what is, in terms of the complex plane, a 2 by 4 section around (0, 0i). Then, it moves the turtle horizontally to the other side of the plane, and does that over and over again, moving it down a row every time.

For every point, it iterates the equation until it finds that the iteration number's corresponding index in the MAG list is less than the absolute value of z. Once it finds that, it breaks out of the loop. This saves a massive amount of time, as before it was finding the optimal color, but still kept checking for a better one. Also, since the majority of the points it will check will be identified quickly (since they escape to infinity much faster), this cuts even more time off of the total render time.

If you have any further questions, please do let me know; I'd be delighted to help out.

Please pardon any bad grammar.. Σ( > _ < ; )