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.


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$.

  • $\begingroup$ A possible duplication of mathematica.stackexchange.com/questions/7876/… $\endgroup$ – user64494 Oct 28 '19 at 12:03
  • $\begingroup$ I edited the question, Now the difference with that suspected 'duplicate' is more evident. $\endgroup$ – IgnoranteX Oct 28 '19 at 13:22
  • $\begingroup$ Symbolic order derivatives were introduced as a new feature in v11.1 (look for 'D (updated)'). $\endgroup$ – Thies Heidecke Oct 28 '19 at 16:15
  • $\begingroup$ @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. $\endgroup$ – IgnoranteX Oct 28 '19 at 17:01
  • $\begingroup$ 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? $\endgroup$ – b3m2a1 Oct 28 '19 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


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]]

enter image description here

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


enter image description here

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.

  • $\begingroup$ 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... $\endgroup$ – IgnoranteX Oct 28 '19 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.