Iterated Logistic function with final-state diagram

Iterated Logistic function with final-state diagram preview image

1 collaborator

Tags

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.1 • Viewed 540 times • Downloaded 26 times • Run 0 times
Download the 'Iterated Logistic function with final-state diagram' modelDownload this modelEmbed this model

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 globals
  mylist
  axis
 ]

breed [ axis-turtles axis-turtle ] ;; these are turtles as part (i.e. axes tips) of X and Y axes
breed [ m-turtles m-turtle ]       ;; thes are turtles to be plotted on the final-state diagram

patches-own [ ;; properties of patches used to generate the coordinates axes
  alpha
  omega
]

to setup
  ca
  set mylist  list (0) (X0)  ;; setting the intial list of values
  create-axis                ;; to be iterated by logistic function
  setup-alpha                ;; setting components of X and Y axes
  setup-omega
  reset-ticks
end 

to create-axis                                        ;; creating X and Y axes
  ask patches with [ pycor = 0 ] [ set pcolor white ]
    create-axis-turtles 1 [
    set color yellow
    set size 8
    set heading -90
    setxy 0 0
  ]
    create-axis-turtles 1 [
    set color yellow
    set size 8
    set heading 90
    setxy 400 0
  ]
end 

to setup-alpha
  ask patch 5 5
  [ set plabel "0"
    set plabel-color white ]
end 

to setup-omega
  ask patch 398 5
  [ set plabel "1.0"
    set plabel-color white ]
end 

to go                                    ;; this is the procedure of iteration

 if r-parameter > 4 or X0 > 1 or X0 < 0  ;; the message that will appear if r or X0 values
  [                                      ;; are set outside the recommende range
    ask patch 350 4
    [ set plabel "ERROR: r must be between 0 and 4.0 // X0 must be between 0 and 1.0."
      set plabel-color yellow ]
      stop
  ]


  set mylist lput result mylist       ;; procedure of iteration where the results are added to a list
  if ticks >= Num-iterations [ stop ] ;; and a new turtle of red color is created with every iteration
  create-m-turtles 1 [                ;; result of the iteration serves as x-coordinates for this turtle
    set color red                     ;; according to which it is plotted on final state diagram
    set shape "circle"
    set size 5
    setxy (last mylist * 400) (0)
  ]

  if ticks <= (num-iterations) / 1.1  ;; only last 10% of turtles are plotted
  [ask m-turtles [die]]

  tick
end 

to-report result                                         ;; reporter describing the iteration procedure
  report  r-parameter * last mylist * (1 - last mylist)  ;; based on previous iteration result
end 

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

Attached files

File Type Description Last updated
Iterated Logistic function with final-state diagram.png preview Preview for 'Iterated Logistic function with final-state diagram' about 7 years ago, by Victor Iapascurta Download

This model does not have any ancestors.

This model does not have any descendants.