Macaulay2 » Documentation
Packages » PathSignatures :: wordAlgebra
next | previous | forward | backward | up | index | toc

wordAlgebra -- create a free algebra over a given alphabet

Description

In this package, tensors are represented as elements of free associative algebras, using the package NCAlgebra. More precisely, the free associative algebra on the alphabet $\{\texttt 1,...,\texttt d\}$ is isomorphic to the tensor algebra $T(\mathbb R^d)$ via the algebra homomorphism induced by $\texttt i \mapsto e_i$. This allows us to interpret tensors as non-commutative polynomials, or equivalently, linear combinations of words. Given an alphabet $l$, the free associative algebra over it can be obtained by using wordAlgebra, where the letter corresponding to $x \in l$ is represented by $\texttt{Lt}_x$.

i1 : d = 5;
i2 : l1 = {getSymbol "a", getSymbol "b", getSymbol "c"};
i3 : A = wordAlgebra(l1)

o3 = A

o3 : NCPolynomialRing
i4 : gens A

o4 = {Lt , Lt , Lt }
        a    b    c

o4 : List
i5 : l2 = toList(1..d);
i6 : B = wordAlgebra(l2)

o6 = B

o6 : NCPolynomialRing
i7 : gens B

o7 = {Lt , Lt , Lt , Lt , Lt }
        1    2    3    4    5

o7 : List

The algebra B in the example can also be directly obtained for a given d using wordAlgebra(ZZ):

i8 : B = wordAlgebra(d);
i9 : gens B

o9 = {Lt , Lt , Lt , Lt , Lt }
        1    2    3    4    5

o9 : List

By default, wordAlgebra creates a non-commutative algebra over QQ. The coefficient ring can be changed via the CoefficientRing option:

i10 : coefficientRing B

o10 = QQ

o10 : Ring
i11 : C = wordAlgebra(d, CoefficientRing => CC)

o11 = C

o11 : NCPolynomialRing
i12 : coefficientRing C

o12 = CC
        53

o12 : ComplexField

An element of the algebra can be obtained by using the generator symbols, or (more conveniently) by using word notation, see Array _ NCPolynomialRing:

i13 : d = 5;
i14 : R = wordAlgebra(d); -- create a free associative algebra over two letters Lt_1, Lt_2
i15 : f = 2 * [1,d]_R - [2,d]_R  -- [i_1,...,i_k]_R defines a word.

o15 = -Lt Lt +2Lt Lt
         2  5    1  5

o15 : R
i16 : f === 2 * Lt_1 * Lt_d - Lt_2 * Lt_d

o16 = true

Note that for two words (equivalently, monomials) $\texttt{w}$ and $\texttt{v}$, $\texttt{w} * \texttt{v}$ is the concatenation.

To display a non-commutative polynomial in word notation, one can use wordFormat or wordString:

i17 : f^3 // wordFormat

o17 = - [2, 5, 2, 5, 2, 5] + 2 [2, 5, 2, 5, 1, 5] + 2 [2, 5, 1, 5, 2, 5] - 4
      -----------------------------------------------------------------------
      [2, 5, 1, 5, 1, 5] + 2 [1, 5, 2, 5, 2, 5] - 4 [1, 5, 2, 5, 1, 5] - 4
      -----------------------------------------------------------------------
      [1, 5, 1, 5, 2, 5] + 8 [1, 5, 1, 5, 1, 5]
i18 : f^3 // wordString

o18 = - [2, 5, 2, 5, 2, 5] + 2 [2, 5, 2, 5, 1, 5] + 2 [2, 5, 1, 5, 2, 5] - 4
      [2, 5, 1, 5, 1, 5] + 2 [1, 5, 2, 5, 2, 5] - 4 [1, 5, 2, 5, 1, 5] - 4
      [1, 5, 1, 5, 2, 5] + 8 [1, 5, 1, 5, 1, 5]

There are more interesting algebraic structures on non-associative algebras; of particular importance in the context of path signatures is the shuffle product and the half-shuffle product:

i19 : a = [1]_R ** [2]_R; wordFormat a -- the shuffle product

o20 = [2, 1] + [1, 2]
i21 : b = [1,2]_R ** [3,4]_R; wordFormat b

o22 = [3, 4, 1, 2] + [3, 1, 4, 2] + [3, 1, 2, 4] + [1, 3, 4, 2] + [1, 3, 2,
      -----------------------------------------------------------------------
      4] + [1, 2, 3, 4]
i23 : c = [1]_R >> [2,3]_R; wordFormat c -- the half-shuffle product

o24 = [2, 1, 3] + [1, 2, 3]

See NCRingElement ** NCRingElement and NCRingElement >> NCRingElement for more information on the shuffle and half-shuffle product.

See also

Ways to use wordAlgebra:

  • wordAlgebra(List)
  • wordAlgebra(ZZ)

For the programmer

The object wordAlgebra is a method function with options.


The source of this document is in PathSignatures/documentation.m2:918:0.