# How to compute in the Tensor Algebra $T(V)$ ?

I need to make some computations in low degree in the Tensor algebra $T(V)$ of a rational vector space $V$, but i cannot find a good way of doing this. I could use FreeAlgebras, but then i cannot get access to the summands in my element : for example i want to be able to retrieve $a$ $b$ and $c$ from the element $abc$ (whenever the element is homogeneous).

The reason for this is I need to define a 'cycle' function that associates $Wa$ to a tensor $aW$ when $W$ is a tensor and $a \in V$.

edit retag close merge delete

Sort by » oldest newest most voted

Like this maybe

sage: A = algebras.Free(QQ, 'abc')
sage: elt = 4 * A.monomial(Word('abc')) + 6*A.monomial(Word('a'))
sage: data = [(w.to_word(), cf) for w, cf in elt]
sage: A.sum_of_terms((w[1:] + w[:1], cf) for w, cf in data)
6*a + 4*b*c*a

more

Thank you so much, that is exactly what I need ! So the algebra element is secretly a list of tuples ?

( 2021-01-13 19:31:58 +0200 )edit