Introduction to Chaos and the Logistic Map CS523 Assignment One – Spring 2013 the University of New Mexico
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to Chaos and the Logistic Map CS523 Assignment One – Spring 2013 The University of New Mexico Karl Stolleis John Ericksen [email protected] [email protected] Introduction The following report is an introduction to the concepts of the logistic map function and its application to complex systems and chaos theory. The initial equation for the logistic map is as follows : 2 P(t +1)=R (Pt −Pt /k) where the population P at a given time step t is used to calculate the population at the next time step P(t +1) in the sequence. The value R is the the birth rate of the population minus the death rate. The constant k is the “carrying capacity,” or the number of individual organisms, that the organism's environment can support. [1] With some algebraic maneuvering the equation can be rewritten in the form: P(t +1)=R Pt (1−Pt ) where the value P is now the population given as a percentage of the total carrying capacity. [1] We will use both equations in this paper to demonstrate various principles. The logistic map is used as a basic demonstration of a mathematical equation that, despite its simplicity, can give rise to chaotic behavior. Chaos, in this context, simply means that the values generated by the logistic map, at a given R-value, will become unpredictable. Unlike the common definition of chaos, the chaos described by dynamical systems is really unpredictability arising from a deterministic structure, such as a mathematical equation. [2] The logistic map also demonstrates a hallmark of chaotic systems, namely high sensitivity to initial conditions. Each of these principles will be discussed in the results section. The connection of the logistic map to complex, adaptive systems has a number of points. The equation demonstrates that some deterministic systems can exhibit behavior that, under no circumstances, can be predicted. Many such systems, such as weather, biological populations, fluid turbulence and economic systems exhibit classic, chaotic behavior, the principles of which can be observed in the logistic map. [3] We will demonstrate such hallmarks as the Feigenbaum constant, self-similarity and how these chaotic behaviors can be described in terms of Shannon entropy. Lastly we will give an example of how, when compared to an actual, biological system, the logistic map is a simple and naive method to model populations. Methods Each of the data plots in the results section were generated using the software package Matlab. A script was written for each of the plots shown. In part one, population predictions for a theoretical rabbit population were generated using using a set of two different data inputs. The script cs523_1_1.m uses both the logisticMap.m and logisticPopulation.m functions to generate the data for questions one, two and three of part one. The resulting data sets are created by simply varying the input parameters for the listed functions, namely the R- value, the carrying capacity, the initial population and the number of time steps to be generated. The actual functions were simply the two listed in the introduction of this paper. Question four was generated with cs523_1_4a.m, cs523_1_4b.m, cs523_1_4c.m, and bifurcation.m scripts. The bifurcation diagram displays the behavior of the logistic map at a large time value threshold. The script executes the logistic map function until the threshold is met, then samples the next one hundred data points. If the logistic map has reached a stable state (cycling through a set of values) then the resulting data points contains less than the sample amount of unique values. If the logistic map has not reached stability, all of the data points are unique and represents chaotic behavior. These points are plotted over each R value, from -2 to 4. Question five was generated with the cs523_1_5.m script. The method for calculating the Shannon entropy was to generate a set of population predictions using a series of R-values between 2.5 and 4.0 and then create a histogram of the resulting values, for each R-value. The values were rounded to five decimal places to compensate for small rounding errors in the floating point representation. The histogram values were normalized, to create a set of probabilities and then the Shannon entropy equation : H (x)=−∑ p(x)∗log2( p(x)) where H (x) is the calculated entropy, for each R-value and p(x) is the probability of the expected values in the population estimate. The process was repeated for each R-value, and the resulting H-values were plotted. [4] Questions six(a,b) of part two were generated with the scripts cs523_2_1.m and cs523_2_2.m, respectively. Both scripts, in turn, used the the X.csv and Y.csv data sets and logisticMap.m and logisticPopulation.m functions to first plot the initial data set and then plot the calculated population estimate. The question asked us to estimate R-value, initial population and carrying capacity such that the initial data set could be reproduced. Analysis of the initial plot of X allowed for only a single, possible R-value and initial population. Analysis also showed a small range of possible carrying capacities which were iterated over until the correct value was found. Correctness was simply determined by how well the resulting plot matched the initial plot. A similar process for the Y data set was used with only a few more steps because of three additional, possible R-values. Question seven was plotted first from given data set Z.cxv, and using script 523_2_3.m a discrete Fourier series was generated to calculate the exact periodicity of the data set. [5][6] An additional script cs523_2_3a.m was created to try and use the logistic map equation to recreate the data but the resulting plot was omitted for brevity. Included in the directory, with the source scripts, is a read me file that outlines the detailed instructions for running the above mentioned scripts. Additional details can be found in the comments included in the individual script files. Author Contributions Initial plots for 1.1, 1.2, 1.3, 2.1, 2.2, 2.3 were generated by Karl S .while 1.4(a,b,c,d) and 1.5 were generated by John E. Both authors then independently confirmed the work of the other and compared results. Report draft was written by Karl S., subsequently modified by both authors and final draft was completed by John E.. On-line collaboration was used extensively in comparing data and results. Results Figure 1 : Plot of two theoretical, rabbit populations with an R- value set below the chaotic threshold. Both populations synchronize quickly despite having different initial values. Figure 1 shows the values plotted for the two, proposed rabbit populations for part one, question one. The R-value is 3.25 which is below the chaotic threshold of ~ 3.569 [2] so the expected result was that the two populations would stabilize with a two attractor period and the values would synchronize after a large number of time steps. The plot clearly shows the resulting two attractor state and the population values synchronized after a single time step, despite not having reached the final attractor values. The assumptions underlying our predictions stem from a R-value below the chaotic threshold, the carrying capacity being identical for both populations and the initial values chosen that converge immediately to the same population cycles. Figure 2 : Plot of two theoretical, rabbit populations with an R- value set above the chaotic threshold. Both populations unexpectedly synchronize despite having unique initial values. This behavior is explained by the sum of the initial values being equal to one. Figure 2 shows the same process as for Figure 1 but having an R-value of 3.7, above the chaotic threshold of the logistic map equation. From the plot it is easy to see that the two populations do not reach a steady attractor state, despite what appears to be quasi-periodic (ergodic) regions of the plot. The surprising result was that the two populations again became synchronized after a single time step, belying the sensitivity of the equation to initial conditions while in the chaotic region. The synchronization can be explained by the initial values, (x0a , x0b ) being 0.3 and 0.7 respectively, summing to 1.0. Additional test plots, with other analogous values confirmed this. The logistic map equation where the current population value is multiplied by one minus the current value is the ultimate explanation for this behavior. The actual population dynamics show the classic unpredictability of having an R-value which exceeds the chaos boundary for this equation. It would be highly improbable that this particular condition, of synchronization, would occur in a real population. Figure 3 : Plot of four theoretical, rabbit populations with an R- value set above the chaotic threshold. The sensitivity to initial conditions is demonstrated by the divergence of the four predictions despite the initial values being quite similar in value. Figure 3 again uses a similar process as Figures 1 and 2 with four estimated populations. The R-value, in this case is set above the chaotic threshold but the initial populations are perturbed by a small amount. The result shows the four populations shadowing one another for approximately the first seven time steps but then diverging into individual, chaotic paths that show no overlap or any signs of synchronization across the populations. The sensitivity to initial conditions is exacerbated by the inability of a computer to represent numbers with infinite precision. The rounding errors created by floating point representations, in conventional computer architecture, can also create the above behavior.