Re: Non-commutative algebra
- To: mathgroup at smc.vnet.net
- Subject: [mg13173] Re: [mg13053] Non-commutative algebra
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Mon, 13 Jul 1998 07:42:22 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Here is (I hope a fair) summary of and the conclusions of this discussion, (including some private correspondence). First of all, I have to report to all those naive people who, like me, have never known this obvious fact, that Wolfram Research Inc. strongly disapproves of clearing any Attributes or otherwise modifying low level built-in functions, such as Times, Plus etc., and in particular removing their Orderless attribute. If you do this terrible things may happen to your programs either immediately or in the future. It is not made clear why we are actually given the opportunity to engage in such unhygienic behaviour, but perhaps it is just to provide a little excitement for those who like living dangerously. Secondly, I was almost completely wrong about Expand in Mathematica 3.0. Even if you clear the attribute Orderless from Times, Expand will continue to behave commutatively. For example, there seems to be no way to make Expand[c*(a+b)+(a+b)*c] to give the correct looking (non-commutative) answer. Having said all this, my question was not entirely pointless. There has indeed been a deliberate change in v. 3 in the behaviour of Expand after the Orderelss attribute is removed. This has been confirmed by Daniel Lichtblau. In particular expressions of the form Expand[(x+y+z+...)^n] will now expand correctly non-commutatively. This leads me onto dangerous grounds. Although as everyone now should know, one should never even dream of doing this, I can see some opportunities for programming hacks which give simple solutions to some combinatorial programs. Say, you want to find all 4 letter words that can be written using the letters {a,b,c,d,e,f} so that no letter appears twice in succession (i.e no abba etc). A simple way to do this now is: ClearAttributes[Times,Orderless]; l=Apply[List,Expand[(a+b+c+d+e+f)^4]]; Map[ToString,Complement[l,Cases[l,Times[___,_Power,___]|_Power]]] Of course you can do this almost as easily in perfectly legitimate ways, for example by using Outer, but where is the fun in that? Andrzej Kozlowski