Hi, I was wondering if anyone has implemented a numerically stable function to compute log(sum(exp(x))) ? Thanks! Brian [[alternative HTML version deleted]]
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.