Examples of algebras with basis#


alias of FreeAlgebra

class sage.categories.examples.algebras_with_basis.FreeAlgebra(R, alphabet=('a', 'b', 'c'))#

Bases: CombinatorialFreeModule

An example of an algebra with basis: the free algebra

This class illustrates a minimal implementation of an algebra with basis.


Return the generators of this algebra, as per algebra_generators().


sage: A = AlgebrasWithBasis(QQ).example(); A                                # needs sage.modules
An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field
sage: A.algebra_generators()                                                # needs sage.modules
Family (B[word: a], B[word: b], B[word: c])

Returns the empty word, which index the one of this algebra, as per AlgebrasWithBasis.ParentMethods.one_basis().


sage: A = AlgebrasWithBasis(QQ).example() # needs sage.modules sage: A.one_basis() # needs sage.modules word: sage: A.one() # needs sage.modules B[word: ]

product_on_basis(w1, w2)#

Product of basis elements, as per AlgebrasWithBasis.ParentMethods.product_on_basis().


sage: # needs sage.modules
sage: A = AlgebrasWithBasis(QQ).example()
sage: Words = A.basis().keys()
sage: A.product_on_basis(Words("acb"), Words("cba"))
B[word: acbcba]
sage: (a,b,c) = A.algebra_generators()
sage: a * (1-b)^2 * c
B[word: abbc] - 2*B[word: abc] + B[word: ac]