# Unital algebras¶

class sage.categories.unital_algebras.UnitalAlgebras(base_category)

The category of non-associative algebras over a given base ring.

A non-associative algebra over a ring $$R$$ is a module over $$R$$ which s also a unital magma.

Warning

Until trac ticket #15043 is implemented, Algebras is the category of associative unital algebras; thus, unlike the name suggests, UnitalAlgebras is not a subcategory of Algebras but of MagmaticAlgebras.

EXAMPLES:

sage: from sage.categories.unital_algebras import UnitalAlgebras
sage: C = UnitalAlgebras(ZZ); C
Category of unital algebras over Integer Ring

class ParentMethods

Bases: object

from_base_ring(r)

Return the canonical embedding of r into self.

INPUT:

• r – an element of self.base_ring()

EXAMPLES:

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

class WithBasis(base_category)
class ParentMethods

Bases: object

from_base_ring()
from_base_ring_from_one_basis(r)

Implement the canonical embedding from the ground ring.

INPUT:

• r – an element of the coefficient 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: ]

one()

Return the multiplicative unit element.

EXAMPLES:

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

one_basis()

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: ]

one_from_one_basis()

Return 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: ]


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