Systèmes Complexes : Une introduction par la pratique

Le site web du livre

5.2 Fonctions logistiques

to setup
  clear-all
  tracer-logistique
end

to tracer-logistique
  clear-patches
  let x 0 
  repeat max-pxcor [   
     let xx (x / max-pxcor) 
     let y (logistique k xx) * max-pxcor 
     ask patch x y  [set pcolor white] 
     set x x + 1
  ]
end

to-report logistique [pk px] 
   report pk * px * (1 - px) 
end
	     

haut

5.3 Modélisation de la dynamique d'évolution d'une population

to setup
  clear-all
  create-turtles 1 [
     set color yellow
  ]
  tracer
end

to tracer
   tracer-logistique
   tracer-bissectrice
   tracer-dynamique
end

to tracer-dynamique
   clear-drawing
   ask turtle 0 [
      pen-up
      setxy (x0 * max-pxcor) 0
      pen-down
      repeat 500 [
         set ycor (logistique k (xcor / max-pxcor)) * max-pycor
         setxy ycor ycor 
      ]
   ]
end
	     

haut

5.4 Sensibilité à la condition initiale

globals [
   list-x 
]

to setup
   clear-all
   set list-x n-values max-pxcor [random-float 1]
   set list-x n-values max-pxcor [0.333333 + random-float 0.000001]
   tracer
end

to go
  set list-x (map [logistique k ?] list-x) 
  tick
  tracer
end

to tracer
  let i 0 
  repeat max-pxcor [
     ask patch i ((item i list-x) * max-pycor) 
        [set pcolor white]
     set i (i + 1) 
  ]
  evaporer-trace
end

to evaporer-trace
     ask patches [set pcolor (pcolor * 0.99)] 
end
	     

haut

5.5 Diagramme de bifurcations

globals [liste-k liste-x]

to setup
   clear-all
   set liste-k n-values max-pxcor [? / max-pxcor * 4] 
   set liste-x n-values max-pxcor [random-float 1]  
   tracer
   reset-ticks
end

to go
  set liste-x (map [logistique ?1 ?2] liste-k liste-x)
  tick
  tracer
end

to tracer
  (foreach liste-k list-x [
      ask patch ((?1 / 4) * max-pxcor) (?2 * max-pycor)
         [set pcolor white]
      ]
  )
  attenuer-trace
end

to attenuer-trace
  ask patches [set pcolor pcolor * 0.99]
end
	     

haut