On constants and D's behaviour

On constants and D's behaviour

Post by Nicolas Gi » Sun, 28 Nov 2004 15:45:04


Dear people,
just a thought, from a frustrated mind:

given that one can explicitely tell a symbol is a constant by modifying
its attributes, then why the hell doesn't the partial derivative D take
advantage of it, and treat nonconstant symbol as.... nonconstants, by
default ??

Cheers,
Nicolas
 
 
 

On constants and D's behaviour

Post by Steve Lutt » Mon, 29 Nov 2004 15:11:49

You need to use Dt rather than D.

Thus

Dt[a,x]

gives

Dt[a,x]

whereas

Dt[a,x,Constants\[Rule]{a}]

gives

0

Steve Luttrell

 
 
 

On constants and D's behaviour

Post by Andrzej Ko » Mon, 29 Nov 2004 15:13:50


Why should D duplicate another functions behaviour? Use Dt instead of D:

Dt[c, x]


Dt[c, x]


SetAttributes[c, Constant]


Dt[c, x]


0




Andrzej Kozlowski
Chiba, Japan
http://www.yqcomputer.com/ ~andrzej/
http://www.yqcomputer.com/ ~akoz/
 
 
 

On constants and D's behaviour

Post by David Bail » Mon, 29 Nov 2004 15:21:59


I suspect part of the problem with D and Dt is that a set of conventions
that might suit one problem domain would not seem right in another
context. In any case, I am sure the rules for these operations are cast
in stone because too much stuff would break if WRI changed them! I must
say though (relating to your previous question) I have never understood
why D evaluates if either of its arguments is a pattern!

It is, however, very easy to supply a recursive definition for dD that
uses whatever rules you see fit. One option is to define dD using a set
of transformation rules and then apply them with //. if and when you
want your derivatives evaluated. That way you can leave expressions like
d(sin(x))/dx unevaluated in your expressions, which can be useful in
some contexts.

David Bailey