# Basic Mathematica question

1. Apr 28, 2010

### codemonkey209

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. Apr 28, 2010

### shoehorn

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.

3. Apr 28, 2010

### Hepth

Or you can just use "D" instead of "Dt" unless you WANT the full derivatives for some things but not others?

4. Apr 29, 2010

### shoehorn

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.