Re: Re: nested * and ** (rules for commutative quantities)
- To: mathgroup at smc.vnet.net
- Subject: [mg7787] Re: [mg7749] Re: [mg7658] nested * and ** (rules for commutative quantities)
- From: mabi at solidmr.kun.nl (Marlies Brinksma)
- Date: Tue, 8 Jul 1997 22:41:04 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Dear Carl, You wrote: > On Thu, 26 Jun 1997, Marlies Brinksma wrote: > > > ... > > > > I have a set of operators (let's call them Op[index_,arg2_]). > > Two of these operators commute when their indices are different and they are > > noncommutative otherwise. All operators commute with any scalar quantity. > > > > I would like to define some rules such that expressions like: > > > > Op[3,a] ** Op[2,v] ** 4 ** Op[6,s] ** Op[2,x] ** Op[1,t] > > > > will be automatically changed to: > > > > Times[4, Op[1,t],NonCommutativeMultiply[Op[2,v],Op[2,x]],Op[3,a],Op[6,s]] > > ^ > > ... | > > Hi Marlies, > > I'm not sure of all the rules that you want to impose, since you don't > explain why Op[1,t] is not within NonCommutativeMultiply. Also, you don't > mention what kinds of objects other than numbers might occur in addition > to your Op functions. At any rate, here is a short definition which might > do what you want. I think you've missed one ] right behind Op[2,x]... ;) Op[3,a] and Op[6,s] are also not in NonCommutativeMultiply[]. The reason for this (see above) is that 2 operators with different indices commute. So only the operators with indices 2 do not commute with eachother, but commute with the rest. That's why I would like to have them as parameters of Times[] (which has the attribute Orderless) instead of NonCommutativeMultiply[]. Thanks anyway you for having a look at my posting! I appreciate that very much. Marlies