Question on tensor products (of the free algebra)

If $F$ is the free algebra over the rational numbers with generators ${a,b,c,\ldots}$, then $F\otimes F$ is implemented

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


Typical element are (sums of)

F(a) # F(1)
F(a) # F(b^2)
(1/2)*F(1) # F(a* b*a* c^2)


A first issue I have is that -- despite the typing alternative e.g. a.tensor(b) for a#b -- output happens in the hashtag format, which, if copied, is recognised only as a comment after that sign. Is there a way to make output useful [or rendered as tensor(a,b)] ?

And more importantly, how read off each factor of this type of expressions? That is, how to map

(1/2)*F(1) # F(a* b*a* c^2)


to, say,

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


or

 1,  a*b*a*c^2 /2


(who gets the numerical factor I don't care) ?

edit retag close merge delete

Sort by ยป oldest newest most voted

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}}$$

more

sure I forgot to specify $F\otimes F$ has non-homogeneous elements, was a little bit sloppy of me. Thanks

( 2024-06-21 17:43:08 +0200 )edit