# Evaluate $c_k = \frac{1}{k!}\Big\{ \Big(\frac{d}{dz}\Big)^{k-1} f(z)^k \Big\} \Big|_{z=0}$ for $k=1,2,\dots$

I would like to compute $$c_k = \frac{1}{k!}\Big\{ \Big(\frac{d}{dz}\Big)^{k-1} f(z)^k \Big\} \Big|_{z=0}$$ for $$k=0,1,2,\dots$$, where $$f(z) = \frac{z[\cos( \alpha z ) +\sin(\alpha z)]}{\sin(\alpha z)}$$

So far I have defined the function $$f$$ as

f[z_, a_] := z (Cos[a z] + Sin[a z])/Sin[ a z]


and attempted to define a function

c[k_, a_] := 1/k! D[f[z, a]^(k - 1), {z, k}] /. z -> 0


Which evaluates the derivative, but this gives "Indeterminate expression ComplexInfinity+ComplexInfinity encountered." -- I'm not sure why. I haven't done symbolic calculations this complicated in Mathematica before and would love to see a demonstration to learn how.

f[z_, a_] = z (1 + Cot[a z]);

c[k_, a_] := Assuming[a > 0,
Limit[1/k! D[f[z, a]^k, {z, k - 1}], z -> 0]]

Table[c[k, a], {k, 1, 10}]
(*    {1/a, 1/a, 2/(3 a), 0, -4/(5 a), -4/(3 a), -8/(7 a), 0, 16/(9 a), 16/(5 a)}    *)


Closed-form expression:

Table[c[k, a] == 2^(k/2)/(a k) Sin[2π k/8], {k, 10}]
(*    {True, True, True, True, True, True, True, True, True, True}    *)