Scientists find an equation which predicts momentary happiness, when participants performed better than expected during a task.