# Bifurcation diagram for the logistic map

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## WHAT IS IT?

NB: For better model performance/visualization it is recommended to download the program and run it on your PC, because on the server it is very slow.

This model is an example of the bifurcation diagram of the logistic map/ iterated logistic function f(x) = r * x (1 - x ).

The bifurcation parameter r is shown on the horizontal axis of the plot generated in NetLogo World View Window and the vertical axis shows the set of values of the iterated logistic function.

The bifurcation diagram shows the forking of the periods of stable orbits from 1 to 2 to 4 to 8 etc. Each of these bifurcation points is a period-doubling bifurcation. The ratio of the lengths of successive intervals between values of r for which bifurcation occurs converges to the first Feigenbaum’s constant.

In this model the initial condition (X0) is 0.5 and starting r-parameter-value is 0.95

## HOW IT WORKS

Every time-step (tick) an iteration is performed and as a result a point is generated (i.e. a green color turtle is created) and it is placed/plotted on the plane (where Y-coordinates are obtained as a result of logistic function iterations and X-coordinates represent every tick r-increments of 0.00015, with every new r-value participating in the next-step iteration by definition).

After the diagram is created the first Feigenbaum's constant (δ), which expresses the limit of the ratio of distances between consecutive bifurcations can be calculated. The value of Feigenbaum's constant converges to 4.669201609...

## HOW TO USE IT

Press the buttons (in respective numerical order):

(1) Setup: creates basic conditions for the model to run (i.e. erases data from previous runs, generates X and Y axes, etc.)

(2) Generates bifurcation diagram: starts iterations and generation of new points (turtles) in accordance with numeric values as a result of iterations.

(3) Mark bifurcations: this button can be activated only after iterations are completed (in this model after 20320 ticks/iterations). Pressing the button will generate red dots (i.e. red color turtles) for the first several bifurcations.

(4) Mark periodic window: this button can also be activated only after iterations are completed. It will point on a well visible periodic window, where chaotic behavior of the system 'suddenly' become 'non-chaotic'.

(5) Calculate 1st Feigenbaum's constant: Pressing this button after iterations ended, will highlight (by vertical white color lines) the regions of bifurcation and calculate (δ) based on x-coordinates of the turtles located in the respective 'bifurcation points'.

The distances between such points are marked by L0, L1, L2, etc.

(6) The bottom reporter shows the calculated value of 1st Feigenbaum's constant.

Pressing the buttons 3, 4, 5 before the end of iterations (i.e. before 20320 ticks) will case no particular changes to the model. The same is valid for the reporter - it will show "N/A" message.

## THINGS TO NOTICE

The result of the iterations with an r-value between 0 and 1.0 (see the Iterated logistic function model for more details) will be always '0'.

The starting value for r-parameter in this model is 0.95. Respectively, first points in the diagram will have Y-coordinates = 0. With the increase in r-parameter beyond 1.0 points will get Y-coordinates higher than '0' with the resulting line leaving '0'y-coordinates and the first bifurcation appearing just after r=3, followed by a period-doubling cascade.

At r = approximately 3.57 is the onset of chaos, at the end of the period-doubling cascade.

During the model run one can observe the result of iterations in time (by ticks): new turtles/points being created and plotted.

Feighenbaum's constant is calculated as the ratio of distances between consecutive bifurcations on diagram: on Li / Li+1. In this model it is calculated as the ratio between x-coordinates of turtles located in the respective specific regions of the bifurcation diagram (i.e. the transition between period 4 and period 8). The calculated and reported value is an approximate.

## EXTENDING THE MODEL

For a more precise value of the Feigenbaum's constant a better tuned selection of turtles/points which coordinates are used for calculation would be desirable. Another extension would be using for calculation the mean of x-coordinates of several turtles in the same regions of the bifurcation diagram and using the mean instead of a single turtle(s) coordinates.

## RELATED MODELS

This is one of the models in a suit of models created to visualize some key concepts of Chaos Theory and Dynamical Systems. Most of the models are available on http://modelingcommons.org/account/models/2495

Of a special interest can be the model describing the iterated logistic function with a final-state diagram. Comparing the behavior of the logistic function described by respective model and the actual bifurcation diagram model for the same r-values can provide additional insights.

## CREDITS AND REFERENCES

This simple abstract model was developed by Victor Iapascurta, MD. At time of development he was in the Department of Anesthesia and Intensive Care at University of Medicine and Pharmacy in Chisinau, Moldova / ICU at City Emergency Hospital in Chisinau. Please email any questions or comments to viapascurta@yahoo.com

The model was created in NetLogo 6.0.1, Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

