powered by NetLogo

view/download model file: Recursive_Logistic_Chaos.nlogo

WHAT IS IT?

This model creates a bifurcation map for the logistic equation, y -> y+r* y(1-y)
for a ranging between 0 and 3. In addition, there is an option to play an instrument using the sound extension, with the frequency depending on the value of the dynamical variable, y.

 

HOW IT WORKS

The logistic equation, y ->y + r* y(1-y) is iterated for a given value of the growth factor "r" specified by a slider on the interface. The initial value of y is set to 0.1 and the equation is iterated 101 times to remove transients. One turtle is used to as a pen for plotting points. When the create-map button is pressed points are plotted for values of the growth factor "r" ranging from 0 to 3, resulting in a bifurcation map. When the go button is pressed points are continuously plotted for a fixed value of "r" which is specified by a slider. A musical note is played for each point plotted, with frequency and loudness determined by "y" and instrument and duration determined by choosers and sliders on the interface.

 

HOW TO USE IT

Choose a coloring scheme, press setup and then create the map. Now press go and move the slider for the growth factor "r" to hear the music of chaos. Change the instrument loudness and note duration to make your own composition.

 

THINGS TO TRY

Use the bifurcation map to locate regions of order in the chaotic portion of the map. Press go and select the values of the growth factor "r" in the regions where there is order. Here the transition from chaos to order.

 

EXTENDING THE MODEL

It should be possible to add a chooser that would give bifurcation maps for different dynamical equations. You could also choose different schemes for determining the frequency, instrument, loudness and duration of the notes played. For example, in regions where there is a fixed point, or periodic fixed point, you could map the duration of the note to the time it takes to approach to within some small interval around the fixed point.

 

RELATED MODELS

See the other Chaos Models in this series

 

COPYRIGHT NOTICE

Copyright 2006 David McAvity

This model was created at the Evergreen State College, in Olympia Washington
is part of a series of applets to illustrate principles in physics and biology.

Funding was provided by the Plato Royalty Grant.

The model may be freely used, modified and redistributed provided this copyright is included and it not used for profit.

Contact David McAvity at mcavityd@evergreen.edu if you have questions about its use.

 

PROCEDURES

extensions [ sound ]
globals[y  time b]
 
; create a turtle for plotting and initialize the dynamical variable y
to setup
ca
crt 1 [set color red
       set size 5]
set y 0.1
end
 
; the dynamical equations are iterated 101 times to eliminate transients, then a point (a,y) is plotted with y
; ranging from 0 to 1 and a from 1 to 4. When a point is plotted and a note is played, with frequency and loudness
; depending on the value of y, and instrument and duration determined by the user on the interface.
to go
 repeat 101 [set y (y + r * y * (1 - y)) ]
    ask turtles [ 
        setxy (((r  ) * world-width / 3 ) + min-pxcor - 1) (( y * world-height / 2 ) + min-pycor)
        ask patch-here [ recolour ]] 
sound:play-note instrument (50 * y + 10)  (loudness - 30 * y) note-duration 
 wait 2 * note-duration
end
 
; there are options for three differenet color schemes
to recolour
    if colour-scheme = "random" [ set pcolor 10 * (random 14) + 5 ]
    if colour-scheme = "rainbow" [set pcolor (floor (14 * y) )* 10 + 5 ]
    if colour-scheme = "red" [set pcolor red]
end
 
; this procedure creates a bifurcation map by stepping through different growth-rates 
; from b=1 up to b=4
to create-map
  ca 
  crt 1 [set color red
         set size 10
         set shape "circle"]
  set b 0
  let db (3.0 / world-width)  
  while [ b < 3 ] [
       set y 0.1
       repeat 127 [set y (y +   b * y * (1 - y)) ]  ; remove transients
       repeat 31 [set y (y +  b * y * (1 - y))    ; now plot enough points to generate a pattern
           ask turtles [ 
              setxy (((b ) * world-width / 3 ) + min-pxcor - 1) (( y * world-height / 2 ) + min-pycor)
              ask patch-here [ recolour] ] ]
       set b b + db ]
end
 
;;  ***  Copyright notice  ***
;;
;;   Copyright 2006 David McAvity
;;
;; This model was created at the Evergeen State College, in Olympia Washington
;; as part of a series of applets to illustrate principles in physics and biology. Funding was provided
;; the Plato Royalty Grant
;; 
;; The model may be freely used, modified and redistribued provided this copyright is included and
;; it not used for profit.
;;
;; Contact David McAvity at mcavityd@evergreen.edu if you have questions about its use.