This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / The Mathematica Book / Advanced Mathematics / Calculus  /

3.5.2 Total Derivatives


Total differentiation operations.


























































When you find the derivative of some expression with respect to , you are effectively finding out how fast changes as you vary . Often will depend not only on , but also on other variables, say and . The results that you get then depend on how you assume that and vary as you change .
There are two common cases. Either and are assumed to stay fixed when changes, or they are allowed to vary with . In a standard partial derivative


, all variables other than are assumed fixed. On the other hand, in the total derivative


, all variables are allowed to change with .
In Mathematica, D[


f,x] gives a partial derivative, with all other variables assumed independent of x. Dt[f,x] gives a total derivative, in which all variables are assumed to depend on x. In both cases, you can add an argument to give more information on dependencies.










  • This gives the partial derivative. is assumed to be independent of


    .
  • In[1]:= D[x^2 + y^2, x]

    Out[1]=










  • This gives the total derivative. Now is assumed to depend on


    .
  • In[2]:= Dt[x^2 + y^2, x]

    Out[2]=




  • You can make a replacement for


    .
  • In[3]:= % /. Dt[y, x] -> yp

    Out[3]=




  • You can also make an explicit definition for . You need to use y/: to make sure that the definition is associated with y


    .
  • In[4]:= y/: Dt[y, x] = 0

    Out[4]=

  • With this definition made, Dt treats y as independent of x.
  • In[5]:= Dt[x^2 + y^2 + z^2, x]

    Out[5]=

  • This removes your definition for the derivative of y.
  • In[6]:= Clear[y]

  • This takes the total derivative, with z held fixed.
  • In[7]:= Dt[x^2 + y^2 + z^2, x, Constants->{z}]

    Out[7]=

  • This specifies that c is a constant under differentiation.
  • In[8]:= SetAttributes[c, Constant]

  • The variable c is taken as a constant.
  • In[9]:= Dt[a^2 + c x^2, x]

    Out[9]=

  • The functionc is also assumed to be a constant.
  • In[10]:= Dt[a^2 + c[x] x^2, x]

    Out[10]=




  • This gives the total differential


    .
  • In[11]:= Dt[x^2 + c y^2]

    Out[11]=

  • You can make replacements and assignments for total differentials.
  • In[12]:= % /. Dt[y] -> dy

    Out[12]=