# Non-unital non-associative algebras¶

class sage.categories.magmatic_algebras.MagmaticAlgebras(base, name=None)

The category of algebras over a given base ring.

An algebra over a ring $$R$$ is a module over $$R$$ endowed with a bilinear multiplication.

Warning

MagmaticAlgebras will eventually replace the current Algebras for consistency with e.g. Wikipedia article Algebras which assumes neither associativity nor the existence of a unit (see trac ticket #15043).

EXAMPLES:

sage: from sage.categories.magmatic_algebras import MagmaticAlgebras
sage: C = MagmaticAlgebras(ZZ); C
Category of magmatic algebras over Integer Ring
sage: C.super_categories()
Category of modules over Integer Ring]

Associative
class ParentMethods
algebra_generators()

Return a family of generators of this algebra.

EXAMPLES:

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

Unital
class WithBasis(base_category)
class FiniteDimensional(base_category)
class ParentMethods
derivations_basis()

Return a basis for the Lie algebra of derivations of self as matrices.

A derivation $$D$$ of an algebra is an endomorphism of $$A$$ such that

$D(ab) = D(a) b + a D(b)$

for all $$a, b \in A$$. The set of all derivations form a Lie algebra.

EXAMPLES:

We construct the Heisenberg Lie algebra as a multiplicative algebra:

sage: p_mult = matrix([[0,0,0],[0,0,-1],[0,0,0]])
sage: q_mult = matrix([[0,0,1],[0,0,0],[0,0,0]])
sage: A = algebras.FiniteDimensional(QQ,
....:          [p_mult,q_mult,matrix(QQ,3,3)], 'p,q,z')
sage: A.inject_variables()
Defining p, q, z
sage: p*q
z
sage: q*p
-z
sage: A.derivations_basis()
(
[1 0 0]  [0 1 0]  [0 0 0]  [0 0 0]  [0 0 0]  [0 0 0]
[0 0 0]  [0 0 0]  [1 0 0]  [0 1 0]  [0 0 0]  [0 0 0]
[0 0 1], [0 0 0], [0 0 0], [0 0 1], [1 0 0], [0 1 0]
)


We construct another example using the exterior algebra and verify we obtain a derivation:

sage: A = algebras.Exterior(QQ, 1)
sage: A.derivations_basis()
(
[0 0]
[0 1]
)
sage: D = A.module_morphism(matrix=A.derivations_basis()[0], codomain=A)
sage: one, e = A.basis()
sage: all(D(a*b) == D(a) * b + a * D(b)
....:     for a in A.basis() for b in A.basis())
True


REFERENCES:

Wikipedia article Derivation_(differential_algebra)

class ParentMethods
algebra_generators()

Return generators for this algebra.

This default implementation returns the basis of this algebra.

OUTPUT: a family

EXAMPLES:

sage: D4 = DescentAlgebra(QQ, 4).B()
sage: D4.algebra_generators()
Lazy family (...)_{i in Compositions of 4}

sage: R.<x> = ZZ[]
sage: P = PartitionAlgebra(1, x, R)
sage: P.algebra_generators()
Lazy family (Term map from Partition diagrams of order 1 to
Partition Algebra of rank 1 with parameter x over Univariate Polynomial Ring in x
over Integer Ring(i))_{i in Partition diagrams of order 1}

product()

The product of the algebra, as per Magmas.ParentMethods.product()

By default, this is implemented using one of the following methods, in the specified order:

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]

product_on_basis(i, j)

The product of the algebra on the basis (optional).

INPUT:

• i, j – the indices of two elements of the basis of self

Return the product of the two corresponding basis elements indexed by i and j.

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]

additional_structure()

Return None.

Indeed, the category of (magmatic) algebras defines no new structure: a morphism of modules and of magmas between two (magmatic) algebras is a (magmatic) algebra morphism.

Todo

This category should be a CategoryWithAxiom, the axiom specifying the compatibility between the magma and module structure.

EXAMPLES:

sage: from sage.categories.magmatic_algebras import MagmaticAlgebras

super_categories()
sage: from sage.categories.magmatic_algebras import MagmaticAlgebras