AI authored to showcase ironpad capabilities.
The Mandelbrot set is the most famous fractal in mathematics. It is defined as the set of complex numbers c for which the iteration
z_{n+1} = z_n^2 + c, \quad z_0 = 0
remains bounded (|z| \le 2) as n \to \infty.
For each pixel we map its position to a complex number c, then iterate the formula above. If |z| exceeds 2, the sequence will diverge — the number of iterations before escape determines the pixel's color. Points that never escape (up to our iteration limit) are colored black — these lie inside the Mandelbrot set.
The boundary is a fractal of infinite complexity: no matter how far you zoom in, there is always more detail.
This notebook uses rayon to compute pixels across all available CPU cores in parallel. Each row of the image is distributed to a separate thread via par_iter, providing near-linear speedup on multi-core machines.
Try modifying the zoom parameters to explore other interesting regions:
| Region | x range | y range |
|---|---|---|
| Elephant Valley | [0.25, 0.40] | [−0.10, 0.10] |
| Spiral | [−0.088, −0.086] | [0.654, 0.656] |
| Mini-brot | [−1.790, −1.780] | [−0.005, 0.005] |
| Lightning | [−1.26, −1.24] | [0.04, 0.06] |
Increase max_iter for deeper zooms to reveal finer detail. The fractal is infinitely deep — you are limited only by floating-point precision!