It is exhilarating to watch a large flock of birds swarming in ever-changing patterns. Swarming is an emergent behaviour, resulting from a set of simple rules followed by each individual animal, bird or fish, without any centralised control or leadership.
A murmuration of starlings is a breathtaking sight, with thousands of birds moving in harmony, almost filling the skies. They may be seen just before dusk, as they gather over their roosting site, performing their acrobatics before settling for the night. Starling murmurations can be seen in many parts of Ireland but, despite the tens of thousands of birds in a flock, starling numbers have fallen drastically in recent decades.
When Aristotle observed that the whole may be greater than the sum of its parts, he must have been thinking of the phenomenon of emergence. Emergence is large-scale behaviour resulting from multitudinous interactions at smaller scales. Life itself is the primary example, resulting from chemical processes at the atomic scale.
The natural world abounds in emergence: ripples in the sand, cyclones in the atmosphere, the growth of crystals, patterns in plants and zebra stripes are all examples. The laws of classical mechanics emerge from the rules of quantum mechanics applied on macroscopic scales. They can predict many things, but it would be difficult to predict a rainbow if one had never been observed.
Randomness at small scales can result in orderly patterns at large scales. The patterns may be geometrically simple, like the rainbow, or highly intricate like ice-crystals on a window. The latter are fractals, beautiful and intricate patterns arising from very simple rules. The most complex of these, the Mandelbrot set, is generated by repeated application of a simple quadratic expression.
Swarming is a behaviour pattern exploited by many animal species. There is flocking of birds, shoaling of fish, herding of wildebeests and so on. Why do birds and animals evolve swarming behaviour? The primary reasons are defence against predators, keeping warm at night and sharing information on good feeding areas. Swarm behaviour can be simulated using mathematical models implemented as algorithms or computer programs.
One of the earliest computer simulations of swarming was done with an algorithm called Boids. The program represented each bird as a point moving in accordance with three simple rules, called alignment, cohesion and separation. Each bird moves in the same direction as its neighbours, stays comfortably close to them and takes evasive action to prevent collisions. To evade predators, additional strategies are required. The Boids algorithm produced realistic simulations of bird flocks.
A collection of people may also engage in swarm behaviour, in sporting events, demonstrations, riots, strikes, and religious assemblies. The stock market exhibits herd behaviour, with frenzied buying and selling. This is often driven by emotion rather than reason, with greed not far from sight.
Modellers struggle to simulate this and to predict the markets. The mathematical modelling of swarming behaviour is also useful in computer animation. Computer simulations have been used in many films, creating crowd scenes that appear realistic.
Originally for modelling birds, the Boids algorithm was later applied to shoaling fish and other swarming animals. Subsequent models have used more elaborate rules, with several concentric zones surrounding each bird, resulting in more faithful simulation of observed behaviour. However, recent research with starling flocks indicates that each bird is influenced primarily by the six or so birds closest to it.
Peter Lynch is emeritus professor at UCD school of mathematics & statistics – He blogs at thatsmaths.com