MathGroup Archive 2008

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

Search the Archive

Don't understand behavior of ClearAttributes[Plus,Orderless]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84840] Don't understand behavior of ClearAttributes[Plus,Orderless]
  • From: Alain Cochard <alain at geophysik.uni-muenchen.de>
  • Date: Wed, 16 Jan 2008 03:30:06 -0500 (EST)
  • Reply-to: alain at geophysik.uni-muenchen.de

I see from the archives that it is seldom a good idea to use
ClearAttributes[Plus,Orderless] but I would nevertheless like to
understand why it gives the behavior I expect in some cases and not in
others, as exemplified below.

    Mathematica 6.0 for Linux x86 (32-bit)
    Copyright 1988-2007 Wolfram Research, Inc.

    In[1]:= {b + a, j + 1, "/"+">"}

    Out[1]= {a + b, 1 + j, > + /}

To begin with, is it correct that the default ordering (as above) is
defined by what is called "canonical order" in the documentation?  If
so, I found only rudimentary (as it seemed to me anyway) descriptions
of what canonical order is.  For example, it is said that

    "Mathematical operators appear in order of decreasing precedence."

But how am I supposed to know or to determine that "/" is "less
preceding" than ">"?  Or maybe there are considered as strings here?
Anyway, the question of why ">" comes before "/" remains.

Also, I did not find anything regarding ordering/comparison of
elements from different classes of expressions, as I understand "1"
and "j" are.

(Sorry if answers to these questions are easily found --I did search
for them-- or if some questions don't even make sense.)

    In[2]:= ClearAttributes[Plus,Orderless]

    In[3]:= {b + a, j + 1, "/"+">"}

    Out[3]= {b + a, 1 + j, / + >}

Here I get the behavior I expect for b + a and "/"+">" (order
unchanged in output) but not for j + 1, changed to 1 + j.  Why?

Thanks for any hint.
Alain 



  • Prev by Date: RE: documentation specification for Documentation Center
  • Next by Date: Re: Graphics and CityData
  • Previous by thread: Re: Re: Version 6 graphics can be painfully slow
  • Next by thread: Re: Don't understand behavior of ClearAttributes[Plus,