Monthly Archives: February 2008

The Art and Science of Pulling Numbers Out of Your Sleeve

About a year or so ago, I was reading R. V. Jones’ excellent book ‘Most Secret War’. One of the stories I remembered and told my colleagues about, was how Jones estimated the rocket production capabilities of the Germans. He … Continue reading

Posted in Projects, Statistics | Tagged , , , , , | Leave a comment

Solution for the Random Selection Challenge

A few days ago, I wrote up two small Python Challenges. Several people have presented solutions for the first challenge, and I also posted my solution in the comments there. However, the second challenge remained unsolved, and I will present … Continue reading

Posted in computer science, Math, Programming, Python, Statistics, Utility Functions | Tagged , , , , , , , , | Leave a comment

Harvesting with threadmap

From time to time, I need to harvest a website, or many websites. For example, to collect the data from IMDB to run the Pagerank algorithm. Other times I need to query some non-web servers. Usually in such cases, I … Continue reading

Posted in Programming, Python, Utility Functions | Tagged , , , , | 4 Comments

Fun with Matrices

I’ll let the code speak for itself: In [81]: m = Matrix(array([[1.0,1.0],[0.0,1.0]]))   In [82]: def my_sqrt(x, num_iters): ….: r = 0.5*x ….: for i in xrange(num_iters): ….: r = 0.5*(r+x/r) ….: return r ….:   In [83]: m*m Out[83]: … Continue reading

Posted in Math, Programming, Python | Tagged , , | Leave a comment

LStrings and ASCII-Plotter at

It seems Gregory is fond of ascii-art, as he took my scripts, and put them online at is a cool new website, which allows you to run scripts as small web applications. What Gregory actually did, with just … Continue reading

Posted in Programming, Python, web-design | Tagged , , , , , , , | Leave a comment

Origami Pig Instructions

I took some time to create the instructions for this one: Read on for the full instructions.

Posted in Origami | Tagged , , | Leave a comment

Small Python Challenge No. 3 – Random Selection

This time I’ll give two related problems, both not too hard. Lets warm up with the first: You have a mapping between items and probabilities. You need to choose each item with its probability. For example, consider the items [‘good’, … Continue reading

Posted in Challenges, Math, Programming, Python | Tagged , , , , , | 12 Comments

Rhyme and Reason with Python

After reading xkcd’s blog, I went to It looks and works just like, but for limericks. Quite amused with some of the limericks available, I wanted to try and compose my own. The first one came out fine, … Continue reading

Posted in Algorithms, Humour, Programming, Python | Tagged , , , , , | 1 Comment

Troubles with Wild Themes

Some time ago, I wrote that I was planning on using a new theme for this blog. To do this, I first looked for possible candidates on, and then started to adapt the one I liked. However, while working … Continue reading

Posted in Security, web-design | Tagged , , , , | 2 Comments

Interesting links – 4 “Intermediate and Advanced Software Carpentry in Python” is an excellent reading by Titus Brown. If you feel you’re good with Python but want to improve it, or if you are an experienced programmer that wants to get better, this … Continue reading

Posted in Compilation, Math, Programming, Python | Tagged , , , , | Leave a comment