This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC-BY) license (http://creativecommons.org/licenses/by/4.0/).

Nearly all nontrivial real-world systems are nonlinear dynamical systems. Chaos describes certain nonlinear dynamical systems that have a very sensitive dependence on initial conditions. Chaotic systems are always deterministic and may be very simple, yet they produce completely unpredictable and divergent behavior. Systems of nonlinear equations are difficult to solve analytically, and scientists have relied heavily on visual and qualitative approaches to discover and analyze the dynamics of nonlinearity. Indeed, few fields have drawn as heavily from visualization methods for their seminal innovations: from strange attractors, to bifurcation diagrams, to cobweb plots, to phase diagrams and embedding. Although the social sciences are increasingly studying these types of systems, seminal concepts remain murky or loosely adopted. This article has three aims. First, it argues for several visualization methods to critically analyze and understand the behavior of nonlinear dynamical systems. Second, it uses these visualizations to introduce the foundations of nonlinear dynamics, chaos, fractals, self-similarity and the limits of prediction. Finally, it presents Pynamical, an open-source Python package to easily visualize and explore nonlinear dynamical systems’ behavior.

Chaos theory is a branch of mathematics that deals with nonlinear dynamical systems. A system is simply a set of interacting components that form a larger whole. Nonlinear means that due to feedback or multiplicative effects between the components, the whole becomes something greater than the mere sum of its individual parts. Lastly, dynamical means the system changes over time based on its current state. Nearly every nontrivial real-world system is a nonlinear dynamical system. Chaotic systems are a type of nonlinear dynamical system that may contain very few interacting parts and may follow simple rules, but all have a very sensitive dependence on their initial conditions [

Real-world chaotic and fractal systems span the spectrum from leaky faucets [

These methods in turn have broad applicability to visual systems analysis. This article introduces nonlinearity and chaos interdisciplinarily through the methods of data visualization, using a logistic model to dissect the terminology, visualize pertinent features of chaos and fractals and discuss the wide-ranging implications for knowledge and prediction. It makes three primary contributions. First, it reviews and disseminates advanced visualization techniques for the qualitative analysis of nonlinear dynamical systems’ behavior to an interdisciplinary body of systems scholars. Second, it provides a visual introduction to the salient concepts of nonlinearity and chaos to a scholarly audience. Although the social sciences are increasingly studying these types of systems, some of the seminal concepts remain murky or loosely adopted in the theoretical literature [

The following section provides a background to the logistic map and the concepts of system dynamics and attractors. Then, we introduce several information visualization techniques to explore qualitative system behavior, bifurcations, the path to chaos, fractals and strange attractors. We investigate the difference between chaos and randomness before finally visualizing the famous butterfly effect and discussing its implications for scientific prediction. All of these models and visualizations are developed in Python using Pynamical; for readability, we reserve the technical details of its functionality for

Edward Lorenz, the father of chaos theory [

How can this possibly happen with a simple deterministic system? We will explore an example using the logistic map, a model based on the common s-curve logistic function that shows how a population grows slowly, then rapidly, before tapering off as it reaches its environment’s carrying capacity [_{t}_{+1} = _{t}_{t}

Chaos can manifest itself in both continuous (i.e., with dynamics defined by differential equations) and discrete (i.e., with dynamics defined by an iterated map) nonlinear dynamical systems. The logistic map is a simple, one-dimensional, discrete equation that produces chaos at certain growth rates. We will explore this in depth momentarily, but first, we use Pynamical to run the logistic model for 20 time steps (we will henceforth call these recursive iterations of the equation generations) for growth rate parameter values of 0.5, 1, 1.5, 2, 2.5, 3 and 3.5.

An attractor is the value, or set of values, that a system settles toward over time. When the growth rate parameter is set to 0.5, the system has a fixed-point attractor at a population level of zero, as depicted by the violet line. In other words, the population value is drawn toward a stable equilibrium of zero over time as the model iterates: the logistic equation maps the value of a fixed-point attractor to itself. When the growth rate parameter is set to 3.5, the system oscillates between four values as depicted by the yellow line. This oscillating attractor is called a limit cycle. However, when we adjust the growth rate parameter beyond 3.57, we witness the onset of chaos. A chaotic system has a strange attractor, around which the system oscillates forever without ever repeating itself or settling into a steady state of behavior [

To show this more clearly, we run the logistic model again, this time for 200 generations across 1000 growth rate values between zero and four. When we produced the plot in

In

Why is this visualization called a bifurcation diagram? If we zoom into the growth rates between 2.8 and 4 to see what is happening at a finer scale (

By the time we reach a growth rate of 3.99, it has bifurcated so many times that the system now jumps, seemingly randomly, between all population values. We only say

Universality refers to the phenomenon that very different systems can exhibit very similar behavior regardless of their underlying dynamics. It is commonly associated with Mitchell Feigenbaum’s discovery that all systems that undergo this period-doubling path to chaos obey a mathematical constant [

There is also a deep and universal connection between chaos and fractals [

Another way to visualize this nonlinear time series is with a phase diagram, using a method called state-space reconstruction through delay-coordinate embedding [

In our case, the two variables are: (1) the population value at generation

In

A kind of structure is slowly being revealed across

Strange attractors are revealed by these shapes as the system is somehow oddly constrained, yet it never settles into a fixed point or limit cycle like it did in

These visualizations have all plotted quantitative data to better explain and understand the qualitative behavior of a nonlinear dynamical system. A cobweb plot is a visualization technique particularly well-suited to revealing the qualitative behavior of one-dimensional maps, allowing us to analyze the long-term evolution of such systems under recursive iteration [

Begin on the

Draw a horizontal line from this point to the gray identity line; this new point is at (f(

Draw a vertical line from this point to the red function curve; this new point is at (f(

Repeat Steps 2 and 3 recursively. The cobwebs in

The blue lines intersect the red curve at those values our system lands on as it iterates from an initial population value of 0.5. In

Phase diagrams are useful for visually revealing strange attractors in time series data, like that produced by the logistic map, because they embed this one-dimensional data into a two- or even three-dimensional state space. It can be difficult to ascertain if certain time series are deterministic or just random if we do not fully understand their underlying dynamics [

This is particularly revealing in a three-dimensional phase diagram from Pynamical (

To press this further, we can use Pynamical to visualize the rest of the logistic map’s chaotic regime in three dimensions: the phase diagram in

Attractors have a basin of attraction: a set of points that the system’s dynamics will pull into this attractor over time [

By contrast, chaotic systems are characterized by their sensitive dependence on initial conditions. Their strange attractors are globally stable, yet locally unstable: they have basins of attraction, yet within a strange attractor, infinitesimally close points diverge over time without ever leaving the attractor’s confines. This divergence can be measured by Lyapunov exponents [

This nonlinear divergence of very similar values makes real-world modeling and prediction difficult, because we must measure the parameters and system state with infinite precision. Otherwise, tiny errors in measurement or rounding are compounded over time until the system eventually diverges drastically from the prediction. In the real world, infinite precision is impossible. It was through one such rounding error that Lorenz first discovered chaos. Recall his words at the beginning of this article: “the present determines the future, but the approximate present does not approximately determine the future” [

As a demonstration of this, we run the logistic model with two very similar initial population values, shown in

If our knowledge of these two systems began at Generation 50, we would have no way of guessing that they were nearly identical in the beginning. With chaos, history is thus lost to time, and prediction of the future is only as accurate as our measurements. Human measurements are never infinitely precise, so in real-world chaotic systems, errors compound, and the future becomes entirely unknowable given long enough time horizons. This phenomenon is famously known as the butterfly effect: a butterfly flaps its wings in China and sets off a tornado in Texas. Small events compound and irreversibly alter the future of the universe. In

This article had three aims. First, it argued for the usefulness of several visualization methods to analyze and understand the behavior of nonlinear dynamical systems. Second, it introduced the foundational concepts of nonlinear dynamics, chaos, fractals, self-similarity and the limits of prediction. It argued that information visualization is a key way to engage with these system concepts. Third, and by way of the first two, it demonstrated the Pynamical software package for visualizing the behavior of discrete nonlinear dynamical systems. In particular, Pynamical translates these concepts and tools into the Python programming language because it is prevalent, fast and easy to use (details in

Nonlinear systems are extremely difficult to solve analytically because they cannot be broken down into constituent parts. Instead of solving them, this article presented visual geometric methods to explore system behavior and stability. These methods have broad applicability to scholarly and professional visual data analysis by revealing hidden structure and patterns in time series whose underlying dynamics may not be well known. In particular, they reveal the qualitative behavior of nonlinear dynamical systems over time and/or in response to parameter variations.

This article used the logistic map to define such a set of nonlinear dynamics. As simple as this model was, at different growth rate parameter values, it produced stability, periodic oscillations or chaos. We used Pynamical to create bifurcation diagrams and cobweb plots to visualize this behavior across different parameter values. In the chaotic regime, the system jumped seemingly randomly between all population values. Accordingly, we used Pynamical to embed the data into higher-dimensional state space to create phase diagrams to visualize the system’s strange attractor and understand its constrained, deterministic dynamics. Finally, we explored the butterfly effect’s implications of nonlinearity on system sensitivity, as infinitesimal differences in initial conditions compounded over time until nearly identical systems had diverged drastically. Thus, in many nonlinear systems, there are fundamental limits to knowledge and prediction. These visualization methods can help researchers discover, examine and understand the behavior of nonlinear dynamical systems and chaos.

The authors declare no conflict of interest.

Pynamical and all of the code used to develop these models and produce these visualizations are available in a public repository on GitHub at

numpy is a numerical library that handles the underlying data vectors;

numba provides just-in-time compilation for optimized performance;

pandas handles the higher-level data structures and analysis;

matplotlib is the engine used to produce the visualizations and graphics.

Python was selected for developing Pynamical and the visualizations in this article because it is a standard programming environment for information visualization. It offers three key advantages: prevalence, speed and ease of use. First, Python has become a widely-prevalent language. The TIOBE index, a common measure of programming language popularity, ranks Python as the fifth most popular programming language as of 2016. In contrast, other languages commonly used for data science, visualization and mathematics are ranked much lower (e.g., R, MATLAB and SAS are only ranked 18th, 19th and 21st, respectively, in popularity). Developing tools for exploring, understanding and visualizing dynamical systems in Python makes them available to a much wider audience of systems analysts, researchers and students. Furthermore, unlike many languages, Python is completely free and open-source. It is also multi-purpose, and researchers can use its standard syntax and grammar for everything from statistical modeling, to cartography, to full software development. Becoming a Swiss army knife of the computational science world, Python has grown popular and powerful. Today, innumerable researchers and developers contribute open-source libraries of pre-packaged functionality for all to repurpose.

Second, Pynamical is fast. It is built on top of Python’s pandas, numpy and numba libraries for quick vectorized numerical computation. Although it is an interpreted language, these libraries provide compiled components that make mathematical modeling fast and efficient and can take advantage of the optimized mathematical routines of Intel processors’ Math Kernel Library. Pynamical also takes advantage of just-in-time code compilation to offer additional speed-ups. Third, Python is very easy to use, and this simplicity translates to Pynamical. Most of the visualizations in this article can be created from scratch in just one or two lines of straightforward code. The following examples demonstrate this simplicity. The user merely imports Pynamical into the Python environment, then runs the following code to produce the visualization:

Pynamical defines extensible functions to express a discrete map’s equation and encapsulate a model to simulate it iteratively. The logistic map, the Singer map and the cubic map are built-in by default, but any other iterated map can be defined and added by the user. Pynamical also defines a function to convert model output into

Time series graph of the logistic map with seven growth rate parameter values over 20 generations.

Bifurcation diagram of 100 generations of the logistic map for 1000 growth rate parameter values between zero and four. The vertical slice above each growth rate depicts the system’s attractor at that rate.

Bifurcation diagram of 100 generations of the logistic map for 1000 growth rate parameter values between 2.8 and 4. The vertical slice above each growth rate depicts the system’s attractor at that rate.

Bifurcation diagram of 100 generations of the logistic map for 1000 growth rate parameter values between 3.7 and 3.9. The system moves from order to chaos and back again as the growth rate is adjusted.

Bifurcation diagram of 100 generations of the logistic map for 1000 growth rate parameter values between 3.84 and 3.856. This is the same structure that we saw earlier at the macro-level in

Phase diagrams of the logistic map over 200 generations for growth rate parameter values of: 2.9 (

Cropped phase diagrams of the logistic map over 200 generations for: (

Cobweb plots of the logistic map for growth rate parameter values of: (

Plot of two time series, one deterministic/chaotic from the logistic map (

Phase diagrams of the time series in

Two different viewing perspectives of a single three-dimensional phase diagram of the logistic map over 200 generations for 50 growth rate parameter values between 3.6 and 4, each with its own colored line.

Cobweb plots of the logistic map pulling initial population values of 0.1 (

Plot of two time series with identical dynamics, one starting at an initial population value of 0.5 (

Population values produced by the logistic map with 7 growth rate parameter values over 20 generations.

Generation | |||||||
---|---|---|---|---|---|---|---|

1 | 0.500 | 0.500 | 0.500 | 0.500 | 0.500 | 0.500 | 0.500 |

2 | 0.125 | 0.250 | 0.375 | 0.500 | 0.625 | 0.750 | 0.875 |

3 | 0.055 | 0.188 | 0.352 | 0.500 | 0.586 | 0.562 | 0.383 |

4 | 0.026 | 0.152 | 0.342 | 0.500 | 0.607 | 0.738 | 0.827 |

5 | 0.013 | 0.129 | 0.338 | 0.500 | 0.597 | 0.580 | 0.501 |

6 | 0.006 | 0.112 | 0.335 | 0.500 | 0.602 | 0.731 | 0.875 |

7 | 0.003 | 0.100 | 0.334 | 0.500 | 0.599 | 0.590 | 0.383 |

8 | 0.002 | 0.090 | 0.334 | 0.500 | 0.600 | 0.726 | 0.827 |

9 | 0.001 | 0.082 | 0.334 | 0.500 | 0.600 | 0.597 | 0.501 |

10 | 0.000 | 0.075 | 0.333 | 0.500 | 0.600 | 0.722 | 0.875 |

11 | 0.000 | 0.069 | 0.333 | 0.500 | 0.600 | 0.603 | 0.383 |

12 | 0.000 | 0.065 | 0.333 | 0.500 | 0.600 | 0.718 | 0.827 |

13 | 0.000 | 0.060 | 0.333 | 0.500 | 0.600 | 0.607 | 0.501 |

14 | 0.000 | 0.057 | 0.333 | 0.500 | 0.600 | 0.716 | 0.875 |

15 | 0.000 | 0.054 | 0.333 | 0.500 | 0.600 | 0.610 | 0.383 |

16 | 0.000 | 0.051 | 0.333 | 0.500 | 0.600 | 0.713 | 0.827 |

17 | 0.000 | 0.048 | 0.333 | 0.500 | 0.600 | 0.613 | 0.501 |

18 | 0.000 | 0.046 | 0.333 | 0.500 | 0.600 | 0.711 | 0.875 |

19 | 0.000 | 0.044 | 0.333 | 0.500 | 0.600 | 0.616 | 0.383 |

20 | 0.000 | 0.042 | 0.333 | 0.500 | 0.600 | 0.710 | 0.827 |