Computing

Mandelbrot in Python

Last updated: Nov. 7, 2007, 4 p.m.

It occurred to me the other day that I haven't done any serious fractal programming since my first year at uni when I was learning MATLAB. (When I say serious, I in now way imply that this is particularly import, more that it demands I think harder than I might otherwise do.)

A mandlebrot set drawn with Python and Pygame.

Mandlebrot Set: A mandlebrot set drawn with Python and Pygame.

MATLAB was great for doing these things because it was generally designed for performing iterative mathematical processes. However, it's proprietary and that annoys me hugely, I want to be able to give away the code I write and let anyone use it. Where would be the point in releasing some nice open source code if you could only run it by buying an interpreter. So I decided this time I would do something in Python. This proved quite easy to do, the program attached should run on any platform with a suitable set of Python bits installed, I've tried it on Windows and Linux with no problems. This is so far a very rough program it draws a fixed size, fairly low resolution image of the set over a fixed area, however it should serve as a starting point for a zooming program or whatever. The drawing is done using the pygame add on for python which is pretty easy to install on any python running system and gives a really nice simple way to paint individual pixels from your python code.

AttachmentLast UpdateSize
mand.pyNov. 5, 2014, 9:40 p.m.998 bytes
Section:
Computing
Tags:
Mandelbrot,
Python,
fractal,
programming

Comments

Posting comments is not currently possible. If you want to discuss this article you can reach me on twitter or via email.