The sight of hundreds of starlings swooping and diving in unison at dusk is one of the wonders of nature.
Scientists and naturalists have marvelled at how the birds make shape-shifting clouds, known as murmurations.
Researchers in Italy have undertaken the most detailed analysis yet of the physics of these aerial stunts.
Their mathematical model suggests starlings copy other birds' flight paths and only make small speed fluctuations.
"There is no leader in a flock; everyone imitates its neighbours," said Dr Antonio Culla of Università Sapienza in Rome.
"And each bird is able to change its velocity a little bit in a very easy way."
Starling 'cloud' sightings call
Why do starlings 'dance' in the sky?
The physicists analysed video footage of starling flocks ranging in size from 10 birds to 3,000 to develop a mathematical model for this flocking behaviour.
They then used computer simulations of an artificial flock of birds to check their mathematical model matched what happens in the real world.
The scientists say the study, published in Nature Communications, could help in developing swarms of drones that can fly collectively over fields to tend crops. It may also help in finding new ways to track space debris.
Murmurations are huge groups of starlings that come together at dusk to swoop and dive across the sky before roosting for the night.
It's thought this offers protection from predators such as peregrine falcons, who find it hard to single out just one starling from a whirling mass of thousands.