Freitag, 1. August 2014

Python Performance in High Volume Mathematical Computations

I want to share the results of a performance experiment with the language Python.
Several contributions around this topic can be found online, but I never came across an example with such drastic results.

I wanted to compute a Julia set (a family of fractals around the famous Mandelbrot set) with high precision on a high end desktop computer.

Here are the results:
The original Julia set picture has a size of about 2.66 MB.
If anyone cares to play with something similar:
The beauty of the picture is determined by the logic that translates the number of iterations for every point into a RGB colour value.
I used the following for this picture (iter = number of iterations, % = mathematcal modulo)
if iter = 2000 then red = green = blue = 0 (yields black), otherwise:
   red = (10 * iter) % 256
   green = (8 * iter) % 256
   blue = (20  * iter) % 256