Finite-Dimensional Algebras

class sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra.FiniteDimensionalAlgebra(k, table, names='e', category=None)[source]

Bases: UniqueRepresentation, Parent

Create a finite-dimensional \(k\)-algebra from a multiplication table.

INPUT:

  • k – a field

  • table – list of matrices

  • names – string (default: 'e'); names for the basis elements

  • assume_associative – boolean (default: False); if True, then the category is set to category.Associative() and methods requiring associativity assume this

  • category – (default: MagmaticAlgebras(k).FiniteDimensional().WithBasis()) the category to which this algebra belongs

The list table must have the following form: there exists a finite-dimensional \(k\)-algebra of degree \(n\) with basis \((e_1, \ldots, e_n)\) such that the \(i\)-th element of table is the matrix of right multiplication by \(e_i\) with respect to the basis \((e_1, \ldots, e_n)\).

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])]); A
Finite-dimensional algebra of degree 2 over Finite Field of size 3
sage: TestSuite(A).run()

sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,0], [0,0,0], [0,0,1]])])
sage: B
Finite-dimensional algebra of degree 3 over Rational Field
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])]); A
Finite-dimensional algebra of degree 2 over Finite Field of size 3
>>> TestSuite(A).run()

>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(1)]])])
>>> B
Finite-dimensional algebra of degree 3 over Rational Field
Element[source]

alias of FiniteDimensionalAlgebraElement

base_extend(F)[source]

Return self base changed to the field F.

EXAMPLES:

sage: C = FiniteDimensionalAlgebra(GF(2), [Matrix([1])])
sage: k.<y> = GF(4)                                                         # needs sage.rings.finite_rings
sage: C.base_extend(k)                                                      # needs sage.rings.finite_rings
Finite-dimensional algebra of degree 1 over Finite Field in y of size 2^2
>>> from sage.all import *
>>> C = FiniteDimensionalAlgebra(GF(Integer(2)), [Matrix([Integer(1)])])
>>> k = GF(Integer(4), names=('y',)); (y,) = k._first_ngens(1)# needs sage.rings.finite_rings
>>> C.base_extend(k)                                                      # needs sage.rings.finite_rings
Finite-dimensional algebra of degree 1 over Finite Field in y of size 2^2
basis()[source]

Return a list of the basis elements of self.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
sage: A.basis()
Finite family {0: e0, 1: e1}
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])])
>>> A.basis()
Finite family {0: e0, 1: e1}
cardinality()[source]

Return the cardinality of self.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [2, 3]])])
sage: A.cardinality()
49

sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]),
....:                                   Matrix([[0, 1], [2, 3]])])
sage: B.cardinality()
+Infinity

sage: C = FiniteDimensionalAlgebra(RR, [])
sage: C.cardinality()
1
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(7)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(2), Integer(3)]])])
>>> A.cardinality()
49

>>> B = FiniteDimensionalAlgebra(RR, [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                   Matrix([[Integer(0), Integer(1)], [Integer(2), Integer(3)]])])
>>> B.cardinality()
+Infinity

>>> C = FiniteDimensionalAlgebra(RR, [])
>>> C.cardinality()
1
degree()[source]

Return the number of generators of self, i.e., the degree of self over its base field.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
sage: A.ngens()
2
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])])
>>> A.ngens()
2
from_base_ring(x)[source]
gen(i)[source]

Return the \(i\)-th basis element of self.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
sage: A.gen(0)
e0
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])])
>>> A.gen(Integer(0))
e0
ideal(gens=None, given_by_matrix=False, side=None)[source]

Return the right ideal of self generated by gens.

INPUT:

  • A – a FiniteDimensionalAlgebra

  • gens – (default: None) either an element of \(A\) or a list of elements of \(A\), given as vectors, matrices, or FiniteDimensionalAlgebraElements. If given_by_matrix is True, then gens should instead be a matrix whose rows form a basis of an ideal of \(A\).

  • given_by_matrix – boolean (default: False); if True, no checking is done

  • side – ignored but necessary for coercions

The algebra A has to be in the category of associative algebras.

EXAMPLES:

sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis()
sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])],
....:                              category=cat)
sage: A.ideal(A([1,1]))
Ideal (e0 + e1) of
 Finite-dimensional algebra of degree 2 over Finite Field of size 3
>>> from sage.all import *
>>> cat = Algebras(GF(Integer(3))).FiniteDimensional().WithBasis()
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])],
...                              category=cat)
>>> A.ideal(A([Integer(1),Integer(1)]))
Ideal (e0 + e1) of
 Finite-dimensional algebra of degree 2 over Finite Field of size 3
is_associative()[source]

Return True if self is associative.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
....:                                   Matrix([[0,1], [-1,0]])])
sage: A.is_associative()
True

sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,1], [0,0,0], [1,0,0]])])
sage: B.is_associative()
False

sage: e = B.basis()
sage: (e[1]*e[2])*e[2]==e[1]*(e[2]*e[2])
False
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1)], [-Integer(1),Integer(0)]])])
>>> A.is_associative()
True

>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(1)], [Integer(0),Integer(0),Integer(0)], [Integer(1),Integer(0),Integer(0)]])])
>>> B.is_associative()
False

>>> e = B.basis()
>>> (e[Integer(1)]*e[Integer(2)])*e[Integer(2)]==e[Integer(1)]*(e[Integer(2)]*e[Integer(2)])
False
is_commutative()[source]

Return True if self is commutative.

EXAMPLES:

sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,0], [0,0,0], [0,0,1]])])
sage: B.is_commutative()
True

sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,0], [0,1,0], [0,0,1]])])
sage: C.is_commutative()
False
>>> from sage.all import *
>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(1)]])])
>>> B.is_commutative()
True

>>> C = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1)]])])
>>> C.is_commutative()
False
is_finite()[source]

Return True if the cardinality of self is finite.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [2, 3]])])
sage: A.is_finite()
True

sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]),
....:                                   Matrix([[0, 1], [2, 3]])])
sage: B.is_finite()
False

sage: C = FiniteDimensionalAlgebra(RR, [])
sage: C.is_finite()
True
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(7)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(2), Integer(3)]])])
>>> A.is_finite()
True

>>> B = FiniteDimensionalAlgebra(RR, [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                   Matrix([[Integer(0), Integer(1)], [Integer(2), Integer(3)]])])
>>> B.is_finite()
False

>>> C = FiniteDimensionalAlgebra(RR, [])
>>> C.is_finite()
True
is_unitary()[source]

Return True if self has a two-sided multiplicative identity element.

Warning

This uses linear algebra; thus expect wrong results when the base ring is not a field.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(QQ, [])
sage: A.is_unitary()
True

sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
....:                                   Matrix([[0,1], [-1,0]])])
sage: B.is_unitary()
True

sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[0,0], [0,0]]),
....:                                   Matrix([[0,0], [0,0]])])
sage: C.is_unitary()
False

sage: D = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
....:                                   Matrix([[1,0], [0,1]])])
sage: D.is_unitary()
False

sage: E = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0],[1,0]]),
....:                                   Matrix([[0,1],[0,1]])])
sage: E.is_unitary()
False

sage: F = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,1], [0,0,0], [1,0,0]])])
sage: F.is_unitary()
True

sage: G = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [1,0,0]])])
sage: G.is_unitary()  # Unique right identity, but no left identity.
False
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(QQ, [])
>>> A.is_unitary()
True

>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1)], [-Integer(1),Integer(0)]])])
>>> B.is_unitary()
True

>>> C = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(0),Integer(0)], [Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0)], [Integer(0),Integer(0)]])])
>>> C.is_unitary()
False

>>> D = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]])])
>>> D.is_unitary()
False

>>> E = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)],[Integer(1),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1)],[Integer(0),Integer(1)]])])
>>> E.is_unitary()
False

>>> F = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(1)], [Integer(0),Integer(0),Integer(0)], [Integer(1),Integer(0),Integer(0)]])])
>>> F.is_unitary()
True

>>> G = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(1),Integer(0),Integer(0)]])])
>>> G.is_unitary()  # Unique right identity, but no left identity.
False
is_zero()[source]

Return True if self is the zero ring.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(QQ, [])
sage: A.is_zero()
True

sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([0])])
sage: B.is_zero()
False
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(QQ, [])
>>> A.is_zero()
True

>>> B = FiniteDimensionalAlgebra(GF(Integer(7)), [Matrix([Integer(0)])])
>>> B.is_zero()
False
left_table()[source]

Return the list of matrices for left multiplication by the basis elements.

EXAMPLES:

sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
....:                                   Matrix([[0,1], [-1,0]])])
sage: T = B.left_table(); T
(
[1 0]  [ 0  1]
[0 1], [-1  0]
)
>>> from sage.all import *
>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1)], [-Integer(1),Integer(0)]])])
>>> T = B.left_table(); T
(
[1 0]  [ 0  1]
[0 1], [-1  0]
)

We check immutability:

sage: T[0] = "vandalized by h4xx0r"
Traceback (most recent call last):
...
TypeError: 'tuple' object does not support item assignment
sage: T[1][0] = [13, 37]
Traceback (most recent call last):
...
ValueError: matrix is immutable; please change a copy instead
 (i.e., use copy(M) to change a copy of M).
