This python package is for people who want to learn and explore the wonderful world of brots. Provides an api that allows rapid experimenting and visualization. Brots are generalization of Mandelbrot that takes a generic Mandelbrot equation. This library makes every part of the Mandelbrot equation as a parameter offering extreme flexibility to override or use the default implementation.
An equation means nothing to me unless it expresses a thought of God. — Srinivasa Ramanujan
A Standard Mandelbrot equation,
To get started,
pip install brotground
- Light weight, well documented, easy to understand code base
- Extremely modular, Replace any module with your own definition
- Flexible, Comes with good defaults but can be overridden
- Zero Effort Setup, Includes binder environment to start experimenting without any setup
- Minimal Dependency, Numba for iteration and Matplotlib for rendering
-
Getting started with Mandelbrot:
Goes over the basics of the library and how to use it to generate different brots.
Click the launch binder and navigate to nbs/all_brots.ipynb -
Juliaset:
Goes over different Juliasets and how to generate them.
Click the launch binder and navigate to nbs/julia_sets.ipynb
You can start using the API as shown below,
from brotground import MandelBrot, MultiBrot, UserBrot, JuliaBrot
from brotground.resources import tricorn_brot_equation, burning_ship_brot_equation
from brotground.renderer import StaticRenderer
matplot_renderer = StaticRenderer() # Initialize the renderer
mandel = MandelBrot() # Initialize Mandelbrot
mandel.iterate_diverge(max_iterations=25) # Run the iterate diverge loop
matplot_renderer.plot(mandel, cmap="RdGy") # Plot the resultsWe can further zoom in on the coordinates and iterate-diverge on those coordinates,
mandel.set_boundaries((-0.02, 0.02), (0.780, 0.820)) # Zoom in on the coordinates
mandel.iterate_diverge(max_iterations=100)
matplot_renderer.plot(mandel, cmap="plasma")will render like below,
By changing each part of the equation you can get a range of generation. Generalizing the above Mandelbrot equation to k, we get Multibrot where,
For a K value of 3 we get a Multibrot rendered like this,
multi = MultiBrot()
multi.iterate_diverge(max_iterations=15)
matplot_renderer.plot(multi, cmap="binary")A Tricorn brot is expressed as,
tricorn = UserBrot(brot_equation=tricorn_brot_equation)
tricorn.iterate_diverge(max_iterations=15)
matplot_renderer.plot(tricorn, cmap="RdYlBu")A Burning ship brot is expressed as,
burning_ship = UserBrot(brot_equation=burning_ship_brot_equation)
burning_ship.iterate_diverge(max_iterations=15)
matplot_renderer.plot(burning_ship, cmap="copper")JuliaBrot is an extension to Mandelbrot, in which instead of initializing Z and C as 0 and complex(i, j) respectively we initialize Z as complex(i, j) and C as a function f(i, j) based on the julia set that we want to generate.
For example, to generate a frost fractal julia set we initialize C as complex(-0.7, 0.35) and this generates the following,
julia = JuliaBrot(julia_name="frost_fractal")
julia.iterate_diverge(max_iterations=100)
matplot_renderer.plot(julia, cmap="inferno")julia = JuliaBrot(julia_name="galaxiex_fractal")
julia.iterate_diverge(max_iterations=100)
matplot_renderer.plot(julia, cmap="inferno")






