Displaying 1 result from an estimated 1 matches for "lgammaapprox".
2009 Apr 22
2
integrate lgamma from 0 to Inf
..."roundoff error is detected in the extrapolation table", if i use 1.0e120 instead of Inf the computation works, but this is against the suggestion of integrates help information to use Inf explicitly. Using stirlings approximation doesnt bring the solution too.
## Stirlings approximation
lgammaApprox <- function(x)
{
0.5*log(2*pi)+(x-(1/2))*log(x)-x
}
integrate(lgamma, lower = 0, upper = 1.0e120)
integrate(lgammaApprox, lower = 0, upper = 1.0e120)
> integrate(lgamma, lower = 0, upper = 1.0e120)
1.374051e+242 with absolute error < 3.2e+235
> integrate(lgammaApprox, lower = 0, uppe...