My 9-yo son thinks fractals are very exciting. We have been watching Youtube videos and reading stuff on the web together. And now we decided that we should play a bit with fractals ourselves and I found the clisk library and specifically this blog post, by the clisk author, on how to use it for rendering the Mandelbrot set. The most basic example given in the blog post:
(show (viewport [-2 -1.5] [1 1.5]
(fractal
:while (v- 2 (length [x y]))
:update (v+ c [(v- (v* x x) (v* y y)) (v* 2 x y)])
:result (vplasma (v* 0.1 'i))
:bailout-result black
:max-iterations 1000)) 1024 1024)
That’s cool. The classic Mandelbrot is very mysterious and fun to investigate. But we would like to explore some other fractals, including some other powers of z
for the Mandelbrot. The fractal
function in clisk is versitile enough to allow that, but my experience with math stops me from figuring out how. The function being iterated over is in the :update
key:
:update (v+ c [(v- (v* x x) (v* y y)) (v* 2 x y)])
I can sort of see c + z²
there, if I squint, but fail to make the necessary connection. Any mathy people here that could help my son and my figuring this out? A first question is how to make it render c + z³
. But really, I’d like some help to understanding what the connection is so that we can start rendering fractals at will here.
Thanks in advance!