# Revision history [back]

### Define tensor product of algebras (and make it an algebra)

I'm in my first week of sage (also new to python). Aiming at symbolic calculations, suppose I have an associative algebra $A$ (think of the Clifford algebra, or the free algebra, for concreteness).

In particular $A$ is a vector space, and I'd like to define a tensor product $A\otimes A$. I've seen that tensor algebra is implemented in SageMath, but I only need two factors, and anyway, I'd like to make $A\otimes A$ an algebra in a way that is not the obvious product $(a\otimes b) \cdot (c\otimes d) = ac\otimes bd$.

An example of how to do what I wish (although not precisely the same object), is along the lines of [this answer in Mathematica] (whose link I cannot post, as I don't have karma):

CenterDot[X___, Y_Plus, Z___] := CenterDot[X, #, Z] & /@ Y (* additivity *)
CenterDot[] = 1;
CenterDot[X_] := X
CenterDot[X___, 1, Y___] := CenterDot[X, Y] (* unital*)
SetAttributes[CenterDot, Flat] (* associativity *)


This allows to create a product CenterDot that behaves as it should. But in SageMath I need to define the analogue of this on $A\otimes A$ and this is not even clear to me how to define this product. (I.e. if it's not implemented, I probably should do something analogous to the code above, first for $\otimes$, tell it that it has to be bilinear, etc.)

### Define How to define tensor product of algebras (and make it an algebra)

I'm in my first week of sage (also new to python). Aiming at symbolic calculations, suppose I have an associative algebra $A$ (think of the Clifford algebra, or the free algebra, for concreteness).

In particular $A$ is a vector space, and I'd like to define a tensor product $A\otimes A$. I've seen that tensor algebra is implemented in SageMath, but I only need two factors, and anyway, I'd like to make $A\otimes A$ an algebra in a way that is not the obvious product $(a\otimes b) \cdot (c\otimes d) = ac\otimes bd$.

An example of how to do what I wish (although not precisely the same object), is along the lines of [this this answer in Mathematica] (whose link I cannot post, as I don't have karma): Mathematica:

CenterDot[X___, Y_Plus, Z___] := CenterDot[X, #, Z] & /@ Y (* additivity *)
CenterDot[] = 1;
CenterDot[X_] := X
CenterDot[X___, 1, Y___] := CenterDot[X, Y] (* unital*)
SetAttributes[CenterDot, Flat] (* associativity *)


This allows to create a product CenterDot that behaves as it should. But in SageMath I need to define the analogue of this on $A\otimes A$ and this is not even clear to me how to define this product. (I.e. if it's not implemented, I probably should do something analogous to the code above, first for $\otimes$, tell it that it has to be bilinear, etc.)

### How to define tensor product of algebras (and make it an algebra)

I'm in my first week of sage (also new to python). Aiming at symbolic calculations, suppose I have an associative algebra $A$ (think of the Clifford algebra, or the free algebra, for concreteness).