TITLE: Is it possible to find the $n$-derivative of $\csc(m\pi)?$
QUESTION [5 upvotes]: I am trying to find the $n$-th derivative of $\csc(m\pi)$, so I took few cases:
for simplicity let $x=\cot(m\pi)$ and $y=\csc(m\pi)$,
$$\frac{d^0}{dm^0}\csc(m\pi)=\pi^0(\color{red}{1}x^0y^1)$$
$$\frac{d^1}{dm^1}\csc(m\pi)=-\pi^1 (\color{red}{1}x^1y^1)$$
$$\frac{d^2}{dm^2}\csc(m\pi)=\pi^2(\color{red}{1}x^2y^1+\color{red}{1}x^0y^3)$$
$$\frac{d^3}{dm^3}\csc(m\pi)=-\pi^3(\color{red}{1}x^3y^1+\color{red}{5}x^1y^3)$$
$$\frac{d^4}{dm^4}\csc(m\pi)=\pi^4(\color{red}{1}x^4y^1+\color{red}{18}x^2y^3+\color{red}{5}x^0y^5)$$
$$\frac{d^5}{dm^5}\csc(m\pi)=-\pi^5(\color{red}{1}x^5y^1+\color{red}{58}x^3y^3+\color{red}{61}x^1y^5)$$
$$\frac{d^6}{dm^6}\csc(m\pi)=\pi^6(\color{red}{1}x^6y^1+\color{red}{179}x^4y^3+\color{red}{479}x^2y^5+\color{red}{61}x^0y^7)$$
and saw that
\begin{align}
\frac{d^n}{dm^n}\csc(m\pi)&=(-\pi)^n\sum_{k=0}^{\lfloor{n/2}\rfloor}\color{red}{a_k} x^{n-2k}
y^{2k+1}\\
&=(-\pi)^n\sum_{k=0}^{\lfloor{n/2}\rfloor}\color{red}{a_k} \cot^{n-2k}(m\pi)\csc^{2k+1}(m\pi)\\
&=(-\pi)^n\csc^{n+1}(m\pi)\sum_{k=0}^{\lfloor{n/2}\rfloor}\color{red}{a_k} \cos^{n-2k}(m\pi)
\end{align}
If we replace $n$ by $2n$ then separate the last term we have
$$\frac{d^{2n}}{dm^{2n}}\csc(m\pi)=\pi^{2n}\csc^{2n+1}(m\pi)\left[a_n+\sum_{k=0}^{n-1}\color{red}{a_k} \cos^{2n-2k}(m\pi)\right]$$
In the cases mentioned above, we notice that when the order of the derivative is $0, 2, 4, 6$, the coefficients of the last terms are $1, 1, 5, 61$ which match the absolute value of the Euler numbers:
$$E_0=1, E_2=-1, E_4=5, E_6=-61$$
and so
$$\frac{d^{2n}}{dm^{2n}}\csc(m\pi)=\pi^{2n}\csc^{2n+1}(m\pi)\left[|E_{2n}|+\sum_{k=0}^{n-1}\color{red}{a_k} \cos^{2n-2k}(m\pi)\right]$$
By the way, if we take the limit to both sides of the last result letting $m$ approach $1/2$, we have
$$\lim_{m\to \frac12}\frac{d^{2n}}{dm^{2n}}\csc(m\pi)=\pi^{2n}(1)\left[|E_{2n}|+0\right]=|E_{2n}|\pi^{2n}.$$

Question: Is it possible to find $\color{red}{a_k}$?

REPLY [2 votes]: Thanks to @Domen for his solution, the answer is
$$\frac{d^n}{dm^n}\csc(m\pi)=(-\pi)^n\csc^{n+1}(m\pi)\sum_{k=0}^{\lfloor{n/2}\rfloor}t(n,k) \cos^{n-2k}(m\pi)$$
where
$$t(n,k)=(2k+1)t(n-1,k)+(n-2k+1)t(n-1,k-1)$$
and
$$t(n,0)=1$$

Different form:
The $n$-th derivative of $\sec(x)$ is given by Wolfram:
$$\frac{d^{ n}}{d{x}^{n}}\sec(x)= \sum_{k=0}^{\infty} \frac{|E_{2 k}|}{(2 k-n) !}  x^{2 k-n}$$
Proof:
By Taylor series we have
$$\sec(x)=1+\frac1{2!}x^2+\frac{5}{4!}x^4+\frac{61}{6!}x^6+....=\sum_{k=0}^\infty\frac{|E_{2k}|}{(2k)!}x^{2k}$$
Take the $n$-th derivative to both sides
$$ \frac {d^{ n}}{d{x}^{n}}\sec(x)=\sum_{k=0}^\infty\frac{|E_{2k}|}{(2k)!} \frac {d^{ n}}{d{x}^{n}}x^{2k}$$
We have
$$\frac {d}{dx}x^{2k}=2k x^{2k-1}$$
$$\frac {d^{ 2}}{d{x}^{2}}x^{2k}=2k(2k-1) x^{2k-2}$$
$$\frac {d^{ 3}}{d{x}^{3}}x^{2k}=2k(2k-1)(2k-2) x^{2k-3}$$
note that
$$2k(2k-1)(2k-2)*\color{red}{\frac{(2k-3)(2k-4)...}{(2k-3)(2k-4)...}}=\frac{(2k)!}{(2k-3)!}$$
so in general we have
$$\frac {d^{ n}}{d{x}^{n}}x^{2k}=\frac{(2k)!}{(2k-n)!}x^{2k-n}$$
Thus,
$$ \frac {d^{ n}}{d{x}^{n}}\sec(x)= \sum_{k=0}^{\infty} \frac{|E_{2 k}|}{(2 k-n) !}  x^{2 k-n}$$
Finally, by using $\sec(x-\pi/2)=\csc(x)$ we have
$$ \boxed{\frac {d^{ n}}{d{x}^{n}}\csc(x)= \sum_{k=0}^{\infty} \frac{|E_{2 k}|}{(2 k-n) !}  \left(x-\frac{\pi}{2}\right)^{2 k-n}}$$

Edit. A more rigorous proof: Let $z=x+1/2$,
\begin{gather*}
\lim_{z\to \frac12}\frac{d^{2a}}{d z^{2a}}\csc(z\pi)=\lim_{x\to 0}\frac{d^{2a}}{d x^{2a}}\csc\left(x\pi+\frac{\pi}{2}\right)\\
=\lim_{x\to 0}\frac{d^{2a}}{d x^{2a}}\sec(x\pi)\\
\left\{\text{expand $\sec(x\pi)$ in series}\right\}\\
=\lim_{x\to 0}\frac{d^{2a}}{d x^{2a}}\sum_{k=0}^\infty \underbrace{\frac{|E_{2k}|\pi^{2k}}{(2k)!}}_{f_{2k}}x^{2k}\\
=\lim_{x\to 0}\frac{d^{2a}}{dx^{2a}}\sum_{k=0}^\infty f_{2k}\,x^{2k}\\
=\lim_{x\to 0}\frac{d^{2a}}{dx^{2a}}\left(f_0x^0+f_2x^2+f_4x^4+...\right)\\
=(2a)! f_{2a}\\
=(2a)!\frac{|E_{2a}|\pi^{2a}}{(2a)!}\\
=|E_{2a}|\pi^{2a}.
\end{gather*}