## How to understand Chaos Theory using Logistic Map Equation

Started ‎04-11-2024 by
Modified ‎04-16-2024 by
Views 448

In data analysis, we frequently deal with a variety of seemingly unpredictable processes. Although we normally presume that data was generated randomly, chaos theory indicates that some sequences that appear random are actually the result of predictable principles. Originally rooted in math and physics, Chaos Theory is useful for unraveling the complexity of chaotic systems through seemingly stochastic sequences.

We will use a logistic map equation to help demonstrate the complexity of chaos theory. A logistic map is a polynomial mapping of degree 2 that uses relatively simple logistic equations to demonstrate how complicated chaotic behavior might emerge. The mapping was popularized in the late 1970's as a discrete-time demographic model analogous to the logistic equation developed by Pierre Francois Verhulst. Mathematically the equation was written as:

### Generate Data

In this first step, we create a dataset  "chaotic_data" to store our simulated data. First, we need to call the DATA step function and create our initial conditions. We set the initial conditions x=0.1 & r=3.2 and simulate 100 data points using a logistic map equation for the chaos theory demonstrations. In this first example,  we decided not to display the plot of x0 = 0.1 as it's understood to be our initial r-value. We will show different values of  'r'  between 3.2 and 4.0 to help better understand how chaotic data can arise and from the visualization what we may learn.

``````data chaotic_data;
/* Set initial conditions */;
x=0.1;
r=3.2;
/* Simulate 100 time points */;
do i=1 to 100;
/* Logistic map equation for chaos */;
x=r * x * (1 - x);
output;
end;
run;
proc print data=Chaotic_data (obs=10);
run;``````

In the figure above, we are able to observe the initial start point as the iterations approaches the 20th point of iterations we see that the chaotic values converge approximately around 0.70 reaching a steady state between 20 and 100 . We are able to see the coupling effect taken showing the iteration data points between 20 and 100.

``````data chaotic_data_3;
/* Set initial conditions */;
x=0.1;
r=3.5;
/* Simulate 1000 time points */;
do i=1 to 100;
/* Logistic map equation for chaos */;
x=r * x * (1 - x);
output;
end;
run;
proc print data=chaotic_data_3 (obs=10);
run;

/***********Visualizations*******************/;
title "Chaotic Plot 3 (λ=3.5)";
proc sgplot data=chaotic_data_3;
series x=i y=x / markers;
xaxis label="Iterations (0-100)";
yaxis label="Chaotic Values";
run;
title;``````

In the above demonstration, we set r = 3.5 we see the onset of chaos, with the data beginning to change frequently in the first 20 iterations and towards the end of the period-doubling cascade. Almost all initial conditions no longer produce finite period oscillations. Slight differences in the beginning population produce significantly diverse effects over time, a key feature of onset chaos.

``````data chaotic_data_2;
/* Set initial conditions */;
x=0.1;
r=3.7;
/* Simulate 1000 time points */;
do i=1 to 100;
/* Logistic map equation for chaos */;
x=r * x * (1 - x);
output;
end;
run;
proc print data=chaotic_data_2 (obs=10);
run;
/***********Visualizations*******************/;
title "Chaotic Data Plot 2 (λ=3.7)";
proc sgplot data=chaotic_data_2;
series x=i y=x / markers;
xaxis label="Iterations (0-100)";
yaxis label="Chaotic Values";
run;
title;
``````

In this demonstration we increased the r value to 3.7, we are able to observe the 2nd x-value as 0.33, it increases to 0.82 where we are able to notice the data diverges and chaos in the visualization. We notice that in the first few observations in the visualization that iteration fluctuates erratically throughout the data.

``````data chaotic_data_4;
/* Set initial conditions */;
x=0.1;
r=4.0;
/* Simulate 1000 time points */;
do i=1 to 100;
/* Logistic map equation for chaos */;
x=r * x * (1 - x);
output;
end;
run;
proc print data=chaotic_data_4 (obs=10);
run;
/***********Visualizations*******************/;
title
"Chaotic Plot 4 (λ=4.0)";
proc sgplot data=chaotic_data_4;
series x=i y=x / markers;
xaxis label="Iterations (0-100)";
yaxis label="Chaotic Values";
run;
title;``````

In the above demonstration, we set r = 4.0 where we are able to observe a case of nonlinear transformation of both the shift between the chaotic values interval from 0 to 1. When r=4.0 there two possible outcomes in the results, either the iterates will exhibit chaotic dynamics or the iterates will diverge dependent on the initial r-value that may be used (in our case 0.1).

### Conclusion

The logistic map equation has proven to be an effective tool for demonstrating how slight changes in initial conditions or parameters can result in radically different outcomes, exemplifying chaotic systems' sensitive dependence on initial conditions. The logistic map's relative simplicity makes it a popular starting point for discussing the concept of chaos. A simple explanation of chaos is that chaotic systems are extremely sensitive to initial conditions, which is a feature of the logistic map for the majority of values. In the next post of this series we discuss using these chaotic values collected to form a bifurcation diagram and visualize the succession of period-doubling produced as the r-values increase.  For more information regarding this topic see the links below.

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
‎04-16-2024 03:29 PM
Updated by:
Article Labels
Article Tags