# How to define a variable to be a function of all the arguments but one?

I have several variables (coordinates) $$x_1, x_2, x_3, x_4, z$$ and a lot (21, to be precise) functions $$g_i$$ which are assumed to depend on $$x_1, x_2,x_3, x_4$$, but not on $$z$$. I also have a function Differentiation which uses Dt in its definition. I would like to apply Differentiation to my functions $$g_i$$.

I found that this question proposed giving constants the attribute "Constant". However, I cannot apply it directly, as my functions are constants only with respect to one variable.

Is there any way to do this?

• Dt[x^2 y + z, x, y, Constants -> {z}]? – kglr Sep 29 '18 at 1:40
• or InternalInheritedBlock[{Dt}, SetOptions[Dt, Constants -> {z}]; Differentiation[x1,x2,x3,x4,z]]? – kglr Sep 29 '18 at 1:46
• Hello, @kglr ! I tried to implement your suggestion with a simple function diff[expr_, x_] := Dt[expr, x];. However, InternalInheritedBlock[{Dt}, SetOptions[Dt, Constants -> {z}]];diff[z r, z] gives the same answer as diff[r z , z] - r + z Dt[r, z], when expected simply r. Did I somehow misinterpret your suggestion? – user108687 Sep 29 '18 at 1:56
• @klgr And as far as I understand, Constant attribute corresponds to setting all derivative of a variable to zero. And I want all the derivatives of other variables wrt this one to be set to zero. – user108687 Sep 29 '18 at 2:04
• @klgr I think that I've found solution: ff[expr_, x_] = Dt[expr, x]; A /: Dt[A, z] = 0; ff[A B, z] returns A Dt[B, z]. Thanks for help! – user108687 Sep 29 '18 at 2:13

With suggestions from @kglr I arrived at the following solution for a toy problem of differentiating $$AB$$ with respect to $$z$$, assuming that $$A$$ doesn't depend on $$z$$, using A /: Dt[A, z] = 0, which sets the derivative of $$A$$ with respect to $$z$$ equal to zero:
ff[expr_, x_] = Dt[expr, x];

returns A Dt[B, z].