The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.

## WHAT IS IT?

This model is a general testbed for exploring various examples of “non-ergodic” dynamical systems. In particular, it allows the exploration of iterated “games of chance” where “winnings” are carried forward, and hence results later in the game depend on earlier results.

This model is inspired by work (and lectures) by Ole Peters, who has lectured on aspects of this material at the Santa Fe Institute’s Complex Systems Summer School.

An example of discussion of various of these issues is available here:
Peters, Ole, and Klein, William,
Ergodicity Breaking in Geometric Brownian Motion
Arxiv.org, 4 Mar 2013, http://arxiv.org/abs/1209.4517

## HOW IT WORKS

Each agent begins the game with 1 unit of wealth (one dollar …). At each “tick”, the agent’s wealth is stochastically adjusted. This stochastic adjustment can either be the result of a “coin flip”, or the result of a draw from a probability distribution.

The adjustment is typically multiplicative, but may be (less interesting :-) additive.

## HOW TO USE IT

In default mode, at each “tick” a fair coin is fairly flipped for each turtle. If the coin comes up heads, the turtle’s wealth is multiplied by “Up” (see slider). If the coin comes up tails, then the turtle’s wealth is multiplied by “Down”.

A second option is “Normal”, in which case the the multiplier for each turtle for each “tick” is drawn from a normal distribution with mean “mu” and variance “sigma-sq”.

A third option is “Additive”, in which case the result of the coin flip either adds “Up”, or subtracts “Down”.

## THINGS TO NOTICE

Different values of the various parameters result in different behavior :-)

The display of the turtles moving around is, at this point, purely decorative :-). All the turtles start at the center, and then move around “randomly”. There is no connection between their movement and anything else in the model (hey, I like to have
fun things to watch :-).

## THINGS TO TRY

Move the sliders. Switch the switches. …

## EXTENDING THE MODEL

I’m sure you can come up with something …

## NETLOGO FEATURES

The “Step-cap” switch makes it easier to run the model for a given number of steps (“num-steps”).

## RELATED MODELS

The is, in general, a model exploring multiplicative random walks. Other “random walk” models may be relevant, or of interest.

## CREDITS AND REFERENCES

As noted above …

An example of discussion of various of these issues is available here:
Peters, Ole, and Klein, William,
Ergodicity Breaking in Geometric Brownian Motion
Arxiv.org, 4 Mar 2013, http://arxiv.org/abs/1209.4517

# CODE

```turtles-own [wealth losses]

to setup
clear-all
crt num-turtles [
set wealth 1
set losses 0
setxy 0 0
;setxy (random-float world-width)
;      (random-float world-height)    ; randomize turtle locations
]
reset-ticks
end

to go
move
[
ifelse 0 = random 2
[
set wealth wealth - 1 + Up
]
[
set wealth wealth - 1 + Down
]
]
[ ifelse Normal
[
; set wealth wealth * exp ((mu - sigma-sq / 2) + random-normal mu sqrt sigma-sq)
; set wealth wealth * exp ((mu - sigma-sq / 2) + (sqrt sigma-sq) * random-normal mu sqrt sigma-sq)
let rn random-normal mu sqrt sigma-sq
if rn < .0001 [ set rn .0001 ]
set wealth wealth * rn
; set wealth wealth * exp random-normal 0.0 0.05
]
[
ifelse 0 = random 2
[ set wealth wealth * Up
]
[ set wealth wealth * Down
set losses losses + 1
]
]
]
]
tick
if Step-cap [
if ticks > num-steps [stop]
]
end

to move