MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: applied to numeric constants

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66823] Re: applied to numeric constants
  • From: Andrew Moylan <andrew.moylan at anu.edu.au>
  • Date: Wed, 31 May 2006 06:31:41 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I feel that the distinction between "2" and "the function that always returns 2" is quite important and fundamental. It seems strange and unecessary to blur it.

Regarding the attribute "Constant", I can see its utility when used by the function Dt. Pi (and a few other built-in symbols) has the attribute Constant (and the number 2 seems to implicitly have the attribute Constant) because it is safe for Mathematica to assume that the user will never require that Pi (or 2) has any dependence on any other symbol. The user won't ever use a transformation rule like 2 -> x. (Or will they? This in itself is a non-trivial assumption, but it is obviously very useful and thus justified.)

But why does the attribute Constant have the extra property that "Functions f[ â?¦ ] are taken to have zero total derivative if f has attribute Constant."? In other words, why does h having attribute Constant make all expressions with Head h also effectively have attribute Constant? This seems like a very strange convention considering the fact that _none_ of the built-in symbols with attribute Constant are normally seen as the Head of any expression anyway! This is what I meant by "strange and unnecessary" above.


> 
> 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
>


  • Prev by Date: RE: Product and Summation sign
  • Next by Date: Re: Re: RE: Behavior of ReplaceAll with Computed Results from a Conditional Test
  • Previous by thread: How to display non contiguous datasets
  • Next by thread: Finding poles, branch cuts and other complex singularities