Presets
Playback
Camera
Layers
Quality
Model check
The science
A five-class Markov chain
Each person belongs to one of 5 classes (quintiles). Per generation they stay with probability p; otherwise they move one class up with weight 0.5 + u or down with weight 0.5 - u. At the top or bottom a blocked move means staying. This defines a transition matrix P (third graph; the green and red arrows and the ring on each terrace are its row), and the distribution evolves as πt+1 = πt P. The coloured bar on each terrace is the exact πt, the thin white bar above it is the stationary π*.
Convergence and persistence
For p > 0 the chain is irreducible and aperiodic, so it converges to a unique stationary distribution π* = π* P. The speed is the second-largest eigenvalue modulus |λ2| (readout): persistence close to 1 means families stay put for many generations (“sticky” mobility), and the number of generations to get within 1 % of π* grows like 1/(1 - |λ2|).
Two independent numerical checks
1. The figures are a Monte Carlo cohort: every one of the N agents follows its own random path. The total-variation distance between the exact πt and the cohort's class shares must stay below 0.03 for cohorts of 3000 or more (checked live at the displayed generation). The random order matches the 2D companion, so seed 12345 reproduces its counts.
2. A nearest-neighbour chain satisfies detailed balance, so its stationary vector has the closed form πi+1/πi = Pi,i+1/Pi+1,i. This is compared with the vector found by 4000 power-iteration steps; the two must agree to 1e-9.
Honest simplifications
Real mobility depends on education, geography, networks and policy and is not a nearest-class random walk; the model keeps two behavioural numbers so the mathematics stays exact and checkable. Quintile classes are assumed to have equal population only at the stationary state if u = 0. Only 2400 of the agents are drawn (1200 on Low); all N are counted in the graphs. The terraces, houses and figures are illustrative, not data about any country. This is an educational model, not a policy tool.
Things to try
Compare “Rigid society” with “Open society”: how many generations until the cohort forgets its start? Start in class 5 and watch the cohort drift down; set u = 0 and verify the stationary bars become flat; press “New seed” with a small cohort to see sampling noise.