What is the BuddhaBrot after all?
Atualizado em:
The Buddhabrot is weird. I don’t understand it.

Although there is not much ground to cover until we get to the BuddhaBrot, we need to first understand and learn how to simulate the so called Mandelbrot set. Which is interesting by itself. There is much to be said about its connections with other sets, fractal theory, and even chaos in general, particularly the relation to the logistic map. I will not, however, talk about many of those, as I said, I do not understand the BuddhaBrot. Nevertheless, I feel compelled to it. There is something to be said about the other driving forces of a mathematician. Beauty, sometimes, is enough.

The Mandelbrot Set

We shall then start at the Mandelbrot set. This is nothing more than a set of complex numbers bounded by some rule. This is done in the same way we would do to define a circle in the plane, that is, defining a set such as
\[\{z \in \mathbb{C} : |z| \leq 1\}\]that represents the unit circle. In a similar sense, the Mandelbrot set is defined as the set of complex numbers \(c\) for which the sequence \((z_n)\), defined by
\[z_{n+1} = z_n^2 + c\]is bounded. That is, if you iterate on \(z_k\), you will get an finite number when \(k\) goes to infinity. If you then plot this set of points you end up with what we call the Mandelbrot set.

There are some considerations if we wish to simulate it. We, of course, do not iterate every point of the grid to infinity. Among those arbitrary points of the grid we choose to iterate, we say that they diverge if, after a certain threshold, they have an absolute value greater than 2. Selecting a threshold is a matter of art and intent. We also choose to color the set (mainly its borders) by how many iterations it took to ‘diverge’. That is, for those that don’t diverge, we will plot the threshold value, and for the rest, we will plot the number of iterations it took to surpass the radius defined previously. If you’re anything like me, you already defied some definitions here: What happens if we use something other than \(z^2\)? What is the set appearance for different constants \(z_0\)? I won’t explicitly answer those, but the GIF nearby illustrate one of this situations. Feel free to explore, the code necessary to do it is in Mandelbrot. Here are some close-ups of the Mandelbrot set.

The amount of programming it takes to simulate the Mandelbrot is minimal. But somehow, this is a very interesting mathematical object. Mainly, we will discuss it as a fractal. A fractal is a set with a fractal dimension. Well, that doesn’t help very much. How can something have a fractal dimension? We know about lines with dimension 1, and we know about planes with 2 dimensions. How can some objects have 1.4 dimensions? Well, first, we need to be sure about the meaning of a line having 1 dimension or the plane having 2. We could talk about the orthogonal basis, but that’s too sophisticated. Another way to define dimensions is using self-similarity.

If we take a line and divide it into 2 equal parts, we get 2 lines. Each of those can be scaled by 2 to get the original line. If we, instead, divide it into 3 parts, we should scale each of those parts by 3 to get the original line. That is, diving by \(N\) demands a scale of \(N\). What about a square? We now can’t divide the square by 2 or 3 self-similar parts. But we can divide it by 4, and each of those squares must be scaled by 2 to get the original square. Generally, we can divide by \(N^2\) parts, and each of those must be scaled by \(N\) to get the original square. This introduces the idea that those objects have different dimensions. Dimension is simply the exponent of the scale factor. That is, a line is of dimension 1, a square is of dimension 2. What about the following set?

This is the Serpiensky Triangle, a fractal of dimension 1.58. Actually, producing this set is very interesting. We start with 3 points in the complex plane. We then choose a random point on the plane and plot it. We select one of the 3 points at random and plot the point in the middle of the line between the random point and the chosen point. Repeat this process. Somehow, this generates this fractal.
How do we calculate its dimension?
\[\text{dimension} = \frac{\log(\text{#self-similar pieces})}{\log(\text{scale factor})}\]In this case
\[\text{dimension} = \frac{\log(3)}{\log(2)} = 1.58\]The Mandelbrot set has dimension 2 somehow, this is just so interesting. About its borders, if you search for an infinite dive into the details of the Mandelbrot, you will find an infinitude of videos. Otherwise, if you wish to test this fact and focus on any specific area of the border, no matter how small (respected the limits of the computer, of course) you can use the code provided. You will find more and more details for a nausiating and fascinating amount to whatever interval you end up in.
The Buddhabrot
We have so far overlooked a set of numbers complementary to the Mandelbrot set. This is the Buddhabrot. This set is defined by the set of complex numbers \(c\) for which the sequence defined by
\[z_{n+1} = z_n^2 + c\]diverges. We won’t plot the set, however. What is the path of the diverging points? The density of those paths is represented in the Buddhabrot visualization. In this way, we simply get random points in the complex plane and iterate them. If they diverge, we plot the path they take. There are some optimizations to be made, like excluding points that are obviously inside the Mandelbrot set. The code to do this is in Buddhabrot and the plot file is the Plot. There is no secret to this part.
Some Artistic Liberties
Clearly, a 2D array with numbers doesn’t transform itself in these cool pictures simply plotting the numbers. You can simply plot it with a nice colormap, this will be fine. However, if you’re trying to add a little more flare to the image, here’s what you can do: Firstly, get comfortable with the variables in the generation process, those are going to define which characteristics will be clear in your plot. Mainly, worry about the quantity of points you’re using and how many iterations you’re recording. As the points diverge, if you record long paths, you will see some semi-stable orbits highlighted. If you record short paths, you will get a more blurry image.

The second step is composing. We will generate an RGB image composing the three channels, each with any characteristic of the Buddhabrot you choose to highlight. Then, in any editing software, you will superpose those images and merge them with one of the many blending modes. With this, you can create any of these images.

I do not understand the Buddhabrot, but look at it. This time, beauty is enough.