Re: OneIdentity
- To: mathgroup at smc.vnet.net
- Subject: [mg103646] Re: OneIdentity
- From: Chris Osborn <chrisosb at gmail.com>
- Date: Thu, 1 Oct 2009 06:38:59 -0400 (EDT)
- References: <200909240352.XAA13458@smc.vnet.net> <h9vfkq$e6g$1@smc.vnet.net>
On Sep 30, 6:32 am, "Kurt TeKolste" <tekol... at fastmail.us> wrote: > You have misread the definition of OneIdentity. OneIdentity declares > key to be what mathematicians call "idempotent," i.e. you get the > answer after one application and no change occurs with repeated > application. The usual example of an idempotent operator is projection > in linear algebra: the result of projecting to the x-axis a projection > to the x-axis is the same > > xProjection[xProjection[{x,y}]] = xProjection[{x,y}] = {x,0} > > Note, however that > > xProjectionn[{x,y}] == {x,y} is false in general > > On Wed, 23 Sep 2009 23:52 -0400, "Chris Osborn" <chris... at gmail.com> > wrote: > > > > > I do not understand why I get "False" instead of "True" here: > > > In[773]:= ClearAll[key]; > > SetAttributes[key, OneIdentity]; > > > MatchQ[13, key[_]] > > > Out[775]= False > > > According to the docs: > > > OneIdentity > > is an attribute that can be assigned to a symbol f to indicate that f > > [x], f[f[x]], etc. are all equivalent to x for the purpose of pattern > > matching. > > > Thanks in advance, > > Chris > > Regards, > Kurt Tekolste As I see it, the function description implies that for purposes of pattern matching, every input to "key" is a fixed point (i.e. key[x] = x) which is a bit stronger than idempotence (key[key[x_]] = key[x]). But, OneIdentity does not seem to correspond to Idempotence, either, e.g.: In[1568]:= ClearAll[key]; SetAttributes[key, OneIdentity]; MatchQ[key[13], key@key[13]] Out[1570]= False Chris