Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

12.2: Phase Space Visualization

  • Page ID
    7837
  •  

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    If the phase space of a CA model is not too large, you can visualize it using the technique we discussed in Section 5.4. Such visualizations are helpful for understanding the overall dynamics of the system, especially by measuring the number of separate basins of attraction, their sizes, and the properties of the attractors. For example, if you see only one large basin of attraction, the system doesn’t depend on initial conditions and will always fall into the same attractor. Or if you see multiple basins of attraction of about comparable size, the system’s behavior is sensitive to the initial conditions. The attractors may be made of a single state or multiple states forming a cycle, which determines whether the system eventually becomes static or remains dynamic (cyclic) indefinitely.

    Let’s work on an example. Consider a one-dimensional binary CA model with neighborhood radius \(r = 2\). We assume the space is made of nine cells with periodic boundary conditions(i.e., the space is a ring made of nine cells). In this setting, the size of its phase space is just \(2^{9} = 512\), so this is still easy to visualize. 

    In order to enumerate all possible configurations, it is convenient to define functions that map a specific configuration of the CA to a unique configuration ID number, and vice versa. Here are examples of such functions:

    clipboard_e626e74b87dbf49a0f9651f22a55cfe3d.png
    Here L and i are the size of the space and the spatial position of a cell, respectively. These functions use a typical binary notation of an integer as a way to create mapping between a configuration and its unique ID number (from \(0\) to \(2^{L} −1\); 511 in our example), arranging the bits in the order of their significance from left to right. For example, the configuration [0, 1, 0, 1, 1, 0, 1, 0, 1] is mapped to \(2^{7} + 2^{5} + 2^{4} + 2^{2} + 2^{0} = 181\). The function config receives a non-negative integer x and returns a list made of 0 and 1, i.e., a configuration of the CA that corresponds to the given number. Note that “&” is a logical AND operator, which is used to check if x’s i-th bit is 1 or not. The function cf_number receives a configuration of the CA, cf, and returns its unique ID number (i.e., cf_number is an inverse function of config). 

    Next, we need to define an updating function to construct a one-step trajectory of the CA model. This is similar to what we usually do in the implementation of CA models:
    clipboard_e349f22ff0ec124f169e176615ec4288f.png

    In this example, we adopt the majority rule as the CA’s state-transition function, which is written in the second-to-last line. Specifically, each cell turns to 1 if more than half of its local neighbors (there are \(2r + 1\) such neighbors including itself) had state 1’s, or it otherwise turns to 0. You can revise that line to implement different state-transition rules as well. 

    Now we have all the necessary pieces for phase space visualization. By plugging the above codes into Code 5.5 and making some edits, we get the following:

    clipboard_eecd66bf55246b8fdd2cb32dd423b3224.png

    clipboard_e04844feb2ee66823d220bfe052914988.png

    clipboard_e43ca6aa7b600d72c8413b58a85123fc8.png

    The result is shown in Fig. 12.2.1. From this visualization, we learn that there are two major basins of attraction with 36 other minor ones. The inside of those two major basins of attraction is packed and quite hard to see, but if you zoom into their central parts using pylab’s interactive zoom-in feature (available from the magnifying glass button on the plot window), you will find that their attractors are “0” (= [0, 0, 0, 0, 0, 0, 0, 0, 0], all zero) and “511” (= [1, 1, 1, 1, 1, 1, 1, 1, 1], all one). This means that this system has a tendency to converge to a consensus state, either 0 or 1, sensitively depending on the initial condition. Also, you can see that there are a number of states that don’t have any predecessors. Those states that can’t be reached from any other states are called “Garden of Eden” states in CA terminology.

    Fig. 12.1 pt1.PNG

    Fig. 12.pt2.PNG

    Figure \(\PageIndex{1}\):  Graph-based phase space of the 1-D binary CA model with the majority rule \((r = 2, L = 9)\) drawn with Code 12.3.

    Exercise \(\PageIndex{1}\): 

    Measure the number of states in each of the basins of attraction shown in Fig. 12.2.1, and draw a pie chart to show the relative sizes of those basins. Look up matplotlib’s online references to find out how to draw a pie chart. Then discuss the findings.

    Exercise \(\PageIndex{2}\): 

    Modify Code 12.3 to change the state-transition function to the “minority”rule, so that each cell changes its state to a local minority state. Visualize the phase space of this model and discuss the differences between this result and Fig. 12.2.1

    The technique we discussed in this section is still na¨ıve and may not work for more complex CA models. If you want to do more advanced phase space visualizations of CA and other discrete dynamical systems, there is a free software tool named “Discrete Dynamics Lab” developed by Andrew Wuensche [47], which is available from http://www.ddlab.com/.