MathGroup Archive 2009

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

Search the Archive

Re: OneIdentity

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103601] Re: [mg103478] OneIdentity
  • From: "Kurt TeKolste" <tekolste at fastmail.us>
  • Date: Wed, 30 Sep 2009 04:58:24 -0400 (EDT)
  • References: <200909240352.XAA13458@smc.vnet.net>

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



  • References:
  • Prev by Date: Re: "Mathematica could not establish a connection to the kernel"
  • Next by Date: Resume an aborted calculation?
  • Previous by thread: Re: Re: OneIdentity
  • Next by thread: SumOfSquaresRepresentations