Skip to main content
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}}} \)

    \( \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}}\)

    \( \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}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

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

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

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

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

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

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    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/.


    This page titled 12.2: Phase Space Visualization is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Hiroki Sayama (OpenSUNY) via source content that was edited to the style and standards of the LibreTexts platform.