A blog of Python-related topics and code.
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.
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 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.
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.)
Foraminifera are a phylum of mostly marine protists which produce a shell or "test" in the form of a series of linked chambers. One approach to modelling the morphology of foraminifera shells [Tyszka and Topa, Paleobiology 31(3), 522 (2005)] in two dimensions treats the chambers as overlapping circles. Let the vector from the centre of chamber $i$ to its "output" aperture be $\mathbf{r_i}$.