Snake in the grass

{First posted 16 June 2010 at, saved from oblivion by the internet archive}

One aim of this blog was to advocate and advertise the use of open science. Which is somewhat at odds with my advocation and advertisement of Matlab – a popular, powerful, but ultimately pricey piece of software. I’ve spent some time working with Octave – a language that is identical in every way to Matlab, save the subtle difference that it’s completely free. If you throw in the thriving Octave community, I’d go so far as to recommend that the average user make the open-source switch immediately.

Unfortunately, for the heavy number-crunchers amongst you, there are instances (specifically loopy code) where Octave just cannot match its commercial counterpart for speed (as it has no JIT compiler, if you’re that way inclined). So I’ve recently turned to python for all my programming needs.

As a (n old) Matlab user, I’ve found python very easy to learn, particularly when using the SciPy library. The attached code can be used to produce the beautiful Barnsley fern, an iterated function system designed to resemble the Black Spleenwort. Whilst mastering python, you can ponder Barnsley’s hypothesis that

… when a geometrical fractal model is found that has a good match to the geometry of a given plant, then there is a specific relationship between these code trees and the information stored in the genes of the plant.

Barnsley fern


Michael Barnsley, John E. Hutchinson, & Örjan Stenflo (2003). V-variable fractals and superfractals – arXiv: math/0312314v1


2 thoughts on “Snake in the grass

  1. u003f Post author

    Duncan, 16 June 2010 at 16:11:

    hello. oooh pretty picture. any idea how scipy and the like compares to R (which many people rave about but I’ve had limited experience of)

    kieran, 17 June 2010 at 14:50:

    I have the impression that the R/S-plus family is statistically-oriented, whilst the Matlab/Octave family has more of a numerical analysis flavour. But of course both have additional toolboxes that allow them to do pretty much anything. Back in 2003, R and Matlab were comparable in terms of speed; I don’t know if things have changed much today.

    [*edit: a more recent comparison shows python and Matlab to be comparably fast]

    Ben, 12 July 2010 at 17:12:

    I hold out hope that someone will get around to rewriting the COBRA toolbox in Python soon.

    I hope that COBRA in Python will be called SNAKES, but haven’t quite worked out the acronym beyond “Stoichiometric Network Analysis … Evaluation Software (or System)” yet.

    Brandon, 11 September 2010 at 03:36:

    Several folks in diverse labs at my university alone are interested in creating an FBA package written in python; time is always an issue, but I’d certainly be happy to do some of the porting of COBRA scripts to python.

  2. Pingback: Pythooooon | U+003F

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s