# Bifurcation diagram for iterated sin_f

Model was written in NetLogo 6.0.1
•
Viewed 236 times
•
Downloaded 12 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 ca set mylist-x list (0) (0.5) ;; setting the list for turtles x-coordinates set mylist-r list (0) (30) ;; setting the list for turtles y-coordinates set num-iterations 16900 ;; setting the number of iterations create-axis ;; creating coordinates axes setup-coordinates ;; and their components 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-coordinates ask patch 5 5 [ set plabel "0" set plabel-color white ] ask patch 10 345 [ set plabel "1.0" set plabel-color white ] ask patch -10 200 [ set plabel "f (x)" set plabel-color white ] ask patch 150 -14 [ set plabel "r-parameter" set plabel-color white ] ask patch -19 -5 [ set plabel "30" set plabel-color white ] ask patch 7 -5 [ set plabel "40" set plabel-color white ] ask patch 35 -5 [ set plabel "50" set plabel-color white ] ask patch 65 -5 [ set plabel "60" set plabel-color white ] ask patch 100 -5 [ set plabel "70" set plabel-color white ] ask patch 135 -5 [ set plabel "80" set plabel-color white ] ask patch 170 -5 [ set plabel "90" set plabel-color white ] ask patch 205 -5 [ set plabel "100" set plabel-color white ] ask patch 232 -5 [ set plabel "110" set plabel-color white ] ask patch 234 5 [ set plabel "114" set plabel-color red ] end to go ;; procedure of iteration set mylist-x lput result mylist-x ;; generation of the list with repeat 20 [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 after ;; the preset number of iterations 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) * 2 set ycor (last mylist-x) * 3 ] tick end to-report result ;; reports the result of iterations report last mylist-r * sin( pi * last mylist-x / 2) end to-report result-r ;; reports the result of r-increments with every iteration/tick report last mylist-r + 0.005 end to mark ;; marking the bifurcations by creating red color turtles ;; in respective zones if ticks >= 16900 [ ;; condition that makes respective button active only after ;; iterations are completed crt 1 [ set color red set shape "circle" set size 2 set xcor 166 set ycor 223 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 192 set ycor 283 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 198 set ycor 268 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 197 set ycor 272 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 192 set ycor 152 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 198 set ycor 124 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 197 set ycor 180 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 196.88 set ycor 294.58 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 197.99 set ycor 293.4 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 197.94 set ycor 277.31 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 197.12 set ycor 127.85 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 198.04 set ycor 131.96 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 197.96 set ycor 296.84 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 198.07 set ycor 168.56 ] crt 1 [ set color red set shape "circle" set size 2 set xcor 198.11 set ycor 189.32 ] ] end to mark-pw ;; marking a periodic window if ticks >= 16900 [ ask patches with [ pxcor = 212 ] [set pcolor red] ask patches with [ pxcor = 222 ] [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 >= 16890 [ ;; condition that makes the procedure valid after the set F-const? true ;; preset number of iterations ask patches with [ pxcor = 166 ] [set pcolor white] ask patches with [ pxcor = 192 ] [set pcolor white] ask patches with [ pxcor = 197 ] [set pcolor white] ask patches with [ pxcor = 199 ] [set pcolor white] ask patch 116 10 [ set plabel "L0" set plabel-color yellow ] ask patch 180 10 [ set plabel "L1" set plabel-color yellow ] ask patch 205 10 [ set plabel "L2/L3" set plabel-color yellow ] ask patch 130 300 [ 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' report (([xcor] of turtle 13701) - ([xcor] of turtle 13215)) / (([xcor] of turtle 13806) - ([xcor] of turtle 13701)) ] end

There is only one version of this model, created over 3 years ago by Victor Iapascurta.

## Attached files

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

Bifurcation diagram for iterated sin_f.png | preview | Preview for 'Bifurcation diagram for iterated sin_f' | over 3 years ago, by Victor Iapascurta | Download |

This model does not have any ancestors.

This model does not have any descendants.