Re: Non-commutative algebra

*To*: mathgroup at smc.vnet.net*Subject*: [mg13129] Re: [mg13053] Non-commutative algebra*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Tue, 7 Jul 1998 03:44:32 -0400*References*: <199807042044.QAA02851@smc.vnet.net.>*Sender*: owner-wri-mathgroup at wolfram.com

I replied to David Withoff's message before I had a chance to carefully read the message from Daniel Lichtbau. Since this message essentially deals with all the points I raised I am now quite satisfied. Andrzej At 4:29 PM -0500 98.7.6, Daniel Lichtblau wrote: >Andrzej Kozlowski wrote: >> >> I have a question which (probably) can only be answered by a wri >> insider. Since it concerns a "obsolete" version of Mathematica I >> suppose it will not be seen as terribly important, but still I would be >> very grateful if someone would satisfy my curiosity. >> >> Recently I was showing some computations in non-commutative algebra to >> my students. This is very easy to do in Mathematica 3.0. Basically all >> you need to do is to Clear the attribute Orderless in Times and use >> Mathematica as usual. However, my university (for various reasons) >> still has Mmma 2.2 installed on all the computers in the class where I >> teach, so after making my notebook using 3.0 I tried the same >> computations in 2.2. To my surprise the answers came out wrong! I soon >> realized that Expand in Mathematica 2.2 has commutativity "built in" >> quite independently from the Orderless attribute of Times. To see this >> all you need to do is to evaluate: >> >> In[2]:= >> Unprotect[Times] >> Out[2]= >> {Times} >> In[3]:= >> ClearAttributes[Times,Orderless] >> In[4]:= >> Protect[Times] >> Out[4]= >> {Times} >> In[5]:= >> Expand[(a+b)^2] >> >> In versions 3.0 and 2.2. In 3.0 you will correctly get: >> >> b*a + a^2 + a*b + b^2 >> >> but in 2.2 you get >> >> a^2+2a*b+b^2 >> >> I have looked through the documentation for Expand in both versions, and >> through various accounts of the changes in Version 3.0 (e.g. >> Mathematica Journal Vol. 6 Issue 4) but cannot find any mention of >> commutativity. It seems to me very odd to deliberately "hard-wire" >> commutativity in Expand. My question is: Why this behavious in version >> 2? Was it ever recognized as a bug and fixed v. 3 or was the fix just >> a side-effect of some other changes? > >It was indeed recognized as a bug and fixed. Well, partly fixed. Power >is still in need of some work, because it uses Times. > >In[9]:= ee = a*b; > >In[10]:= ClearAttributes[Times, Orderless] > >In[11]:= ee * ee >Out[11]= a b a b > >In[12]:= ee^2 > 2 2 >Out[12]= a b > >This matters e.g. if want to Expand the square of (x^2 + x*y + y^2). > > >> (Fortunately by using Distribute I was able to define my own Expand in >> 2.2 which does not assume commutativity, so this problem no longer has >> a practical significance for me, it's just a matter of wanting to >> understand what happened). >> >> Andrzej Kozlowski >> ... > > >We recommend that you use, say, NoncommutativeMultiply and attach rules >for integer powers to it to do the expansion. It is virtually never safe >to change the Orderless attributes of low-level operations such as >Plus/Times/Power, and moreover (as you found) it is hard for us to >obtain the correct functionality when you do make such changes. > > >Daniel Lichtblau >Wolfram Research Andrzej Kozlowski http://sigma.tuins.ac.jp/

**References**:**Non-commutative algebra***From:*Andrzej Kozlowski <andrzej@tuins.ac.jp>

**RE: logical inconsistency in U**

**Re: How to declare Integers?**

**Non-commutative algebra**

**Re: Non-commutative algebra**