MathGroup Archive 1997

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

Search the Archive

nested * and ** (rules for commutative quantities)


Hello everybody,

I'm having the following problem.

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]]

It seems to be very simple but I just cannot come to a set of rules which are
general enough and don't lead to infinite recursion.

Can anyone please help me?

Thanks in advance for any help!

Marlies Brinksma


  • Prev by Date: Re: Replace expressions
  • Next by Date: HELP with exponential smoothing, PLEASE!
  • Previous by thread: Q:SetCoordinates[system] usage
  • Next by thread: HELP with exponential smoothing, PLEASE!