Can anyone give me a hand for this derivative and how to avoid polygamma for coding propose.
I have the derivative of binomial distribution as follows:
$\frac{df(x)}{dx} = \binom{n}{x}p^x(1-p)^{n-x}ln[\frac{p}{(1-p)}]+p^x(1-p)^{n-x}\frac{d}{dx}\binom{n}{x}$
I find out that the derivative of binomial coefficient lead to polygamma:
$\frac{d}{dx}\binom{n}{x} = \binom{n}{x}[\psi(1-x+n)-\psi(x+1)]$
My first question is whether my derivative is right. If it is right then I would like to ask for programing sake, could someone help me rewrite the polygamma as summation or something else just to be able to understand how to compute this function. I just find the derivative of binomial coefficient from Wolfram. Please help and thank you in advance.
In his comment, Robert Israel pointed out the key issue.
In the post, you ask "could someone help me rewrite the polygamma as summation ?"
Well, you can rewrite $$\frac{d}{dx}\binom{n}{x} = \binom{n}{x}\left(\psi(1-x+n)-\psi(x+1)\right)=\binom{n}{x} \left(H_{n-x}-H_x\right)$$ where appear harmonic numbers.
But, just have a look here.