Skip to content
Prev 138887 / 398506 Next

Numerical Integration in 1D

On Fri, 7 Mar 2008, Max wrote:

            
ln(x) e^x x^n is not integrable on (0, Inf).  You presumably slipped over 
a minus sign, but your definition of gamma(n) is wrong -- see ?gamma.

integrate(function(x) exp(-x)*x^n, lower=0, upper=Inf)

will work for gamma(n+1).