$n$th derivative of a function that depends both explicitly and implicitly on a variable I would like to have a closed-formula for the $n$th derivative of a function of the type $f(x,g(x))$, i.e. a function that depends both explicitly and implicitly on a (scalar) variable:
$$
\frac{d^n f}{d x^n} = ?
$$
It can be assumed that all partial derivatives up to order $n$ included exist.
I can calculate the first (or second, or third...) derivatives by hand by using the chain rule. For example:
$$
\frac{d f}{d x} = \frac{\partial f}{\partial x} + \frac{\partial f}{\partial g}\frac{\partial g}{\partial x} = f^{(1,0)} + g'f^{(0,1)}.
$$
or
$$
\frac{d^2 f}{d x^2} =  f^{(2, 0)} +  2 g' f^{(1, 1)} + (g')^2 f^{(0, 2)} + g'' f^{(0, 1)}
$$
I however cannot see a pattern for a general formula. I am aware of the Faà di Bruno formula for calculating high order derivatives of a purely implicit function, but I am failing in seeing how to use it in combination with an explicit dependence of the function on the variable.
 A: The general higher derivative of a composition can be calculated by Faà di Bruno's formula (Higher Chain rule). Faà di Bruno's formula can be represented i.a. by Exponential Bell polynomials.
[Hardy 2006] generalizes Faà di Bruno's formula to the general higher partial derivatives of a multivariate function.
The answer to your question is given in [Bernardini/Natalini/Ricci 2005]:
"Abstract - We develop some extensions of the classical Bell polynomials, previously obtained, by introducing a further class of these polynomials called multidimensional Bell polynomials of higher order. They arise considering the derivatives of functions $f$ in several variables $\varphi^{(i)}$, $(i=1,2,...,m)$, where $\varphi^{(i)}$ are composite functions of different orders, i.e. $\varphi^{(i)}(t)=\phi^{(i,1)}(\phi^{(i,2)}(...(\phi^{(i,r_i)}(t)))$, $(i=1,2,...,m)$. We show that these new polynomials are always expressible in terms of the ordinary Bell polynomials, by means of suitable recurrence relations or formal multinomial expansions. Moreover,
we give a recurrence relation for their computation."
