Systèmes Complexes : Une introduction par la pratique
Le site web du livre
4.1 Modèle du drapeau français
globals [ MAX-morphogene ] patches-own [ morphogene ancien-morphogene ] to startup setup set d 0.26 set r 0.003 set seuil-1 12 set seuil-2 81 end to setup clear-all set MAX-morphogene 500 ask patches [ ifelse (source?) [set morphogene MAX-morphogene] [set morphogene 0] ] reset-ticks end to-report source? report (pxcor = 0) end to-report puits? report (pxcor = max-pxcor) end to go diffuser resorber seuiller tick tracer end to diffuser ask patches [set ancien-morphogene morphogene] ask patches [ if (not source? and not puits?) [ let laplacien [ancien-morphogene] of patch-at -1 0 + [ancien-morphogene] of patch-at 1 0 - 2 * ancien-morphogene set morphogene ancien-morphogene + d * laplacien ] ] end to resorber ask patches [ if (not source? and not puits?) [set morphogene morphogene * (1 - r)] ] end to seuiller ask patches [ if (not source? and not puits?) [ifelse (seuil-2 < morphogene) [set pcolor blue] [ifelse (seuil-1 < morphogene) [set pcolor white] [set pcolor red]]] ] end to tracer clear-plot set-current-plot "morphogene vs. distance" set-current-plot-pen "morphogene" foreach sort patches [ask ? [plot morphogene]] set-current-plot-pen "seuil-1" ask patches [plotxy pxcor seuil-1] set-current-plot-pen "seuil-2" ask patches [plotxy pxcor seuil-2] endhaut
4.2 Modèle de réaction-diffusion de Turing
patches-own [ a i ] to startup setup set taux-reaction-A 0.04 set taux-reaction-I 0.0002 set vitesse-diffusion-A 4 set vitesse-diffusion-I 25 set taux-resorption 0.06 set seuil-activation 122 end to setup clear-all ask patches [ set a 1 + random 100 set i 1 + random 100 ] reset-ticks end to go reagir diffuser resorber seuiller tick tracer end to reagir ask patches [ let ancien-i i set i i + (taux-reaction-I * a * a) set a a + (taux-reaction-A * a * a / ancien-i) ] end to diffuser let taux-diffusion 0.10 repeat vitesse-diffusion-A [diffuse a taux-diffusion] repeat vitesse-diffusion-I [diffuse i taux-diffusion] end to resorber ask patches [ set a a * (1 - taux-resorption) set i i * (1 - taux-resorption) ] end to seuiller ask patches [ ifelse (seuil-activation < a) [set pcolor brown ] [set pcolor orange]] end to tracer set-current-plot "Activateur vs. Inhibiteur" plotxy (mean [a] of patches) (mean [i] of patches) endhaut