Upvalues related to "Times"
- To: mathgroup at smc.vnet.net
- Subject: [mg6289] Upvalues related to "Times"
- From: marliesb at sci.kun.nl (Marlies)
- Date: Sat, 8 Mar 1997 00:26:09 -0500 (EST)
- Organization: University of Nijmegen, The Netherlands
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I'm having problems with defining an upvalue for the function S which is related to the function "Times". In some cases (nr1 === nr2) the function S should be treated as noncommutative. To perform this I tried the following code: In[1]:= S/: Times[S[nr1_,orient1_],S[nr2_,orient2_]]:= S[nr1,orient1] ** S[nr2,orient2] /; nr1 === nr2 (* check: *) In[2]:= S[1,y] S[1,x] Out[2]= S[1,x]**S[1,y] As you can see the arguments of "Times" are rearranged. One possibility to solve this would be to change the attributes of the (build-in) function "Times" (remove Orderless). But the result of this would be that the function "Times" wouldn't work as one expects it would (after loading the package in which this code was entered). Does anyone know how to solve this? Thanks in advance! Marlies Brinksma