Re: Derivative[1] applied to numeric constants
- To: mathgroup at smc.vnet.net
- Subject: [mg66780] Re: [mg66760] Derivative[1] applied to numeric constants
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 30 May 2006 05:48:23 -0400 (EDT)
- References: <200605291006.GAA07577@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 29 May 2006, at 19:06, Andrew Moylan wrote:
> Hi,
>
> Do numeric constants have special behaviour under the Derivative[1]
> function?
>
> The number e.g. 2 is not defined as the function that always
> returns 2:
>
> In[1]:=2[x]
> Out[1]=2[x]
>
> But Derivative[1][2] is defined:
>
> In[2]:=2'
> Out[2]=0&
>
> Could anyone explain why this is? Is this behaviour documented in the
> help system?
>
> Cheers,
>
> Andrew
>
I can't give a definitive answer but note that we also have this
closely related behaviour,that is documented:
In[1]:=
SetAttributes[f,Constant]
In[2]:=
Derivative[1][f]
Out[2]=
0&
or
In[3]:=
D[f[#]&,#]
Out[3]=
0&
and
In[4]:=
Dt[f[#]&]
Out[4]=
0&
This is consistent with the documentation for Constant:
Functions f[ ? ] are taken to have zero total derivative if f has
attribute Constant.
If a symbol f with attribute Constant is treated in this way, it
seems reasonable that genuine constants like 2 also are, although I
can't find any explicit mention of this (perhaps nobody has
considered the possibility that anyone might ask ;-)). But note that
(from the Help for Derivative):
Whenever Derivative[n][f] is generated, Mathematica rewrites it as D[f
[#]&, {#, n}].
So Derivative[1][2] is D[2[#]&,{#,1}] and presumably, for the same
reason as f[#]& when f has attribute Constant, this is taken to be 0.
As for the "deeper reasons" why this is so: at the moment I can't
think of one. I might play some role in the mechanism of functional
differentiation or it could simply be a side-effect of something that
does.
(Of course, the function that always returns 2 is 2& and it has the
same derivative as the abnormal "function" 2[#]& (or simple 2):
Derivative[1][2&]
0&
Derivative[1][2]
0&
Andrzej Kozlowski
- References:
- Derivative[1] applied to numeric constants
- From: Andrew Moylan <andrew.moylan@anu.edu.au>
- Derivative[1] applied to numeric constants