# Calculate conditional expectation of log(x) with gamma density

How to calculate the following expression:

$$\int_0^u{\ln(x)x^{k-1}e^{-x}}\;dx$$

As I know,

$$\int_0^\infty{\ln(x)x^{k-1}e^{-x}}dx = \Gamma(k)\Psi(k)$$

Are there any way to transfer the integral as expression by digamma, gammaln functions?

Or, are there any fast but also precise enough way to evaluate the integral? Thanks. Matlab's numerical integration directly is not so fast, but if there is a relation with the built in functions such as psi, gammaln, then that'll meet the need.

-
Do you want the integral over $x \in [0,u]$ or $x \in [0,\infty)$? L.Silberman's answer addresses the latter. – Noam D. Elkies Nov 28 '11 at 15:47
Yes, and probably "Psi" is matlab's name for the logarithmic derivative. I withdraw my answer. The expectation in question is instead the logarithmic derivative of the <i>incomplete</> gamma function. I think most programs have a built-in for that, so perhaps one thing to try is numerical differentiation of the incomplete gamma function? – Lior Silberman Nov 28 '11 at 17:28
Thanks for your comments, that's still a numerical way, no better than direct solving numerical integral. Ideally, I am looking for an explicit relation with the so called incomplete gamma function(in matlab: gammainc), or other matlab built-in functions such as (psi,gamma,gammaln,etc). Numerical methods whether differentiation w.r.t k of the incomplete gamma or just integration directly are considered just as an alternative then if there are no explicit relations. – user19213 Nov 29 '11 at 10:49