for thermodynamics, I would like to use a thermodynamic derivative $$ \frac 1 T=\frac{\partial S}{\partial E}\Bigg \vert_V $$i.e. the derivative of the entropy S with respect to the energy E with the volume kept constant. In this context I tried to differentiate as follows (subsituting E to Z since E is protected)



How do I differentiate S with respect to Z without V[Z] being evaluated (i.e. plugged in)?

The result should read -1 instead of -1+12 Z^11

  • 2
    $\begingroup$ Please don't use underscores (a.k.a. Blank) in variable names: They have its own meaning in Mathematica (They are used to build patterns.) $\endgroup$ – Henrik Schumacher Aug 23 '18 at 13:27
  • 1
    $\begingroup$ You can try something like this: ClearAll[V];S = V[Z]^2 - Z; 1/T == D[S, Z] $\endgroup$ – Henrik Schumacher Aug 23 '18 at 13:29
  • $\begingroup$ The function Dt might also be useful $\endgroup$ – KraZug Aug 23 '18 at 13:49
  • $\begingroup$ Related meta post about moving goalposts $\endgroup$ – Michael E2 Aug 25 '18 at 0:07

Why not make the dependence explicit:

S[V_, Z_] := V^2 - Z
V[Z_] := Z^6


Derivative[0, 1][S][V[Z], Z]



Update: Answer to changed question:

See below for some discussion.

 SetAttributes[V, Constant];
(*  -1  *)

Note that if you change S =.. to S[Z_] :=.., you should change D[S,Z] to D[S[Z],Z], which is equivalent to S'[Z] above.

Answer to original question:

Perhaps one of these methods will get you started. First, though, you have to Clear your previous definitions. Set (=) does not set up equations but makes symbols represent the values of the right-hand side at the time of definition. Hence S=V^2-Z makes S equal Z^12 - Z, and the value for S contains no instance of V.

ClearAll[S, V, Z];

1. Setting temporarily the attribute Constant:

 SetAttributes[V, Constant];
 D[V^2 - Z, Z]]
(*  -1  *)

2. Using the option Constants of Dt:

Dt[S]/Dt[Z] /. 
   Dt[{S == V^2 - Z}, Constants -> {V}] /. 
    Verbatim[Dt][x_, ___] :> Dt[x], {Dt[S]}]
(*  -1  *)

Or this way seems a little cleaner:

 SetOptions[Dt, Constants -> {V}];
 Dt[S]/Dt[Z] /. First@Solve[Dt[{S == V^2 - Z}], {Dt[S]}]
(*  -1  *)
  • $\begingroup$ Ok, that works as long as V is indeed a constant defined by set (=). But how does it work if it is S[Z_],V[Z_] ? Do you know a way to set functions temporarily to a constant? $\endgroup$ – Uwe.Schneider Aug 24 '18 at 19:01
  • $\begingroup$ @Uwe.Schneider That's not how the original question was set up, was it? $\endgroup$ – Michael E2 Aug 24 '18 at 22:03

A Little cludgy, but for temporary setting, try


(* 1/T==-1 )

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.