>>> from sage.all import *
>>> T[Integer(0)] = "vandalized by h4xx0r"
Traceback (most recent call last):
...
TypeError: 'tuple' object does not support item assignment
>>> T[Integer(1)][Integer(0)] = [Integer(13), Integer(37)]
Traceback (most recent call last):
...
ValueError: matrix is immutable; please change a copy instead
 (i.e., use copy(M) to change a copy of M).
maximal_ideal()[source]

Compute the maximal ideal of the local algebra self.

Note

self has to be in the category of unitary, commutative

and associative algebras as in the examples below. It must moreover be local (have a unique maximal ideal).

OUTPUT:

EXAMPLES:

sage: cat = CommutativeAlgebras(GF(3)).FiniteDimensional().WithBasis()
sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])],
....:                              category=cat)
sage: A.maximal_ideal()                                                     # needs sage.rings.finite_rings
Ideal (0, e1) of
 Finite-dimensional algebra of degree 2 over Finite Field of size 3

sage: cat = CommutativeAlgebras(QQ).FiniteDimensional().WithBasis()
sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,0], [0,0,0], [0,0,1]])],
....:                              category=cat)
sage: B.maximal_ideal()                                                     # needs sage.libs.pari
Traceback (most recent call last):
...
ValueError: algebra is not local
>>> from sage.all import *
>>> cat = CommutativeAlgebras(GF(Integer(3))).FiniteDimensional().WithBasis()
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])],
...                              category=cat)
>>> A.maximal_ideal()                                                     # needs sage.rings.finite_rings
Ideal (0, e1) of
 Finite-dimensional algebra of degree 2 over Finite Field of size 3

>>> cat = CommutativeAlgebras(QQ).FiniteDimensional().WithBasis()
>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(1)]])],
...                              category=cat)
>>> B.maximal_ideal()                                                     # needs sage.libs.pari
Traceback (most recent call last):
...
ValueError: algebra is not local
maximal_ideals()[source]

Return a list consisting of all maximal ideals of self.

The algebra self has to be in the category of associative algebras.

EXAMPLES:

sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis()
sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])], category=cat)
sage: A.maximal_ideals()                                                    # needs sage.rings.finite_rings
[Ideal (e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3]

sage: cat = Algebras(QQ).FiniteDimensional().WithBasis()
sage: B = FiniteDimensionalAlgebra(QQ, [], category=cat)
sage: B.maximal_ideals()
[]
>>> from sage.all import *
>>> cat = Algebras(GF(Integer(3))).FiniteDimensional().WithBasis()
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])], category=cat)
>>> A.maximal_ideals()                                                    # needs sage.rings.finite_rings
[Ideal (e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3]

>>> cat = Algebras(QQ).FiniteDimensional().WithBasis()
>>> B = FiniteDimensionalAlgebra(QQ, [], category=cat)
>>> B.maximal_ideals()
[]
ngens()[source]

Return the number of generators of self, i.e., the degree of self over its base field.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
sage: A.ngens()
2
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])])
>>> A.ngens()
2
one()[source]

Return the multiplicative identity element of self, if it exists.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(QQ, [])
sage: A.one()
0

sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
....:                                   Matrix([[0,1], [-1,0]])])
sage: B.one()
e0

sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[0,0], [0,0]]),
....:                                   Matrix([[0,0], [0,0]])])
sage: C.one()
Traceback (most recent call last):
...
TypeError: algebra is not unitary

sage: D = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,1], [0,0,0], [1,0,0]])])
sage: D.one()
e0

sage: E = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [1,0,0]])])
sage: E.one()
Traceback (most recent call last):
...
TypeError: algebra is not unitary
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(QQ, [])
>>> A.one()
0

>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1)], [-Integer(1),Integer(0)]])])
>>> B.one()
e0

>>> C = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(0),Integer(0)], [Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0)], [Integer(0),Integer(0)]])])
>>> C.one()
Traceback (most recent call last):
...
TypeError: algebra is not unitary

>>> D = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(1)], [Integer(0),Integer(0),Integer(0)], [Integer(1),Integer(0),Integer(0)]])])
>>> D.one()
e0

>>> E = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(1),Integer(0),Integer(0)]])])
>>> E.one()
Traceback (most recent call last):
...
TypeError: algebra is not unitary
primary_decomposition()[source]

Return the primary decomposition of self.

Note

self has to be in the category of unitary, commutative

and associative algebras as in the examples below.

OUTPUT:

  • a list consisting of the quotient maps self -> \(A\), with \(A\) running through the primary factors of self

EXAMPLES:

sage: cat = CommutativeAlgebras(GF(3)).FiniteDimensional().WithBasis()
sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])], category=cat)
sage: A.primary_decomposition()                                             # needs sage.rings.finite_rings
[Morphism
  from Finite-dimensional algebra of degree 2 over Finite Field of size 3
    to Finite-dimensional algebra of degree 2 over Finite Field of size 3
  given by matrix [1 0]
                  [0 1]]

