The Mandelbrot set is the set of complex numbers
The algorithm is based on the function
int mandelbrot(...)
which returns the number of iterations it takes to reach the critical "escape" condition. Thus, this function is run for each pixel of the image and, depending on the result of the function, each pixel is colored in shades of gray.
git clone https://github.com/amamdemous/mandelbrot_set
cd mandelbrot_set/
make
Run the executable with width, height and maximum number of iterations.
Example:
./mandelbrot 1024 1024 1000
For the sake of simplicity output image is in .ppm format which can be viewed through most image viewers
- https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set
- https://en.wikipedia.org/wiki/Mandelbrot_set
- There is a good video on 3Blue1Brown's channel
- Numberphile 's video
- PPM image format specification