# n derivatives on a function of n variables

I want to derive an expression with respect to each variable of a function $$f: \mathbb R^n \rightarrow \mathbb R$$. More precisely:

$$\left(\prod_{i=1}^n\frac{\partial}{\partial_{x_i}}\right) g(f(x_1,x_2,\dots,x_n))$$

with $$n\in \mathbb N$$ generic and $$g: \mathbb R \rightarrow \mathbb R$$ is known function (for instance $$g(y) = \arcsin(y)$$).

Do you know how to get a symbolic result? I think the use of blanks __ is the right way to go, but I cannot figure out how.

Edit

I'm looking for an output result of the form (with $$n$$ unspecified)

$$\sum_i^n h_i(\{f^{(i...)}\})$$

where $$i$$ is a (possibly multi-)index and $$h$$ some function of the partial derivatives of $$f$$ that depends on the known function $$g$$.

• A possible duplication of mathematica.stackexchange.com/questions/7876/… Oct 28, 2019 at 12:03
• I edited the question, Now the difference with that suspected 'duplicate' is more evident. Oct 28, 2019 at 13:22
• Symbolic order derivatives were introduced as a new feature in v11.1 (look for 'D (updated)'). Oct 28, 2019 at 16:15
• @Thies-heidecke. It looks to me that even the 'D (updated)' function doesn't do the job. Indeed, first one has to define $f(x_1,x_2,..x_n)$ specifying all variables names '$x_j$' and also the number of variables $n$ itself, only then one can apply $D$ to $f$ saying it explicitly to derive in $x_1,x_2,...$. I need a more abstract approach where you don't have to give a name to all variables of $f$ in the first step. Oct 28, 2019 at 17:01
• Mathematica can't handle this unknown number of derivatives. On the other hand this is a pretty simple pure math question so it can't hurt to ask on math.stackexchange where they've probably done this already? Oct 28, 2019 at 17:21

I'm not sure if Mathematica can help you find the closed form result directly, but you can generate examples for given n as follows.

Define a generic function of an arbitrary number of variables by using a single dummy variable x

f[0][x]


the first entry 0 will keep track of derivatives and shows that no derivatives have been taken yet.

Then, define a derivative operation with a dummy variable x as follows

Dxi[input_, xi_] := D[input, x] /. Derivative[1][f[y_]][x_] :> f[y + xi][x]


this will take any input and take a derivative with respect to the dummy x, then any f[y]'[x] expressions are replaced by f[y+xi][x] which denotes that a derivative with respect to xi has been applied, e.g.,

Dxi[g[f[0][x]], x[i]]


With this, you can generate effective derivatives on function g[f[0][x]] with any amount of different x[i]. For example, if n=3

n=3;
gderivatives=g[f[0][x]];
Do[gderivatives=Dxi[gderivatives,x[i]];,{i,1,n}];
Collect[gderivatives,Derivative[_][g][f[0][x]],FullSimplify]


Staring at a few examples for lower n values you might come up with a general pattern how the derivatives arrange themselves. This will likely involve sets, subsets and permutations of labels and such.

• Thanks for the effort. I'm actually looking for a code that gives an output with $n$ left unspecified. But maybe you are right, Mathematica cannot handle it, as it should recognize the combinatorial pattern behind this derivative... Oct 28, 2019 at 20:41