Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

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:
  • Prev by Date: Re: Re: v. 6, third argument to rectangle
  • Next by Date: Mathematica 6.0 - Legend
  • Previous by thread: Re: question 2
  • Next by thread: Mathematica 6 & Wolfram Workbench