Ehrenfest Urn Model
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
;;;;;;;;;;;;;;;;;;;;;; ;; setup procedures ;; ;;;;;;;;;;;;;;;;;;;;;; globals [ prob ratio ;; ratio between number of balls in urn A and total number of balls urnA ;; number of balls in urn A sum-ratio sum-ratio-square mean-ratio mean-ratio-square var ] ;; sets up the patches and creates turtles to setup clear-all ask patches [ set pcolor gray + 3 ] crt 1 [ set color black set shape "dot" set pen-size 3 setxy 0 0 set heading 0 pd forward 50 die ] init-vars setup-turtles reset-ticks end to init-vars set ratio (ratio-two-urns / (1 + ratio-two-urns)) set urnA (number-of-particles * ratio) set sum-ratio 0 set sum-ratio-square 0 end ;; determines the number of turtles and their color to setup-turtles create-turtles urnA [ set size 2 set shape "dot" set ycor (random-float 50) set xcor (- (random-float 24)) - 1 set color blue ] create-turtles (number-of-particles - urnA) [ set size 2 set shape "dot" set ycor (random-float 50) set xcor (random-float 24) + 1 set color red ] end ;;;;;;;;;;;;;;;;;;;;;;;; ;; runtime procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;; to go ask one-of turtles [ ifelse (color = blue) [ set color red set xcor (random-float 24) + 1 ] [ set color blue set xcor (- (random-float 24)) - 1 ] ] set urnA (count turtles with [color = blue]) set ratio (urnA / number-of-particles) tick end
There is only one version of this model, created almost 12 years ago by Do Trong Thanh.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Ehrenfest Urn Model.png | preview | Preview for 'Ehrenfest Urn Model' | almost 12 years ago, by Do Trong Thanh | Download |
This model does not have any ancestors.
This model does not have any descendants.