Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

An element of the $F\otimes F=$Fsquare is a sum of coefficients times $\otimes$-monomials. It has an iterator that can be used to isolate the pieces. For instance:

F.<a,b,c> = FreeAlgebra(QQ)
Fsquare = F.tensor_square()

E = (a + b).tensor((c + 1/2)^2)
for term in E:
    print(term)

This gives:

((a, c^2), 1)
((b, c^2), 1)
((a, c), 1)
((b, c), 1)
((a, 1), 1/4)
((b, 1), 1/4)

Alternatively:

for (s, t), coeff in E:
    print(f"Term    {s} (x) {t}   with coefficient {coeff}")

which gives:

Term    a (x) c^2   with coefficient 1
Term    b (x) c^2   with coefficient 1
Term    a (x) c   with coefficient 1
Term    b (x) c   with coefficient 1
Term    a (x) 1   with coefficient 1/4
Term    b (x) 1   with coefficient 1/4

Note also that latex(E) gives a good expression to be used in a latex environment:

\frac{1}{4} F_{a} \otimes F_{1} + F_{a} \otimes F_{c} + F_{a} \otimes F_{c^{2}} + \frac{1}{4} F_{b} \otimes F_{1} + F_{b} \otimes F_{c} + F_{b} \otimes F_{c^{2}}

$$ \frac{1}{4} F_{a} \otimes F_{1} + F_{a} \otimes F_{c} + F_{a} \otimes F_{c^{2}} + \frac{1}{4} F_{b} \otimes F_{1} + F_{b} \otimes F_{c} + F_{b} \otimes F_{c^{2}} $$