(WASHINGTONPOST) — Do you remember the last time you were dreading something, only to have it turn out to be a pleasant surprise? Maybe it was a bad summer blockbuster you were forced to watch, or a blind date set up by your parents.

You turn up, grumbling and prepared to hate every second of it. But then a funny thing happens: You crack a smile–laugh out loud, even–and before you know it, you’re having a grand old time.

It turns out that the element of surprise has a big impact on how we feel from moment to moment and that we’re happier when satisfied unexpectedly instead of certain of a positive outcome in advance, according to a new mathematical model of happiness. A study of this was published online Monday in the Proceedings of the National Academy of Sciences.

Note: Read our discussion guidelines before commenting.