This model was inspired by Introduction to Dynamical Systems and Chaos (Fall, 2017) MOOC by David Feldman @ Complexity Explorer (https://www.complexityexplorer.org/courses).

## Comments and Questions

globals [ ;; setting the globals for the model functioning mylist-x mylist-r num-iterations axis F-const? ] breed [ m-turtles m-turtle ] ;; these are turtles to be ploted on ;; on bifurcation diagram patches-own [ ;; properties of the patches used alpha ;; to set up X and Y axes omega ] to setup ;; general setup procedure ca set mylist-x list (0) (0.5) ;; setting the list for turtles x-coordinates set mylist-r list (0) (0.95) ;; setting the list for turtles y-coordinates create-axis ;; creating coordinates axes setup-alpha ;; and their components setup-beta-omega set num-iterations 20325 ;; this is the max number of iterates which ;; "keeps" the results of iterations in the ;; limits of the model world reset-ticks end to create-axis ask patches with [ pxcor = 0 ] [ set pcolor white ] ask patches with [ pycor = 0 ] [ set pcolor white ] end to setup-alpha ask patch -4 -4 [ set plabel "0" set plabel-color white ] ask patch -4 190 [ set plabel "f (x)" set plabel-color white ] ask patch 390 -7 [ set plabel "r-parameter" set plabel-color white ] end to setup-beta-omega ask patch 105 5 [ set plabel "1.0" set plabel-color white ] ask patch 205 5 [ set plabel "2.0" set plabel-color white ] ask patch 255 5 [ set plabel "2.5" set plabel-color white ] ask patch 305 5 [ set plabel "3.0" set plabel-color white ] ask patch 355 5 [ set plabel "3.5" set plabel-color white ] ask patch 395 5 [ set plabel "4.0" set plabel-color white ] ask patch 10 100 [ set plabel "0.5" set plabel-color white ] ask patch 10 195 [ set plabel "1.0" set plabel-color white ] end to go ;; procedure of iteration set mylist-x lput result mylist-x ;; generation of the list with repeat 50 [set mylist-x lput result mylist-x] ;; x-coordinates of turtles set mylist-r lput result-r mylist-r ;; generation of the list with ;; x-coordinates of turtles if ticks >= Num-iterations [ stop ] ;; condition for stopping the model once ;; the preset number of iterations is reached create-m-turtles 1 [ ;; creating a turtle every iteration/tick set color green ;; and ploting it according to the coordinates set shape "circle" ;; as values in the respective lists set size 0.5 set xcor (last mylist-r) * 100 set ycor (last mylist-x) * 200 ] tick end to-report result ;; reports the result of iterations report last mylist-r * last mylist-x * (1 - last mylist-x) end to-report result-r ;; reports the result of r-increments with every iteration/tick report last mylist-r + 0.00015 end to mark ;; marking the bifurcations by creating red color turtles ;; in respective zones if ticks >= 20320 [ ;; condition that makes respective button active only after ;; iterations are completed crt 1 [ set color red set shape "circle" set size 2 set xcor 300 set ycor 133 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 354 set ycor 164 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 345 set ycor 170 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 354 set ycor 177 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 345 set ycor 88 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 354 set ycor 105 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 354 set ycor 73 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.37 set ycor 69.43 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.41 set ycor 74.92 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.43 set ycor 98.16 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.47 set ycor 110.93 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.42 set ycor 161.49 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.46 set ycor 167.02 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.44 set ycor 176.12 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 356.48 set ycor 178.16 ] ] end to mark-pw ;; marking a periodic window if ticks >= 20320 [ ask patches with [ pxcor = 380 ] [set pcolor red] ask patches with [ pxcor = 390 ] [set pcolor red] ] end to calculate-feigenbaum-constant ;; procedure ref. to Feigenbaum's constant: ploting ;; vertical lines aligned to bifurcations and marking ;; the distance between consecutive period-doublings with "L" if ticks >= 20320 [ ;; condition that makes the procedure valid after the set F-const? true ;; preset number of iterations ask patches with [ pxcor = 300 ] [set pcolor white] ask patches with [ pxcor = 345 ] [set pcolor white] ask patches with [ pxcor = 354 ] [set pcolor white] ask patches with [ pxcor = 356 ] [set pcolor white] ask patch 198 -7 [ set plabel "L0" set plabel-color yellow ] ask patch 330 -7 [ set plabel "L1" set plabel-color yellow ] ask patch 355 -7 [ set plabel "L2/L3" set plabel-color yellow ] ask patch 100 155 [ set plabel "Feigenbaum's constant = Li / Li+1" set plabel-color yellow ] ] end to-report F-constant-1 ;; procedure for calculation of the 1st Feigenbaum's constant if F-const? = true ;; based on x-coordinates of the turtles located in the bifurcations zones [ ;; 'bifurcations zones' report (([xcor] of turtle 17294) - ([xcor] of turtle 16688)) / (([xcor] of turtle 17422) - ([xcor] of turtle 17292)) ] end

There is only one version of this model, created about 1 year ago by Victor Iapascurta.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Bifurcation diagram for the logistic map.png | preview | Preview for 'Bifurcation diagram for the logistic map' | about 1 year ago, by Victor Iapascurta | Download |

This model does not have any ancestors.

This model does not have any descendants.