# Noncommutative tensor product

I am using Mathematica 8. Is there any way to make a noncommutative tensor product calculation? For instance, I have the following relations :

$XY=YX; \ Xt=qtX; \ Yt=qtY$.

Is there any way to make a tensor product calculations, such as for examples

$(tY \otimes X)(Xt \otimes t)= tYXt \otimes Xt \\=tXYt \otimes Xt \\= (q^{-1}Xt)(qtY) \otimes qtX \\= Xt^{2}Y \otimes qtX \\= qXt^{2}Y \otimes tX$

or

$(tY\otimes t)(t^{2}\otimes Y^{2}+ X^{2}\otimes Xt )= tYt^{2}\otimes tY^{2}+tYX^{2}\otimes tXt \\= q^{2}t^{3}Y \otimes tY^{2}+tX^{2}Y\otimes q^{-1}Xt^{2}\\= q^{2}t^{3}Y \otimes tY^{2} + q^{-3}X^{2}tY \otimes Xt^{2}$

or any other calculations?

Thank you very much

• I am not very knowledgeable on this topic, so I don't know if the following packages will help, but you may want to look at them ... math.ucsd.edu/~ncalg xact.es Mathematica 8 doesn't have built-in tensor calculation support. Sep 19, 2016 at 9:38
• @Szabolcs : but is it possible to make such program in Mathematica 9? I know that Mathematica 8 doesn't support tensor calculation, so I'm thinking to use other computers which has Mathematica 9 Sep 19, 2016 at 11:02
• You should include that in the main question. Sep 19, 2016 at 11:34

NCAlgebra does not have a native tensor product. Here is one definition that might need some refinement for prime time, but that might be useful:

SetNonCommutative[NCKron];
NCKron[x_, middle___, (a_?CommutativeQ) y_, right___] := NCKron[a x, middle, y, right];
NonCommutativeMultiply[left___, NCKron[x__], NCKron[y__], right___] := NonCommutativeMultiply[left, NCKron @@ Thread[NonCommutativeMultiply[{x}, {y}]], right] /; Length[{x}] === Length[{y}];


With that definition and my interpretation of your example above you would have that

SetNonCommutative[X, Y, t]
SetCommutative[q]
expr = NCKron[t ** Y, X] ** NCKron[X ** t, t]


evaluates to

NCKron[t ** Y ** X ** t, X ** t]

Applying the rules

rules = {X ** Y -> Y ** X, X ** t -> q t ** X, Y ** t -> q t ** Y};
NCReplaceRepeated[expr, rules]


NCKron[q^3 t ** t ** Y ** X, t ** X]

Similarly:

expr = NCKron[t ** Y, t] ** (NCKron[t^2, Y^2] + NCKron[X^2, X ** t])


is such that

NCExpand[expr]


evaluates to

NCKron[t ** Y ** t ** t, t ** Y ** Y] + NCKron[t ** Y ** X ** X, t ** X ** t]

and

NCReplaceRepeated[NCExpand[expr], rules]


evaluates to

NCKron[q^2 t ** t ** t ** Y, t ** Y ** Y] + NCKron[q t ** Y ** X ** X, t ** t ** X]