23 August 2008
Excellent new book in the making: Computational Modeling and Complexity Science
  
Recently, in a post about his terrific, Programming Collective Intelligence, Toby Segaran calls out the “excluded middle” of technical books. His goal with with PCI was to cover that middle ground - “showing concepts, implementation and applications all at once”. Its a truly great book that will stand the test of time.

I’ve recently stumbled across another title that belongs in this middle ground: Computational Modeling and Complexity Science by Allen B. Downey. He’s also the author The Little Book of Semaphores, Think Python: An Introduction to Software Design, Learning Perl the Hard Way and a few other titles; all self published and released under the GPL.

According to Downey, CMCS, is about “algorithms, intermediate Python programming and complexity science”.

The book has a lot in common with PCI. Both:
  • Use Python as a basis for all examples
  • Span academia and pragmatism with working examples
  • Maintain an easy to read narrative
  • Are just the right length ( so far! )
CMCS gives just enough theory to provide context. The readability of the text is helped out with anecdotes from the lives of the referenced mathematicians. CMCS takes on analysis of social networks, queuing theory, stochastic modeling, cellular automata and a bunch of other great subjects.

In Chapter 7, Self-organized Criticality, there is some coverage of modeling forest fires:

In 1992 Drossel and Schwabl proposed a cellular automaton that is an abstract model of a forest fire. Each cell is in one of three states: empty, occupied by a tree, or on fire.

The rules of the CA are:
  1. An empty cell becomes occupied with probability p.
  2. A cell with a tree will burn if any of its neighbors is on fire.
  3. A cell with a tree will spontaneously burn, with probability f, even if none of its neighbors is on fire.
  4. A cell with a burning tree becomes an empty cell in the next time step.

    I couldn’t help pulling out PIL and gluing some Python together to try this out. Here’s what I came up with (converted to flash to keep filesize down):

    source

    Much of the book us still under construction and none of the referenced source URLs I tried were functional. That said, one suggestion I do have is to make more use of existing Python libraries. As an a example, the chapter on graphs includes the implementation of basic graph datastructures. This is understandable since this will no doubt be used in undergraduate classrooms, but there should at least be a pointer to NetworkX; a battle-tested warhorse that the reader should be aware of.

    It’s a great read so far and I’m looking forward to seeing how the book evolves.
    ← Read More