Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Conversion of Orderless functions to non Orderless one

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24069] Re: [mg24046] Conversion of Orderless functions to non Orderless one
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Thu, 22 Jun 2000 01:02:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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.

Andrzej
-- 
Andrzej Kozlowski
Toyama International University, JAPAN

For Mathematica related links and resources try:
<http://www.sstreams.com/Mathematica/>

on 6/21/00 3:20 PM, zhl67 at hotmail.com at zhl67 at hotmail.com wrote:

> Hi, there
> 
> My question might be silly to somebody out there but it really bothers
> me: Is there any way to convert an orderless function into non
> orderless ones for a certain range of arguments?
> 
> For instance, let's say have a set Operators:
> 
> Operators={a,b,c}
> 
> What I wanted to do is that whenever expressions like Times[b,a,c] is
> entered, the outcome should look like b**a**c (i.e. Times turned into
> NonCommutativeMultiply). The special requirement is that this change
> happens only for members of the set Operators (otherwise I can just
> ClearAttributes[Times,Orderless] ), and that the output keeps the order
> of the input argument, i.e. it should be b**a**c, NOT a**b**c. Could
> anyone help the case?
> 
> Liu Zhao
> Univ. York, UK
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.
> 





  • Prev by Date: Re: imposing side conditions on Solve
  • Next by Date: Re: Precision example
  • Previous by thread: Re: Conversion of Orderless functions to non Orderless one
  • Next by thread: Re: Re: Conversion of Orderless functions to non Orderless one