This project creates an animated GIF of the Mandelbrot set with increasing precision in each frame.
For the quadratic map zₙ₊₁ = zₙ² + c, where z is a complex number and c is a complex number as a constant, there exists a set of values of c such that the value of z remains bounded as the map is applied.
The set of values c that keep z bounded is known as the Mandelbrot set. When the Mandelbrot set is plotted on the complex plane (real component of c on the X axis and imaginary on the Y axis), a beautiful fractal pattern appears.
This project is built with uv. If you don't have UV, install it using the following command:
curl -LsSf https://astral.sh/uv/install.sh | shTo create a virtual environment and install the necessary packages, run:
uv syncInside main.py, there are a few variables to set:
MAX_PRECISION: Precision of the plot in the last frame of the GIFX_MINMinimum X value (minimum value of the real component)X_MAXMaximum X value (maximum value of the real component)Y_MIN: Minimum Y value (minimum value of the complex component)Y_MAX: Maximum Y value (maximum valeu of the complex component)STEP_SIZE: Controls the resolution of the plotIMAGE_PATH: Path to save the animated plot to.
Once these variables are set, it's ready to rip. Run the main loop with the following command:
uv run main.pyYes, this project is entirely human-written. It is a zero-AI weekend project.
