Re: Peculiar behavior of DiscreteDelta

*To*: mathgroup at smc.vnet.net*Subject*: [mg28750] Re: [mg28731] Peculiar behavior of DiscreteDelta*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Fri, 11 May 2001 20:00:29 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

on 01.5.11 4:38 PM, Jack Goldberg at jackgold at math.lsa.umich.edu wrote: Are you sure? Did you try it with a fresh kernel? I get : In[1]:= JackDelta[0] = 1; In[2]:= JackDelta[x_?NumericQ] = 0; In[3]:= JackDelta[1/2(1-Sqrt[5])+1/2(-1+Sqrt[5])] Out[3]= 0 In[4]:= $Version Out[4]= 4.1 for Power Macintosh (November 2, 2000) That's exactly the behaviour I would expect. I also must admit that I can't understand your complain here. DiscreteDelta has to decide whether the argument you gave it is zero, which it can't do without invoking Simplify. It tries to do so numerically, as do other (very popular!) functions such as Equal. Try 1/2(1 - Sqrt[5]) + 1/2(-1 + Sqrt[5]) == 0 and you will see exactly the same message you saw with DiscreteDelta. So it seems to me that you are arguing for automatic application of Simplify by these functions. I think there are good reasons against it, on grounds of speed and also perhaps programming convenience. After all, it is not much effort to define your own JackDelta as In[21]:= JackDelta[l___]:=DiscreteDelta@@Simplify[{l}] In[22]:= JackDelta[(1/2)*(1 - Sqrt[5]) + (1/2)*(-1 + Sqrt[5])] Out[22]= 0 -- Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ http://sigma.tuins.ac.jp/~andrzej/ > Hi group; > > I am using Mathematica, version 4.0 on a Mac OS.9 system and a Unix system. On > both systems I get the following peculiar buglet: > > In[1]:= DiscreteDelta[1/2(1-Sqrt[5])+1/2(-1+Sqrt[5])] > > results in a message entitled $MaxExtraPrecision::meprecp : ... > > and an output which is identical to the input. This does not happen if > DiscreteDelta is replaced by a numeric function such as Sin. This led me > to note that > > * DiscreteDelta does not have the Attribute NumericFunction. > > Back to the main point: > > If the output of In[1] is followed by FullSimplify, then we get 1 which is > expected since the argument of DiscreteDelta is 0. If Sqrt[5] is replaced > by other Sqrt[n] where n is not a perfect square, the result is again the > message and the input is returned unaltered. However if Sqrt[5] is > replaced by Sqrt[r] (where r is symbolic) the input is returned unaltered > with no message. > > Since DiscreteDelta is not an oft used function, my guess is that Wolfram > will not get around to fixing this for some time. While I wait, I would > like to write a "work around". > > > > ** I define a pseudo DiscreteDelta say JackDelta[x] which, like > DiscreteDelta, gives 0 if the argument is not 0 and 1 otherwise. (That is, > > JackDelta[0] = 1; > JackDelta[x_?NumericQ] = 0; > > Amazingly, > > JackDelta[1/2(1-Sqrt[5])+1/2(-1+Sqrt[5])] > > returns 1. I am delighted but very puzzled. > > Well experts, what's up? > > (1) Why doesn't > > Sin[1/2(1-Sqrt[5])+1/2(-1+Sqrt[5])] > > return 0. (It returns the input unaltered) > > (2) Why does > > JackDelta[1/2(1-Sqrt[5])+1/2(-1+Sqrt[5])] > > return 0. In view of (1), it should! > > (3) Why does > > DiscreteDelta[1/2(1-Sqrt[5])+1/2(-1+Sqrt[5])] > > have an error message associated with it. > > (4) Why does Mathematica have a different response for each of these calls? > > These things drive me nuts. > > Jack > > >

**Re: Peculiar behavior of DiscreteDelta**

**Re: How to make curved arrows?**

**Re: Peculiar behavior of DiscreteDelta**

**Re: Peculiar behavior of DiscreteDelta**