Higher order derivatives of a simple rational function Consider $$f(z) = \frac{(p_1z^2+p_2z+p_3)^n}{1-z}\quad z\in \mathbb{R}$$ where $p_1+p_2+p_3 = 1$.
I want to find a closed form solution for $f^{(k)}(0)$ where $1\le k \le 2n$.
Substituting $1-z=-t$ reduces the function to $$g(t) = -\frac{(p_1t^2+p_4t+1)^n}{t}$$ where $p_4$ is another constant. Am I correct in assuming that the $k^{th}$ derivative of $g(t)$ at $t=1$ is the same as $f^{(k)}(0)$?  
Is this the correct way to proceed?  I have tried the Leibniz rule and multinomial expansion but have been stuck in both approaches. 
Any help would be greatly appreciated. If an exact formula is too complicated, approximations would be equally helpful. 
 A: I will write $a,b,c$ instead of $p_1,p_2,p_3$. Observe the equality $\frac1{1-z} = \sum z^n$ and the trinomial expansion identity,
$$ (a+b+c)^n = \sum_{\substack{i,j,k\\i+j+k=n}} \binom{n}{i,j,k}a^ib^jc^k,$$
and also the formula for the coefficients of a product of two series,
$$ (\sum a_N)( \sum b_N) = \sum c_N, \quad c_N = \sum_{i+j=N}a_i b_j.$$
Plugging in, we find the following horrendous equality,
$$(az^2+bz + c)^n = \sum_{i+j+k=n} \binom{n}{i,j,k} a^i b^j c^k z^{2i + j}= \sum_{N=0}^{2n} \left(\sum_{\substack{i,j,k\\ i+j+k=n\\2i+j=N}}  \binom{n}{i,j,k}a^ib^jc^{k}\right)z^N =: \sum_{N=0}^\infty a_N z^N,$$
where $a_N:= 0$ for $N>2n$. This can probably be made neater but I'd call it closed form.
Now use the product formula,
$$f(z) = (\sum_N z^N)( \sum_N a_N z^N) = \sum_N c_N z^N,\quad c_N = \sum_{m=0}^Na_m.$$
The numbers $N! c_N = f^{(N)}(0)$ are precisely what you are looking for. 
As a sanity check I will compute $c_0$ explicitly using this formula. Observe $c_0 = \sum_{N=0}^0 a_N = a_0$, and $N=0$, $2i+j=N$ means that $i=j=0$, so that $k=n$. Also $\binom{n}{0,0,n} = 1$. Hence, 
$$ c_0 = c^n. $$
Comparing with the original formula, $c^n$ is indeed the $y$-intercept of $f$, which is encouraging.
I'm not sure if I can simplify the above expression for $a_N$ but there's at least a more explicit formula. observe that there are 2 restrictions in the summation; therefore for fixed $k$ that we can solve for $i,j$ by solving the matrix equation
$$\begin{bmatrix} 1 & 1 \\ 2 & 1 \end{bmatrix} \binom{i}{j} = \binom{n-k}{N}.$$
So if we introduce shorthand for the $\mathfrak B$ig term, $\mathfrak B(i,j,k):=\binom{n}{i,j,k}a^ib^jc^{k}$, then
$$a_N =  \!\!\!\!\!\!\sum_{k=\max(0,{n-N})}^{\min(n,2n-N)} \!\!\!\!\!\!\!\mathfrak B(-n+k+N,2n-2k-N,k),$$ and hence
$$f^{(M)}(0) = M! \sum_{N=0}^M \sum_{k=\max(0,{n-N})}^{\min(n,2n-N)} \!\!\!\!\!\!\! \mathfrak B(-n+k+N,2n-2k-N,k). $$
Or, if you prefer,
$$f^{(M)}(0) = M! \sum_{N=0}^M \sum_{k=\max(0,{n-N})}^{\min(n,2n-N)} \binom{n}{-n+k+N,2n-2k-N,k}a^{-n+k+N}b^{2n-2k-N}c^{k}. $$