sage: cat = CommutativeAlgebras(QQ).FiniteDimensional().WithBasis()
sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,0], [0,0,0], [0,0,1]])], category=cat)
sage: B.primary_decomposition()                                             # needs sage.libs.pari
[Morphism
  from Finite-dimensional algebra of degree 3 over Rational Field
    to Finite-dimensional algebra of degree 1 over Rational Field
  given by matrix [0]
                  [0]
                  [1],
 Morphism
  from Finite-dimensional algebra of degree 3 over Rational Field
    to Finite-dimensional algebra of degree 2 over Rational Field
  given by matrix [1 0]
                  [0 1]
                  [0 0]]
>>> from sage.all import *
>>> cat = CommutativeAlgebras(GF(Integer(3))).FiniteDimensional().WithBasis()
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])], category=cat)
>>> A.primary_decomposition()                                             # needs sage.rings.finite_rings
[Morphism
  from Finite-dimensional algebra of degree 2 over Finite Field of size 3
    to Finite-dimensional algebra of degree 2 over Finite Field of size 3
  given by matrix [1 0]
                  [0 1]]

>>> cat = CommutativeAlgebras(QQ).FiniteDimensional().WithBasis()
>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(1)]])], category=cat)
>>> B.primary_decomposition()                                             # needs sage.libs.pari
[Morphism
  from Finite-dimensional algebra of degree 3 over Rational Field
    to Finite-dimensional algebra of degree 1 over Rational Field
  given by matrix [0]
                  [0]
                  [1],
 Morphism
  from Finite-dimensional algebra of degree 3 over Rational Field
    to Finite-dimensional algebra of degree 2 over Rational Field
  given by matrix [1 0]
                  [0 1]
                  [0 0]]
quotient_map(ideal)[source]

Return the quotient of self by ideal.

self has to be in the category of associative and unital algebras.

INPUT:

OUTPUT:

EXAMPLES:

sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis()
sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])],
....:                              category=cat)
sage: q0 = A.quotient_map(A.zero_ideal()); q0
Morphism
 from Finite-dimensional algebra of degree 2 over Finite Field of size 3
   to Finite-dimensional algebra of degree 2 over Finite Field of size 3
 given by matrix
 [1 0]
 [0 1]
sage: q1 = A.quotient_map(A.ideal(A.gen(1))); q1
Morphism
 from Finite-dimensional algebra of degree 2 over Finite Field of size 3
   to Finite-dimensional algebra of degree 1 over Finite Field of size 3
 given by matrix
 [1]
 [0]
>>> from sage.all import *
>>> cat = Algebras(GF(Integer(3))).FiniteDimensional().WithBasis()
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])],
...                              category=cat)
>>> q0 = A.quotient_map(A.zero_ideal()); q0
Morphism
 from Finite-dimensional algebra of degree 2 over Finite Field of size 3
   to Finite-dimensional algebra of degree 2 over Finite Field of size 3
 given by matrix
 [1 0]
 [0 1]
>>> q1 = A.quotient_map(A.ideal(A.gen(Integer(1)))); q1
Morphism
 from Finite-dimensional algebra of degree 2 over Finite Field of size 3
   to Finite-dimensional algebra of degree 1 over Finite Field of size 3
 given by matrix
 [1]
 [0]
random_element(*args, **kwargs)[source]

Return a random element of self.

Optional input parameters are propagated to the random_element method of the underlying VectorSpace.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
sage: A.random_element()  # random
e0 + 2*e1

sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]),
....:                                   Matrix([[0,1,0], [0,0,0], [0,0,0]]),
....:                                   Matrix([[0,0,0], [0,0,0], [0,0,1]])])
sage: B.random_element(num_bound=1000)  # random
215/981*e0 + 709/953*e1 + 931/264*e2
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])])
>>> A.random_element()  # random
e0 + 2*e1

>>> B = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)]]),
...                                   Matrix([[Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(1)]])])
>>> B.random_element(num_bound=Integer(1000))  # random
215/981*e0 + 709/953*e1 + 931/264*e2
table()[source]

Return the multiplication table of self, as a list of matrices for right multiplication by the basis elements.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
sage: A.table()
(
[1 0]  [0 1]
[0 1], [0 0]
)
>>> from sage.all import *
>>> A = FiniteDimensionalAlgebra(GF(Integer(3)), [Matrix([[Integer(1), Integer(0)], [Integer(0), Integer(1)]]),
...                                      Matrix([[Integer(0), Integer(1)], [Integer(0), Integer(0)]])])
>>> A.table()
(
[1 0]  [0 1]
[0 1], [0 0]
)