Re: Conversion of Orderless functions to non Orderless one
- To: mathgroup at smc.vnet.net
- Subject: [mg24083] Re: [mg24046] Conversion of Orderless functions to non Orderless one
- From: zhl67 at my-deja.com
- Date: Fri, 23 Jun 2000 02:26:50 -0400 (EDT)
- References: <8is7td$h61@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <8is7td$h61 at smc.vnet.net>, Andrzej Kozlowski <andrzej at tuins.ac.jp> wrote: > It seems you want to be able to do some non-commutative algebra. The > question is "how much?" If you want to do only what you wrote in your > posting and no more than the following might be enough. > > In[1]:= > SetAttributes[times, {Flat, OneIdentity}] > > In[2]:= > times[l___] := > Times @@ DeleteCases[{l}, a | b | c] ** > NonCommutativeMultiply @@ Cases[{l}, a | b | c] > > Now you can get something like what you asked for: > > In[4]:= > times[c, x, y, b, v, a, z] > Out[4]= > (v x y z) ** c ** b ** a > > However,if you want be able to do any algebra, e.g. expand expressions etc. > then the the only choice (not involving a lot of > programming) seems to be to download the NonCommutative algebra package > available on MathSource. It is a powerful package which I used quite lot > about a year ago. You should be warned however of several problems. First of > all, the documentation is very inconvenient, being in the form of a dvi file > without hyperlinks. Secondly, it is not really a proper Mathematica package > (it does not use contexts). The easiest way to load it is to use > SetDirectory to enter the NCAlgebra directory and load the NCAlgebra.m file > (which loads in a number of individual files of which this "package" > consists of) with: > > << NCAlgebra` > > The functions defined in this "package" allow you to do a lot of > non-commutative algebra, of the kind > you seem to be interested in, but you have to carefully avoid using many > built in functions (e.g. you should use NonCommutativeExpand, not Expand, > you can't use the built in Power, and so on. Of course I do not mean that > your computer will explode if ytou do so, just that you will get answers > which are likely to be wrong). It would certainly seem a good idea for > Mathematica to include more non-commutative functions than the very > rudimentary NonCommutativeMultiply. There has been some talk about this for > a long time but so far other things seem to have been given higher priority. > First of all, thanks, Andrzej. I think I didn't state my question in full clearence. Actually I know about the package NCAlgebra and have kept my eyes open toward it for quite some time, but gradually frustrated with it in some aspects (Not all). Besides the inconveniences mentioned above, there are some other problems with the NCAlgebra packages, for instance, it leaves expressions like a**a**a unchanged by default, rather than changes it into powers of a. Of cause there is the function NCUnMonimial defined in the subpackage NCMonomial.m, but that function has some bugs in it, for example In[1]:= NCUnMonimial[Exp[a]**Exp[b]] gives the result Out[1]:= Exp[a+b] regardless of the fact that a and b are both noncommutative. Other aspects of shortcomings of the NCAlgebra package include: (1)there is only a limited capability in the function NCInverse (which treats only 2 by 2 matrices) (2)the Gauss decomposition of matrices works also only for 2 by 2 matrices (3)there isn't a function towards the evaluation of Commutators, which is necessary for a study of Lie algebra (4)though NCSolve does a careful check for the solution it gets, its capability in solving a system of noncommutative based linear equations is very weak and so on. Due to these reasons, I have started writing an alternative noncommutative algebra package which contains a selected subset of capabilities of NCAlgebra package and adds some more, and I expect that there will be some enhancements or improvements in the first parts of the functions comparing to NCAlgebra. My original question just emerged during the process of the development of the package I am writing: I realize that it is often meaningless to write the usual multiplication between noncommutative objects, and I wish my program will forgive the users (if they happen to have written such an expression) in such a way that it converts the ordinary Times into noncommutative multiplication (which actually bears a different function name in my package because I would not like to get my expressions messed up by the joint effect of my package and NCAlgebra) automatically and issue a warning message at the same time. This might not at all be necessary, but I am just curious whether this could be possible. Liu Zhao Sent via Deja.com http://www.deja.com/ Before you buy.