Re: question 2
- To: mathgroup at smc.vnet.net
- Subject: [mg75854] Re: question 2
- From: Szabolcs <szhorvat at gmail.com>
- Date: Sat, 12 May 2007 03:01:08 -0400 (EDT)
- Organization: University of Bergen
- References: <200705110930.FAA06120@smc.vnet.net> <f21gav$7jv$1@smc.vnet.net>
Chris Chiasson wrote: > Expressions with heads that have the Attribute Orderless are > automatically sorted. In this case, I think the culprit is Plus. > > On 5/11/07, dimitris <dimmechan at yahoo.com> wrote: >> The ordering has to do with the letters? >> That is, >> First "e" then "o" in f1, and "x" first and >> then "y" in f2 rather than with the order >> of 4 and 8? It seems that Plus is treated in a special way, though only Times and Power are mentioned in the documentation. http://documents.wolfram.com/mathematica/book/section-A.3.9 In[1]:= Attributes[f]=Attributes[Plus] Out[1]= {Flat,Listable,NumericFunction,OneIdentity,Orderless,Protected} In[2]:= OrderedQ[{f[2,a],f[1,b]}] Out[2]= False In[3]:= OrderedQ[{Plus[2,a],Plus[1,b]}] Out[3]= True True
- References:
- question 2
- From: dimitris <dimmechan@yahoo.com>
- question 2