Integral with a gamma functions inside

80 Views Asked by At

I have a function based on the binomial distribution,

$$f(x;n,p)=\sum_{i=0}^{n} |x-i|\binom{n}{i} p^i (1-p)^{n-i}.$$

It's not so hard to plot this out with discrete points, but I'd like to smooth it as a continuous function.

So, for that, I should be moving to an integral. I will worry about the exact integral I want to use later, but I imagine I will have something of form similar to

$$h(x;n,p)=\int_{u=0}^n |x-u|\frac{\Gamma (n+1)}{\Gamma (u+1) \Gamma (n+1-u)} p^u (1-p)^{n-u} \:du$$

$$= C_n \int_{u=0}^n |x-u|\frac{p^u (1-p)^{-u}}{\Gamma (u+1) \Gamma (n+1-u)} \:du.$$

Is there any hope of dealing with these gamma functions? I understand most of these kinds of problems rely on cleverly applying some identities. Affine transformations are fine too if that will make things easier, but I'm having trouble here.

Thanks