# How to plot the Mandelbrot set

[CG]Maxime
55.1K views

## Julia Sets

Julia Sets also offer great fractals. The definition of the Julia sets is very similar to the mandelbrot set. As a reminder, the Mandelbrot set is the set of the complex numbers $c$$c$ for which the sequence ${z}_{n+1}={z}_{n}^{2}+c$$z_{n+1} = z_n^2 + c$ is bounded (${z}_{0}$$z_0$ is set to $0$$0$). While, the definition of the Julia sets is the numbers ${z}_{0}$$z_0$ for which the sequence is bounded, with $c$$c$ a constant value.

from math import log, log2
MAX_ITER = 80
def julia(c, z0):
z = z0
n = 0
while abs(z) <= 2 and n < MAX_ITER:
z = z*z + c
n += 1
if n == MAX_ITER:
return MAX_ITER
return n + 1 - log(log2(abs(z)))
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX