Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Don't understand behavior of ClearAttributes[Plus,

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85204] Re: Don't understand behavior of ClearAttributes[Plus,
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 2 Feb 2008 03:23:07 -0500 (EST)
  • References: <200801160830.DAA10128@smc.vnet.net> <fmmk8b$epl$1@smc.vnet.net> <fmv1db$2om$1@smc.vnet.net> <fnpnge$cgo$1@smc.vnet.net>

Alain Cochard wrote:
> danl at wolfram.com writes:
> 
>>> I find it difficult to understand your view.  I don't see why
>>> advertising for the ordering rules prevents Mathematica from
>>> changing them (advertising the new ones), leaving to the user the
>>> responsibility to be aware of those new rules, if he cares at all.
>>> My understanding is that one can always determine an order by use
>>> of Sort or OrderedQ; but seems to me it's just extra work than
>>> could be avoided.
> 
>> I can give two reasons.
>>
>> (1) It would entail a level of documentation that was difficult to
>> write, prone to error, and applicable to but few users. To me that is
>> a recipe for doing more harm than good.
>>
>> (2) There really are programming semantics that, in my opinion, should
>> be regarded as "details of the implementation". I feel this is one of
>> them.
>>
>> I will grant that you may be able to formulate god reasons for
>> disputing this. But I don't think that will be the case for the
>> situation at hand, where you also are redefining an attribute of a
>> basic arithmetic operation. As a general remark about such things, I
>> believe there are always better ways to work with, say, noncommutative
>> rings/algebras, than to attempt to overload Plus by changing its
>> attributes.
> 
> 
> OK, I guess I'll have to live with those reasons for the time being.
> I sure prefer no documentation rather than buggy documentation...
> Perhaps it should then be specified, in the section "Ordering of
> Expressions" and/or in the Sort page, that such documentation does not
> exist (and why not).  That could save some of us the trouble of
> looking for it.
> 
> Thanks for the other explanations and thanks for your time (I'll be
> holding my breathe about the OrderedQ[{">","/"}] versus
> OrderedQ[{">b","/a"}] --at least apparent-- contradiction).
> 
> And also many thanks to Jose Luis Gomez for his detailed explanations.
> 
> Alain
> 
Alain,

I wonder if you are aware that there are built-in operators - such as 
CirclePlus - in Mathematica that have no intrinsic meaning, and so can 
be given Attributes and a suitable definition to suit your requirements.

It would also be possible to read in a string that used '+' in a 
non-commutative way, and then parse it in one way or another. For 
example, you could use StringReplace to replace the '+' characters with 
CircleTimes, and then let the Mathematica parser get to work by passing 
the string to ToExpression!

Anything is possible, it depends how important it is to your needs!

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: RE: Fourier Series Expansions and it's Coefficients question revised tia
  • Next by Date: Re: changing color of non-evaluatable cell
  • Previous by thread: Re: Possible bug in ListAnimate[] or Manipulate[] v6.0
  • Next by thread: MathLink with MS Visual Studio 2008