Nth derivative of $\tan^m x$

$m$ is positive integer,

$n$ is non-negative integer.

$$f_n(x)=\frac {d^n}{dx^n} (\tan ^m(x))$$

$P_n(x)=f_n(\arctan(x))$

I would like to find the polynomials that are defined as above

$P_0(x)=x^m$

$P_1(x)=mx^{m+1}+mx^{m-1}$

$P_2(x)=m(m+1)x^{m+2}+2m^2x^{m}+m(m-1)x^{m-2}$

$P_3(x)=(m^3+3m^2+2m)x^{m+3}+(3m^3+3m^2+2m)x^{m+1}+(3m^3-3m^2+2m)x^{m-1}+(m^3-3m^2+2m)x^{m-3}$

I wonder how to find general formula of $P_n(x)$?

I also wish to know if any orthogonal relation can be found for that polynomials or not?

EDIT:

I proved Robert Isreal’s generating function. I would like to share it.

$$g(x,z) = \sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} \tan^m(x) = \tan^m(x+z)$$

$$\frac {d}{dz} (\tan^m(x+z))=m \tan^{m-1}(x+z)+m \tan^{m+1}(x+z)=m \sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} \tan^{m-1}(x)+m \sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} \tan^{m+1}(x)= \sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} (m\tan^{m-1}(x)+m\tan^{m+1}(x))=\sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} (\dfrac{d}{dx}(\tan^{m}(x)))=\sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^{n+1}}{dx^{n+1}} (\tan^{m}(x))=\sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^{n+1}}{dx^{n+1}} (\tan^{m}(x))$$

$$\frac {d}{dz} ( \sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} \tan^m(x) )= \sum_{n=1}^\infty \dfrac{z^{n-1}}{(n-1)!} \dfrac{d^n}{dx^n} \tan^m(x) = \sum_{n=1}^\infty \dfrac{z^{n-1}}{(n-1)!} \dfrac{d^n}{dx^n} \tan^m(x)=\sum_{k=0}^\infty \dfrac{z^{k}}{k!} \dfrac{d^{k+1}}{dx^{k+1}} \tan^m(x)$$

I also understood that it can be written for any function as shown below .(Thanks a lot to Robert Isreal)

$$\sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} h^m(x) = h^m(x+z)$$

I also wrote $P_n(x)$ as the closed form shown below by using Robert Israel’s answer.

$$P_n(x)=\frac{n!}{2 \pi i}\int_0^{2 \pi i} e^{nz}\left(\dfrac{x+\tan(e^{-z})}{1-x \tan(e^{-z})}\right)^m dz$$

I do not know next step how to find if any orthogonal relation exist between the polynomials or not. Maybe second order differential equation can be found by using the relations above. Thanks for advice.

Solutions Collecting From Web of "Nth derivative of $\tan^m x$"

I don’t know if this will help:

The exponential generating function of $f_n(x)$ is
$$g(x,z) = \sum_{n=0}^\infty \dfrac{z^n}{n!} \dfrac{d^n}{dx^n} \tan^m(x) = \tan^m(x+z) = \left(\dfrac{\tan(x)+\tan(z)}{1-\tan(x)\tan(z)}\right)^m$$
So the exponential generating function of $P_n(x)$ is
$$G(x,z) = g(\arctan(x),z) = \left(\dfrac{x+\tan(z)}{1-x \tan(z)}\right)^m$$

The formula used to obtain the exponential generating function in Robert’s answer is most easily seen with a little operator calculus. Let $\rm\:D = \frac{d}{dx}.\,$ Then the operator $\rm\,{\it e}^{\ zD} = \sum\, (zD)^k/k!\:$ acts as a linear shift operator $\rm\:x\to x+z\,\:$ on polynomials $\rm\:f(x)\:$ since

$$\rm {\it e}^{\ zD} x^n =\, \sum\, \dfrac{(zD)^k}{k!} x^n =\, \sum\, \dfrac{z^k}{k!} \dfrac{n!}{(n-k)!}\ x^{n-k} =\, \sum\, {n\choose k} z^k x^{n-k} =\, (x+z)^n$$

so by linearity $\rm {\it e}^{\ zD} f(x) = f(x\!+\!z)\:$ for all polynomials $\rm\:f(x),\:$ and also for all formal power series $\rm\,f(x)\,$ such that $\rm\:f(x\!+\!z)\,$ converges, i.e. where $\rm\:ord_x(x\!+\!z)\ge 1,\:$ e.g. for $\rm\: z = tan^{-1} x = x -x^3/3 +\, \ldots$

I have been working on the problem of finding the nth derivative and the nth anti derivative of elementary and special functions for years. You are asking a question regarding a class of functions I have called “the class of meromorphic functions with infinite number of poles. I refer you to the chapter in my Ph.D. thesis (UWO, 2004) where you can find some answers.

For $m \ge 1$, $P_n(x) = m x^{m-n} (1+x^2) R_n(x^2)$ where $R_n(t)$ is a polynomial of degree $n-1$ such that $R_1(t) = 1$ and
$$R_{n+1}(t) = 2 t (t+1) R’_n(t) + (m-n + (m-n+2) t) R_n(t)$$