A script to display the Mandelbrot set with python
The mandelbrot function takes in a real and imaginary part of a complex number c, as well as a maximum number of iterations to perform. It then iteratively computes the sequence
The main code sets the size of the image (columns
and rows
) and creates an array result
to store the iteration counts for each point in the complex plane. It then loops over each point in the plane, calls the mandelbrot
function to compute the iteration count for that point, and stores the result
in the result array. Finally, it generates an image of the result array using the imshow
function from matplotlib.
- Clone the repo
or download the file
git clone https://github.com/iion91/mandelbrot.git
- Install dependencies
pip install numba pip install numpy pip install matplotlib
- Start the script
python mandelbrot.py