Examples of algebras with basis#

sage.categories.examples.algebras_with_basis.Example[source]#

alias of FreeAlgebra

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

Bases: CombinatorialFreeModule

An example of an algebra with basis: the free algebra

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

algebra_generators()[source]#

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

EXAMPLES:

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])
>>> from sage.all import *
>>> 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
>>> A.algebra_generators()                                                # needs sage.modules
Family (B[word: a], B[word: b], B[word: c])
one_basis()[source]#

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

EXAMPLES::r

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)[source]#

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

EXAMPLES:

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]
>>> from sage.all import *
>>> # needs sage.modules
>>> A = AlgebrasWithBasis(QQ).example()
>>> Words = A.basis().keys()
>>> A.product_on_basis(Words("acb"), Words("cba"))
B[word: acbcba]
>>> (a,b,c) = A.algebra_generators()
>>> a * (Integer(1)-b)**Integer(2) * c
B[word: abbc] - 2*B[word: abc] + B[word: ac]