Part J: Spatial Dynamical Systems

Here are several Python programs that illustrate simulating and displaying various kinds of spatial dynamical system—that is, coupled arrays of dynamical systems.

For simplicity, we look only at discrete-time systems, rather than (say) arrays of coupled (continuous-time) ordinary differential equations. In this class of spatial system we have cellular automata, which are discrete in local state, and map lattices, which are continuous in local state. (Refer to the Dynamics lecture on spatially extended systems for their definitions and the particular example systems shown below.)

The programs give examples for each in one and in two spatial dimensions.

Program structure: Commonalities

Inspecting the programs you will see that they share a common overall organization and also illustrate several new Python features.

First of all, of course, they to simulate a spatial system, which means that the state consists of a spatial field of values. When they set the initial condition they fill out a one- or two-dimensional array of values. The action of the dynamic then updates the entire field of values, producing a new state.

The versions given here all use periodic boundary conditions, so that sites on the edge of the spatial lattice are neighbors of the opposite edge's sites.

Directly displaying the state space trajectory is not possible, generally, since the state space is very high dimensional. In these examples the dimension is the number of lattice sites. The result is that the graphical display is of the spatial configuration encoded as a one or two dimensional array of colored cells, for which the color encodes the local state value at a site. In the special case of one spatial dimension, the history of the configurations is shown in a spacetime diagram—the spatial configuration is shown horizontally and the temporal history of configurations is vertical, with the oldest at the top.

The first program shows the use of the TkInter GUI widget set and the Image module. (Documentation for the latter is here.)

It turns out that these are a bit slow and so the remainder of the programs use the pyglet package which is adapted to put images up on the display quickly. Packages for pyglet are available for all platforms and it and related packages are part of the Enthought Python Distribution we are using.

Performance: The speed of the simulations needs to be increased. The current programs are implemented very simply to show the basic organization of spatial simulators. The Python constructs used do not appear to be very efficient computationally. But the programs are short and simple.

They all implement command-line controls, so that one can change the size of the array, system simulated, and the like. This is done using the get-opts module, which provides a very easy to use method for extracting the command-line arguments and values with which the program is started. (The get-opts manual is here.)

The following notes don't describe in detail the various options for running the programs. The options include different kinds of initial configuration, different systems (CA rules or maps), different types of graphical display, different control parameter settings, and so on. See the comments at the beginning of the Python code to get a sense of what's available. Defaults are set, however, so you can just run them as is and they will do something of interest.

Explore!

Modify!

Cellular Automata

These programs simulate elemenary cellular automata (CAs); that is, binary local-state, nearest-neighbor coupled CAs.

Elementary CA in One Spatial Dimension

TkInter version: OneDECA_tk.py.

PyGlet version: OneDECA.py.

Two Spatial Dimensions

PyGlet version: TwoDECA.py.

Lattice Maps

Each of the following will run either a lattice of coupled logistic maps or a system called either the Dripping Handrail (1D) or the Dripping Pie Tin (2D).

One Spatial Dimension

OneDLDS.py.

Two Spatial Dimensions

TwoDLDS.py.


Table of Contents