On Wed, Feb 16, 2011 at 04:14:38PM -0500, Brian Tsai wrote: > Hi, > > I was wondering if anyone has implemented a numerically stable function to > compute log(sum(exp(x))) ?
Try the following log(sum(exp(x - max(x)))) + max(x) If this is not sufficient, consider using CRAN package Rmpfr with extended arithmetic. Petr Savicky. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.