I'm trying to calculate multiple derivatives of iterated functions, but I'm already having trouble at the the thrid one, which is worrying, because I started with the ambition of calculating arbitrary numbers of derivatives of arbitrarily often iterated functions.
I defined iterated functions like this: $$f_0(x)=x$$ $$f_1(x)=f(x)$$ $$f_n(x)=f(f_{n-1}(x))$$
I know it is usually written as $f^n(x)$, but since I have to write lots of derivatives like this $\frac{d^k}{dx^k}f(x)=f^{(k)}(x)$ I went for a subscript.
Then I started calculating and trying to spot the pattern. The first derivative was obvious pretty soon: $$\frac{d}{dx}f_n(x)=\prod_{k=0}^{n-1}f^{(1)}(f_k(x))$$ Which is just the chain-rule used $n$ times.
But already at the second derivative, things got complicated pretty quickly. I ended up writing it like this: $$\frac{d^2}{dx^2}f_n(x)=\sum_{i=0}^{n-1}\left[f^{(2)}\left(f_i(x)\right) \prod_{j=0}^{i-1}f^{(1)}(f_j(x))\prod_{\substack{k=0\\k\neq i}}^{n-1}f^{(1)}(f_k(x))\right]$$ I obtained this by using the product rule on the first derivative.
$f^{(2)}\left(f_i(x)\right)\prod_{j=0}^{i-1}f^{(1)}(f_j(x))$ Is the derivative of the $i$-th factor of the first derivative. The remaining terms in the product are: $\prod_{\substack{k=0\\k\neq i}}^{n-1}f^{(1)}(f_k(x))$
The important part is that I never wanted sub- and superscripts mixed on one $f$. Otherwise I could write the second derivative like this (leaving out the dependency upon $x$):
$$f_n^{(2)}=\sum_{i=0}^{n-1}\left[f^{(2)}\left(f_i\right) f_i^{(1)}\frac{f^{(1)}_n}{f^{(1)}\left(f_i\right)}\right]$$
That's how far I got, but now I can't find a expression for even just the next derivative. I feel like I'm missing some sort of formalism for writing more and more stacked sums/products, but I'm not sure. The pattern is so nice, but it eludes me to put it into words or onto paper somehow.
I tried defining $f_n(x) = f_{n-1}\left(f(x)\right)$, but that made the derivatives even more horrible expressions to deal with.
Question: Is there a general formula for $\frac{d^m}{dx^m}f_n(x)$?
Or, if that is too much, just a way to get to $\frac{d^3}{dx^3}f_n(x)$ would be much appreciated.