[Date Index] [Thread Index] [Author Index]
Upvalues related to "Times"
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:= S/: Times[S[nr1_,orient1_],S[nr2_,orient2_]]:= S[nr1,orient1] ** S[nr2,orient2] /; nr1 === nr2 (* check: *) In:= S[1,y] S[1,x] Out= 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