logsumexp function

Log of sum of exponentials