Bases: sage.categories.category_types.Category_over_base_ring
The category of algebras with a distinguished basis
EXAMPLES:
sage: C = AlgebrasWithBasis(QQ); C
Category of algebras with basis over Rational Field
sage: C.super_categories()
[Category of modules with basis over Rational Field, Category of algebras over Rational Field]
We construct a typical parent in this category, and do some computations with it:
sage: A = C.example(); A
An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field
sage: A.category()
Category of algebras with basis over Rational Field
sage: A.one_basis()
word:
sage: A.one()
B[word: ]
sage: A.base_ring()
Rational Field
sage: A.basis().keys()
Words over Ordered Alphabet ['a', 'b', 'c']
sage: (a,b,c) = A.algebra_generators()
sage: a^3, b^2
(B[word: aaa], B[word: bb])
sage: a*c*b
B[word: acb]
sage: A.product
Generic endomorphism of An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field
sage: A.product(a*b,b)
B[word: abb]
sage: TestSuite(A).run(verbose=True)
running ._test_additive_associativity() . . . pass
running ._test_an_element() . . . pass
running ._test_associativity() . . . pass
running ._test_category() . . . pass
running ._test_distributivity() . . . pass
running ._test_elements() . . .
Running the test suite of self.an_element()
running ._test_category() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_pickling() . . . pass
pass
running ._test_elements_eq() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_one() . . . pass
running ._test_pickling() . . . pass
running ._test_prod() . . . pass
running ._test_some_elements() . . . pass
running ._test_zero() . . . pass
sage: A.__class__
<class 'sage.categories.examples.algebras_with_basis.FreeAlgebra_with_category'>
sage: A.element_class
<class 'sage.combinat.free_module.FreeAlgebra_with_category.element_class'>
Please see the source code of (with A??) for how to implement other algebras with basis.
TESTS:
sage: TestSuite(AlgebrasWithBasis(QQ)).run()
Bases: sage.categories.cartesian_product.CartesianProductsCategory
The category of algebras with basis, constructed as cartesian products of algebras with basis
Note: this construction give the direct products of algebras with basis. See comment in Algebras.CartesianProducts
A cartesian product of algebras with basis is endowed with a natural algebra with basis structure.
EXAMPLES:
sage: AlgebrasWithBasis(QQ).CartesianProducts().extra_super_categories()
[Category of algebras with basis over Rational Field]
sage: AlgebrasWithBasis(QQ).CartesianProducts().super_categories()
[Category of algebras with basis over Rational Field, Category of Cartesian products of modules with basis over Rational Field, Category of Cartesian products of algebras over Rational Field]
TESTS:
sage: A = AlgebrasWithBasis(QQ).example()
sage: A.from_base_ring(3)
3*B[word: ]
INPUTS:
- : an element of the coefficient ring
Implements the canonical embeding from the ground ring.
EXAMPLES:
sage: A = AlgebrasWithBasis(QQ).example()
sage: A.from_base_ring_from_one_basis(3)
3*B[word: ]
sage: A.from_base_ring(3)
3*B[word: ]
sage: A(3)
3*B[word: ]
EXAMPLES:
sage: A = AlgebrasWithBasis(QQ).example()
sage: A.one_basis()
word:
sage: A.one()
B[word: ]
When the one of an algebra with basis is an element of this basis, this optional method can return the index of this element. This is used to provide a default implementation of one(), and an optimized default implementation of from_base_ring().
EXAMPLES:
sage: A = AlgebrasWithBasis(QQ).example()
sage: A.one_basis()
word:
sage: A.one()
B[word: ]
sage: A.from_base_ring(4)
4*B[word: ]
Returns the one of the algebra, as per Monoids.ParentMethods.one()
By default, this is implemented from one_basis(), if available.
EXAMPLES:
sage: A = AlgebrasWithBasis(QQ).example() sage: A.one_basis() word: sage: A.one_from_one_basis() B[word: ] sage: A.one() B[word: ]TESTS:
Try to check that #5843 Heisenbug is fixed:
sage: A = AlgebrasWithBasis(QQ).example() sage: B = AlgebrasWithBasis(QQ).example(('a', 'c')) sage: A == B False sage: Aone = A.one_from_one_basis sage: Bone = B.one_from_one_basis sage: Aone is Bone False
Even if called in the wrong order, they should returns their respective one:
sage: Bone().parent() is B
True
sage: Aone().parent() is A
True
The product of the algebra, as per Magmas.ParentMethods.product()
By default, this is implemented from product_on_basis(), if available.
EXAMPLES:
sage: A = AlgebrasWithBasis(QQ).example()
sage: a, b, c = A.algebra_generators()
sage: A.product(a + 2*b, 3*c)
3*B[word: ac] + 6*B[word: bc]
The product of the algebra on the basis (optional)
INPUT:
- i, j – the indices of two elements of the basis of self
Returns the product of the two corresponding basis elements
If implemented, product() is defined from it by bilinearity.
EXAMPLES:
sage: A = AlgebrasWithBasis(QQ).example()
sage: Word = A.basis().keys()
sage: A.product_on_basis(Word("abc"),Word("cba"))
B[word: abccba]
Bases: sage.categories.tensor.TensorProductsCategory
The category of algebras with basis constructed by tensor product of algebras with basis
EXAMPLES:
sage: AlgebrasWithBasis(QQ).TensorProducts().extra_super_categories()
[Category of algebras with basis over Rational Field]
sage: AlgebrasWithBasis(QQ).TensorProducts().super_categories()
[Category of algebras with basis over Rational Field,
Category of tensor products of modules with basis over Rational Field,
Category of tensor products of algebras over Rational Field]
Returns an example of algebra with basis:
sage: AlgebrasWithBasis(QQ).example()
An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field
An other set of generators can be specified as optional argument:
sage: AlgebrasWithBasis(QQ).example((1,2,3))
An example of an algebra with basis: the free algebra on the generators (1, 2, 3) over Rational Field
EXAMPLES:
sage: AlgebrasWithBasis(QQ).super_categories()
[Category of modules with basis over Rational Field, Category of algebras over Rational Field]