How to Set a Variable Equal to a Constant with Zero Derivative in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter codemonkey209
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around how to set a variable equal to a constant with a zero derivative in Mathematica, specifically using the Dt function for total derivatives. Participants explore the implications of treating variables as constants and the resulting simplifications in derivative calculations.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant inquires about setting variables like 'A' or 'B' to constants with zero derivatives in Mathematica, seeking a way to simplify the output of the Dt function.
  • Another participant explains that Mathematica assumes variables have non-zero derivatives unless specified as constants, providing an example with the Dt function and its output.
  • There is a suggestion that using the D function instead of Dt might be a simpler approach for certain cases, implying that it could yield the desired results without the complexity of total derivatives.
  • A later reply acknowledges that while using D could achieve similar results, there may be a specific reason for using Dt, indicating a potential significance in the choice of function.

Areas of Agreement / Disagreement

Participants express differing views on the necessity of using Dt versus D, with some advocating for the simplicity of D while others recognize the specific context in which Dt is used. The discussion remains unresolved regarding the best approach to take.

Contextual Notes

Participants note that the assumptions about variables being constants or not can significantly affect the output of derivative calculations in Mathematica, highlighting the importance of specifying constants in the Dt function.

codemonkey209
Messages
1
Reaction score
0
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.
 
Physics news on Phys.org
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:
 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:
 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.
 
Or you can just use "D" instead of "Dt" unless you WANT the full derivatives for some things but not others?
 
Hepth said:
Or you can just use "D" instead of "Dt" unless you WANT the full derivatives for some things but not others?

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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 1 ·
Replies
1
Views
2K