The Mathematics of Happiness