Say I have a function with exponential term and I call it

v[x_, y_, z_] := 1/(1 + Exp[pone*x + ptwo*y + 1/z]);

Now, I perform some operation on it, for example, taking a derivative

D[v[x,y,z],x] = (E^(pone x + ptwo y + 1/z) pone)/(1 + E^(pone x + ptwo y + 1/z))^2

Since the original function contains exponential terms it will crop up again in the derivative expression. I would like to make the output of D[] (or well, anything else really) show me the name of the function or a symbol for it (something I can easily spot by looking), instead of its definition (which is hard to read when you have a few of them in and there are possibly similar, but not quite the same, terms around).

That is I would like the above to look like

   D[v[x,y,z],x] = (E^(pone x + ptwo y + 1/z) pone)/v[x,y,z]^2

even better if I could collect non-obvious things

 D[v[x,y,z],x] = (1/v[x,y,z]-1)*pone)/v[x,y,z]^2

1 Answer 1


You could avoid giving a definition for v, and instead define it's derivative directly:

v /: Derivative[1,0,0][v] = (1 - 1/v[##]) pone v[##]^2&;

I modified the definition from yours so that it agrees with using D. Now:

D[v[x,y,z], x]

pone (1 - 1/v[x, y, z]) v[x, y, z]^2

Let's compare to the normal output of D when you give a definition to v:

r1 = D[v[x,y,z], x] /. v[x_,y_,z_] -> 1/(1 + Exp[pone x + ptwo y + 1/z])
r2 = D[1/(1 + Exp[pone x + ptwo y + 1/z]), x]


-((E^(pone x + ptwo y + 1/z) pone)/(1 + E^(pone x + ptwo y + 1/z))^2)

-((E^(pone x + ptwo y + 1/z) pone)/(1 + E^(pone x + ptwo y + 1/z))^2)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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