Pólya Urn Simulator
Mathematical Model
An urn holds balls of \(m\) colours, \(a_i\) of colour \(i\), \(A = \sum_i a_i\) in all. At each draw a ball is taken uniformly at random and returned together with \(k\) new balls of the same colour, so a colour that is drawn becomes more likely to be drawn again:
Watch a single urn lock in under One urn, then compare the spread of many independent urns with the Beta law under Many urns.
Parameters:
Parameters
The drawn ball is ringed and the balls returned with it are outlined; new balls land on top. Dotted lines mark the initial fractions, which are also the expected fractions after any number of draws. Past 400 balls the urn shows an evenly spaced sample of its contents. Same seed, same path.
Run the ensemble to view the histograms
Bars count how many urns ended in each bin; the line is the Beta limit scaled to the same units. Small runs update as you type; large ones wait for the button.