Finite-Dimensional Algebras#

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

Bases: UniqueRepresentation, Algebra

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

INPUT:

  • k – a field

  • table – a list of matrices

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

  • assume_associative – (default: False) boolean; 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
Element#

alias of FiniteDimensionalAlgebraElement

base_extend(F)#

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
basis()#

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()
Family (e0, e1)
cardinality()#

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
degree()#

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_base_ring(x)#
gen(i)#

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
ideal(gens=None, given_by_matrix=False, side=None)#

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

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
sage: A.ideal(A([1,1]))
Ideal (e0 + e1) of
 Finite-dimensional algebra of degree 2 over Finite Field of size 3
is_associative()#

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
is_commutative()#

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
is_finite()#

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
is_unitary()#

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
is_zero()#

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
left_table()#

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

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).
maximal_ideal()#

Compute the maximal ideal of the local algebra self.

Note

self must be unitary, commutative, associative and local (have a unique maximal ideal).

OUTPUT:

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
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: 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.maximal_ideal()                                                     # needs sage.libs.pari
Traceback (most recent call last):
...
ValueError: algebra is not local
maximal_ideals()#

Return a list consisting of all maximal ideals of self.

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
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: B = FiniteDimensionalAlgebra(QQ, [])
sage: B.maximal_ideals()
[]
ngens()#

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
one()#

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
primary_decomposition()#

Return the primary decomposition of self.

Note

self must be unitary, commutative and associative.

OUTPUT:

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

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
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: 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.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)#

Return the quotient of self by ideal.

INPUT:

OUTPUT:

EXAMPLES:

sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
....:                                      Matrix([[0, 1], [0, 0]])])
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]
random_element(*args, **kwargs)#

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
table()#

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