I am trying to define a function f[x1,x2,...,xn]
with n
integer but not specified. And then I would like this funktion to behave properly under the derivative operation, so that D[f[x1,x2,...,xn],xi]
actually results in an expression which unambiguously displays that it is the first derivative in respect to the i
-th variable. Up until now I had little success in employing the Mathematica function D[x_,y_]
and have been simply substituting it for a place holder d[x_,y_]
. However, this is not very convenient, since those placeholders do not respect commutativity. Maybe there is such functionality already, which I do not know of? Or maybe one can implement it? Thank you for any suggestion!
EDIT:
Please note, I am not looking to define custom functions of a finite number of variables tied to the derivative operation. What I am actually interested in, is defining a function which is dependent on an unspecified number of variables n
. And introducing a formalism such that taking derivatives in respect to one of these variables of an unspecified index i
still works consistently.
EDIT2:
To explain what I mean in more detail, I would like to be able to define a function f[v]
in which I would like to treat v
as a 1-dimensional list v={v1,v2,v3,...,vn}
. However, I would like to keep the amount of elements in v
arbitrary (without specifying to a certain length). And then I would like to define a derivative operation, which would allow expressions like D[f[v],v1]
or D[f[v],v2]
and even D[f[v],vi]
which should not evaluate to zero, but to some meaningful expression, from which I still could extract the information which derivative it is, and with respect to which of the n
variables.
Derivative[n][f]
$\endgroup$D[f[x1, x2, xn], x2]
you do get an unambiguous result, right? So I think you have to state the problem more clearly with an example. $\endgroup$Derivative[n][f]
denotes an unspecified number of derivatives with respect to a single variable. What I need is a notation that denotes an unspecified number of derivatives with respect to an unspecified number of variables unambiguously, which clearly cannot be captured by merelyDerivative[n][f]
. $\endgroup$