Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Basic Mathematica question

  1. Apr 28, 2010 #1
    Hello everyone,
    I just started using Mathematica and was wondering how do you set a variable, such as 'A' or 'B', equal to a constant whose derivative is equal to zero. So for example if I were to input something like this:

    Dt[A*E^(2 x)*Cos[3 x] + B*E^(2x)*Sin[3 x], {x, 2}]

    it wouldn't include something like this in the answer:

    Dt[B, x]

    but instead take it to be zero thus simplifying the outputted answer.
     
  2. jcsd
  3. Apr 28, 2010 #2
    Unless you specify that a variable is a constant, Mathematica will assume that it has a non-zero total derivative. For instance, if you want to compute the total derivative with respect to x of the function a*x^n, a naive application of the Dt method gives you the following:

    Code (Text):

     In[1]:= Dt[a*x^n, x]
    Out[1]:= x^n Dt[a, x] + a x^n (n/x + Dt[n, x] Log[x])
     
    This is perfectly correct since it represents a general application of the Leibniz rule for derivatives. However, if you know that a and n are independent of x, there's clearly more information in the answer than is necessary. Hence, you might specify that a and n are constants as follows:

    Code (Text):

     In[2]:= Dt[a*x^n, x, Constants->{a, n}]
    Out[2]:= a n x^(-1 + n)
     
    This is all mentioned in the first paragraph of the Mathematica documentation for Dt, by the way.
     
  4. Apr 28, 2010 #3

    Hepth

    User Avatar
    Gold Member

    Or you can just use "D" instead of "Dt" unless you WANT the full derivatives for some things but not others?
     
  5. Apr 29, 2010 #4
    Well, yes; in fact my first thought was to point out that pretty much the same thing could be achieved by computing the partial derivative. However, I assume that there's some particular significance to the fact that he/she has gone to the trouble of using Dt[] to compute the total derivative.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook