# Bifurcation diagram for the logistic map

Model was written in NetLogo 6.0.1
•
Viewed 658 times
•
Downloaded 27 times
•
Run 0 times

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

Info tab cannot be displayed because of an encoding error

## Comments and Questions

Please start the discussion about this model!
(You'll first need to log in.)

Click to Run Model

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 almost 5 years 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' | almost 5 years ago, by Victor Iapascurta | Download |

This model does not have any ancestors.

This model does not have any descendants.