Assignment 2022-23
The Mandelbrot set
The Mandelbrot set is defined as the set of all complex numbers , for which the iterative scheme
is bounded, i.e.
It can be demonstrated that, if for some , , the iteration is
guaranteed to be unbounded, and thus . This yields a practical criterion to compute an
approximate Mandelbrot set , containing as all complex numbers for which the first iterations
remain inside the circle with radius 2 (centered at the origin), i.e. for which for all
.
The Mandelbrot set , or its approximation , is traditionally coloured black, while the other points, the points escaping outside the circle with radius 2 towards infinity, get a colour that indicates how fast they escape. Here is an example (from wikipedia):

Here is the challenge for you.
The Mandelbrot challenge
Take the complex numbers for which and , i.e. about the upper half of the figure above (the lower half is symmetric). Compute the approximate mandelbrot sets , and with pixel densities of 100, 500, and 2500 pixels per unit length. You may use the center of the pixels for the points . Time each of these 9 cases. The rectangle measures by , so you get images of pixels, pixels, and pixels, resp.
It is best to choose the array of pixels such that the coordinate axes pass through the center of pixels. Thus, the complex number corresponding to a pixel, that is the pixel's center, is always given by
with and integer constants.
| walltime[s] | d=50 | d=500 | d=5000 | sum |
|---|---|---|---|---|
| N=100 | ||||
| N=1000 | ||||
| N=10000 | ||||
| sum | Total |
This a competition! The winner, that is the one with the smallest total compute time Total over the 9 cases, will get 5 points, the second one 4 points, and so on. The remaining 15 points are to be earned on the presentation.
As in every competition, there are a few rules:
- Your code must be a Python program, but you may use C++ or Fortran to build your own Python modules for speed.
- The timings must be run on a single compute node of Vaughan, the Tier-2 VSC-cluster of the University of Antwerp. Every compute node on Vaughan has 64 cores, all of which you can use to parallellise the work and increase the througput.
- Every case must be computed in at most one job. If you like, you may run all cases together in one job, but splitting a case over more jobs is not allowed.
- Obviously, the github repo that you will use to store the different versions of your code, the presentation and the results, must contain all necessary files to rerun your program, as to verify the correctness of the results and the timings.
- You must save the image to disk. However, the timing must only include computing the image, not saving it to disk.
Success!
Plotting the images
Getting the nice images of the Mandelbrot set you may encounter on the web isn't as easy as it seems. Although this is not part of the challenge, I can understand your dissappointment if after spending all the effort to optimise and parallelise your codes, the images do not match your expectations. However, your get a long way by applying a transformation to the escape count (the pixel value), and mapping that to a color map. Here are some pointers: