Pages

Saturday, October 22, 2011

Circles and Python

Project Euler is a collection of computer programming problems. I have solved some of them in python, in order to learn the language. For one of the problems, I wanted to see what my program was doing, so I made it draw this picture:

The problem concerns circle packing: three circles are placed so that they all touch each other. Now place a fourth circle in the gap, touching the other three. Now there are three smaller gaps. Continue filling the gaps with circles.

I drew the circles with the matplotlib plotting library. Matplotlib is rapidly becoming my favorite plotting tool, replacing gnuplot.

No comments:

Post a Comment