Moody people are often baffling to those of us with steadier emotions.
But scientists argue that changing moods – as seen in sulking teenagers, grumpy spouses, or bad-tempered parents - serve an important purpose.
Rather than being a weakness, they are nature's way to of helping us adapt to an ever changing world. So when times are good and spirits are high, we take more risks at a time they are likely to be rewarded.
And when times are tough, sulking can help us conserve our energy.
To take a human example, a stock market trader who makes a successful deal becomes more optimistic about the outcome of his next transaction.
He is then likely to take more risks – as he becomes more optimistic things will go in his or her favour.
The increase in risk taking allows him to make maximum gains at a time when risk taking is most likely to pay off.
This holds true when a variety of different events have an underlying connection, the authors argue.
To take an example from the natural world, the authors suggest an animal's mood improves on finding a number of fruits in a tree.
Rather than assessing each tree individually, this good mood helps the animal to look at the big picture – and optimistically make it think fruits are in abundance.
This encourages the animal to climb up the neighbouring branch – where good conditions make it more likely that there will be a tasty fruit available.
It may be increased rainfall or sunshine has caused fruit to become more abundant, the authors suggest.
'In this situation, it makes little sense to update expectations for each tree independently,' the authors write, and makes the animal expect 'a general increase in reward and update expectations for all related trees accordingly.'
Eran Eldar, of University College London said: 'This effect of mood should be useful whenever different sources of reward are interconnected or possess an underlying momentum.
'That may often be the case in the natural as well as in the modern world, as successes in acquiring skills, material resources, social status, and even mating partners may all affect one another.'
When rewards are starting to thin out – for example if winter is coming – then a negative mood will result in an individual event, such as finding a fruit, being 'downgraded'– allowing behaviour and expectations to be quickly adjusted downwards.
The authors suggest that this could lead to behaviours such as an animal deciding to save energy and hibernate instead of rushing around.