How to calculate and plot the Buddhabrot image


The Buddhabrot is a distinctive fractal image which is so-named because it resembles the iconic image of Buddha seated in meditation. The algorithm which renders it was originally conceived by Melinda Green in 1993 and is a subtle variation of the one which is used to graphically depict the Mandelbrot Set.

As in Mandelbrot's method, the Buddhabrot is created by subjecting points z0 in a chosen region of the complex plane to repeated iterations of the mapping:
z → z2 + z0
where z initially starts at 0. However, whereas the Mandelbrot image is obtained by colouring points according to how many iterations it takes for them to diverge, the Buddhabrot colours points according to how many times they were visited in the course of mapping the divergent points. The algorithm can be summarised as follows:

For each point z0 in a chosen region of the complex plane (which is centred on the origin), perform the Mandelbrot map to see if it is a divergent point, i.e. moves outside a specified distance R0 from the origin within a maximum number of iterations (say, 1000).

For each of these divergent points, z0’, determine the set of values {z} it becomes by repeated application of the Mandelbrot mapping process, up until the point at which it diverges (i.e. moves beyond a distance R0 from the origin). For each of the values z in the set {z}, add 1 to a counter, HitCounter(z).

HitCounter(z) records how many times each point z in the complex plane was visited in the course of mapping the entire set of divergent points.

We then colour the complex plane according to the magnitude of the HitCounter(z) values. To do this, we define a function Colour(q) that maps HitCounter(z) to one of a set of chosen colours. For example:

Define: q = HitCounter(z) / Max {HitCounter(z) }
For 0 < q < 0.2, let Colour = Red
For 0.2 ≤ q < 0.4, let Colour = Magenta
For 0.6 ≤ q < 0.8, let Colour = Blue, etc.

We then simply plot these colours as a function of z using our favourite graphics package. One detail is that the image needs to be rotated by 90° clockwise to ensure the Buddha-like image is correctly oriented. This is done simply by rotating the coordinate axes at the end of the calculation.

The main difficulty with the Buddhabrot rendering is that it requires many more points to be processed than for the standard Mandelbrot image, hence it is far more computationally demanding. Whereas we can generate a reasonably good Mandelbrot image by performing the iterative mapping process on a 700x500 matrix of points, the Buddhabrot requires a far greater resolution than this (at least a 100 times). Clever algorithms have been developed to significantly cut the run time by careful random selection of the points, choosing points which tend to contribute the most interesting orbits (i.e. paths that touch many points before they diverge). However, these algorithms inevitably introduce distortion into the image, and so the only sure-fire way to obtain a pure Buddhabrot is to crunch the numbers and be patient.

The following shows how the algorithm to calculate HitCount(z) may be implemented in a high level computer language (C++, VisualBasic, etc.)

Set:
R0 = 5 (for divergence test)
iterLimit = 1000 (maximum number of iterations per point)
N = 100 (number of randomly generated points per pixel)

Define an array storedPath[k] that will hold the coordinates of the points on a divergent orbit, and initialise:
storedPath[k] = (0,0) for k = 1 to IterLimit

Define a grid of points (X0,Y0) in the complex plane. Each of these points is considered to lie at the centre of a cell that maps to a single pixel in the diagram that will be plotted. For example, X0 and Y0 may range from -5 to +5 in increments of 0.01.

Define a matrix, HitCount(X0,Y0), that will hold the number of times each cell, centred on (X0,Y0), is visited in repeated mapping of the divergent points. Initialise: HitCount(X0,Y0) = 0 for all points (X0,Y0).

For each cell centred on the point (X0,Y0):
Randomly select N points (x0, y0) that lie within this cell.

For each of the points (x0, y0):
Initialise:
x=x0
y=y0
iterCount = 0
hasDiverged = false

While hasDiverged = false and iterCount < iterLimit

Set:
a = x
b = y

Calculate:
x = a2 - b2 + x0
y = (2 × a × b) + y0
r = √(x2 + y2)

If r > R0 Then
Set: hasDiverged = true
End if

Add 1 to iterCount
Set: storedPath[iterCount] = (x,y)

End while

If hasDiverged = true:
For k = 1 to iterCount
Set: (x,y) = storedPath[k]
Determine the cell (X,Y) which contains the point (x,y)
Add 1 to HitCount(X,Y)
Next k
End if

Next (x0, y0)
Next (X0, Y0)


Since I first created this page four years ago (in 2012), I have learned that the artist and mathematician István Aggott Hönsch has also undertaken considerable research into the mathematical entity underlying the Buddhabrot. He goes into the theory in some detail in his article http://vixra.org/abs/1604.0392 and concludes that the Buddhabrot is just one of an infinite number of pareidolic figures which may be obtained by placing restrictions on the divergent orbits generated using Melinda Green's original algorithm.

Aggott Hönsch's findings concord with my own experiments, which have shown that some interesting variations on the Buddhabrot image can be obtained by limiting the set of divergent orbits to those having a length (before divergence) satisfying a certain condition - for example, it is a prime number or simply a multiple of a specified integer. Aggott Hönsch has come up with a neat term for these incredibly detailed human-like images - anthropobrots - and exhibits some of the remarkable images he has obtained on his website: http://apeirography.com.

Further distortions to the Buddhabrot image can be obtained by tweaking the algorithm in other ways (for example, by perturbing slightly the mapping function). These distorted images I term Buddhabrot Mutants.

© James Travers 2012-16


Other articles

Keeping Leopard Geckos

Leopard geckos are one of the easiest exotic pets you can own and with care and attention these cute little reptiles can live up to twenty years.

Discover France

Some of the most enchanting towns and cities in Europe are to be found in France, a country with an incredible cultural and architectural heritage. The food's pretty good as well.

Best of French cinema

Discover the absolute best that French cinema has to offer, from eternal classics of the 1930s to today's auteur masterpieces.



Other things to look at


Copyright © frenchfilms.org 1998-2024
All rights reserved



All content on this page is protected by copyright