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 194 times • Downloaded 6 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.)


## WHAT IS IT?

This is a model of an iterated logistic function f(x) = r * x * (1-x), which can be referred to as a logistic map, a nonlinear recurrence relation that plays a prominent role in chaos theory.

## HOW IT WORKS

The model is intended to visualize the behavior of a system described by the logistic function by plotting the iterated logistic function values and generating a final-state diagram.

Every time-step (tick) an iteration is performed with the result plotted on the time-series plot and a point is generated (i.e. a red color turtle is created). The last 10% of turtles are placed/plotted on the phinal state diagram.

Running the model after inputting different values for the initial condition (X0) and for the r-parameter one can observe that different values can finally lead to dramatically different long-term behavior, visualized by the time-series plot and final-state diagram (e.g. tend to zero, or a fixed point, exhibiting periodic oscillations, or chaotic behavior)

## HOW TO USE IT

* Input the X0 (initial condition value)

* Input r - parameter, which can be referred to as 'growth-rate parameter'

* Select and input the number of iterations

Press the SETUP button, then press the GO button to run the model.

Observe the plot and final-state diagram below it.

The monitor showing the last iterate value can be useful in case the model tends to a fixed point (e.g. for the r-parameter value between 1 and 3).

## THINGS TO NOTICE

Mathematically, iteration refer to the process of iterating a function i.e. applying a function repeatedly, using the output from one iteration as the input to the next. Iteration of apparently simple functions can produce complex behaviors. Iterated logistic function can be presented as an archetypal example of how complex, chaotic behavior can arise from very simple non-linear dynamical equations.

One of the first uses of the logistic equation f(x) = rx (1-x) (logistic map) was as a discrete-time demographic model, where X (for the first iteration known as X0) is a number between zero and one, that represents the ratio of existing population to the maximum possible population. The values of interest for the parameter r are those in the interval [0,4] (suggested things for the user to notice while running the model).

By varying the parameter r, the following behavior can be observed:

* between 0 and 1, the population will eventually die, independent of the initial population (X0)

* between 1 and 2, the population will quickly approach the value r - 1 / r, independent of the initial population.

* between 2 and 3, the population will also eventually approach the same value r - 1 / r, but first will fluctuate around that value for some time

* between 3 and approximately 3.45 from almost all initial conditions the population will approach permanent oscillations between two values (i.e. period two oscillations). These two values are dependent on r.

* between 3.45 and 3.54 (approximately), from almost all initial conditions the population will approach permanent oscillations among four values.

* with r beyond 3.54 the population will approach oscillations among 8 values, then 16, 32, etc.

* most values of r beyond 3.57 exhibit chaotic behavior after the end of the period-doubling cascade, described above. From almost all initial conditions, we no longer see oscillations of finite period.

Long-term behavior can also be observed on final-state diagram, where the fixed points are generated (e.g. one point of red color for r between 1 and 3; 2 points (i.e. period two behavior) for r between 3 and 3.45, etc.)

The number of iterations one needs to come to a conclusion about long-term behavior of the system greatly depends on r value (e.g. with r=2.0 about 50 iterates will be enough to conclude that the system tends to a fixed point, but with r=4 few hundreds or better few thousands iterates will be more illustrative).

## THINGS TO TRY

Run the model with different r values and observe the results on the plot and the final state diagram below it.

Run the model for r = 3.80 then for 3.83 and then for 3.90. What do you observe? How can you call this phenomenon, taking into account that starting with r = 3.57 the model enters the "area" of chaotic behavior?

If you want to see the values for all the iterations, type in the command line (at the bottom of the GUI window, to the right of ' observer > ' ) the command: show mylist

## EXTENDING THE MODEL

Although in this model all iterations are visible on the plot, the results of the first 90% iterations are skipped (i.e. not plotted on the phase-line below the plot). This is a ‘built in’ automatic procedure. In some cases for a better visualization it may be appropriate to set number of iterations to be skipped ‘manually’.

## NETLOGO FEATURES

This simple model is created in NetLogo and the final state diagram is generated by agents/turtles with coordinates from the list of values produced during function iterations. In order to focus on the final iterations, turtles are created only for last 10% of iterations.

## RELATED MODELS

This is the first model 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 bifurcation diagram for the logistic map. Comparing the behavior of the logistic function described by actual model and the 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. as a project in the framework of Introduction to Dynamical Systems and Chaos (Fall, 2017) MOOC by David Feldman @ Complexity Explorer (https://www.complexityexplorer.org/courses)

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 1 year 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 1 year ago, by Victor Iapascurta Download

This model does not have any ancestors.

This model does not have any descendants.