Blog

A blog of Python-related topics and code.

Is the frequency of intense tornadoes increasing?

Spoiler: I don't know and nor does anyone else.

The Forest-fire model

A simple model of a forest fire is defined as a two-dimensional cellular automaton on a grid of cells which take one of three states: empty, occupied by a tree, or burning. The automaton evolves according to the following rules which are executed simultaneously for every cell at a given generation.

Making a Matplotlib plot look better #2

The following program plots a bar chart of the estimated maximum number of active nuclear warheads by country using the default configuration of Matplotlib.

The Wilberforce Pendulum

The Wilberforce Pendulum is a mass suspended on a helical spring which is free to move up and down as well as to rotate as the spring coils and uncoils with its extension. You can see one in action below.

Visualizing a vector field with Matplotlib

Matplotlib provides a function, streamplot, to create a plot of streamlines representing a vector field. The following program displays a representation of the electric field vector resulting from a multipole arrangement of charges. The multipole is selected as a power of 2 on the command line (1=dipole, 2=quadrupole, etc.)