Finite-Dimensional Algebras - Algebras

Skip to content
Back to top
View this page
Edit this page

# Finite-Dimensional Algebras

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

  Bases: `UniqueRepresentation`, `Parent`

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

  This is a magmatic \(k\)-algebra, i.e., not necessarily associative or unital.

  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

  - `assume_unital` – boolean (default: `False`); if `True`, then the category is set to `category.Unital()` and methods requiring unitality 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

      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
      sage: B.one()
      e0 + e2
      sage: B.is_associative()
      True

  Python

      >>> 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
      >>> B.one()
      e0 + e2
      >>> B.is_associative()
      True

  A more complicated example (the descent algebra of \(S_3\) in a slightly rescaled I-basis, see `DescentAlgebra`):

  Sage

      sage: Ma = Matrix([[6,0,0,0], [0,0,0,0], [0,0,0,0], [0,0,0,0]])
      sage: Mb = Matrix([[0,0,0,0], [0,1,0,0], [0,1,0,0], [0,0,0,0]])
      sage: Mc = Matrix([[0,0,0,0], [0,0,1,0], [0,0,1,0], [0,0,0,0]])
      sage: Md = Matrix([[0,0,0,0], [0,1,-1,0], [0,-1,1,0], [0,0,0,2]])
      sage: C = FiniteDimensionalAlgebra(QQ, [Ma, Mb, Mc, Md])
      sage: C.one()
      1/6*e0 + 1/2*e1 + 1/2*e2 + 1/2*e3
      sage: C.is_associative()
      True
      sage: C.is_commutative()
      False

  [Python]

      >>> from sage.all import *
      >>> Ma = Matrix([[Integer(6),Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0),Integer(0)]])
      >>> Mb = Matrix([[Integer(0),Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(0),Integer(0)]])
      >>> Mc = Matrix([[Integer(0),Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0),Integer(0)]])
      >>> Md = Matrix([[Integer(0),Integer(0),Integer(0),Integer(0)], [Integer(0),Integer(1),-Integer(1),Integer(0)], [Integer(0),-Integer(1),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(0),Integer(2)]])
      >>> C = FiniteDimensionalAlgebra(QQ, [Ma, Mb, Mc, Md])
      >>> C.one()
      1/6*e0 + 1/2*e1 + 1/2*e2 + 1/2*e3
      >>> C.is_associative()
      True
      >>> C.is_commutative()
      False

  If we set both `is_associative` and `is_unital` to `True`, then this is an associative unital algebra and belongs to the category of `sage.categories.finite_dimensional_algebras_with_basis.FiniteDimensionalAlgebrasWithBasis`:

  Sage

      sage: C = FiniteDimensionalAlgebra(QQ, [Ma, Mb, Mc, Md],
      ....:                              assume_associative=True,
      ....:                              assume_unital=True)
      sage: C.radical_basis()
      (e1 - e2,)
      sage: C.radical()
      Radical of Finite-dimensional algebra of degree 4 over Rational Field
      sage: C.center_basis()
      (e0, e1 + e2 + e3)
      sage: C.center()
      Center of Finite-dimensional algebra of degree 4 over Rational Field
      sage: C.center().is_commutative()
      True
      sage: e = C.basis()
      sage: C.annihilator_basis([e[1]])
      (e0, e1 - e2, e3)
      sage: C.annihilator_basis([e[1]], side='left')
      (e0, e1 - e2 - e3)

  Python

      >>> from sage.all import *
      >>> C = FiniteDimensionalAlgebra(QQ, [Ma, Mb, Mc, Md],
      ...                              assume_associative=True,
      ...                              assume_unital=True)
      >>> C.radical_basis()
      (e1 - e2,)
      >>> C.radical()
      Radical of Finite-dimensional algebra of degree 4 over Rational Field
      >>> C.center_basis()
      (e0, e1 + e2 + e3)
      >>> C.center()
      Center of Finite-dimensional algebra of degree 4 over Rational Field
      >>> C.center().is_commutative()
      True
      >>> e = C.basis()
      >>> C.annihilator_basis([e[Integer(1)]])
      (e0, e1 - e2, e3)
      >>> C.annihilator_basis([e[Integer(1)]], side='left')
      (e0, e1 - e2 - e3)

  Element

    alias of `FiniteDimensionalAlgebraElement`

  base_extend(F)

    Return `self` base changed to the field `F`.

    EXAMPLES:

    Sage

        sage: C = FiniteDimensionalAlgebra(GF(2), [Matrix([1])])
        sage: k.<y> = GF(4)
        sage: C.base_extend(k)
        Finite-dimensional algebra of degree 1 over Finite Field in y of size 2^2

    Python

        >>> from sage.all import *
        >>> C = FiniteDimensionalAlgebra(GF(Integer(2)), [Matrix([Integer(1)])])
        >>> k = GF(Integer(4), names=('y',)); (y,) = k._first_ngens(1)
        >>> C.base_extend(k)
        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

        sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
        ....:                                      Matrix([[0, 1], [0, 0]])])
        sage: A.basis()
        Finite family {0: e0, 1: e1}

    Python

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

    Return the cardinality of `self`.

    EXAMPLES:

    Sage

        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

    Python

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

    alias of `ngens()`.

  from_base_ring(x)
  gen(i)

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

    EXAMPLES:

    Sage

        sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]),
        ....:                                      Matrix([[0, 1], [0, 0]])])
        sage: A.gen(0)
        e0

    Python

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

    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

        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

    Python

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

    Return `True` if `self` is associative.

    EXAMPLES:

    Sage

        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

    Python

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

    Return `True` if `self` is commutative.

    EXAMPLES:

    Sage

        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

    Python

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

    Return `True` if the cardinality of `self` is finite.

    EXAMPLES:

    Sage

        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

    Python

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

    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

        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

    Python

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

    Return `True` if `self` is the zero ring.

    EXAMPLES:

    Sage

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

        sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([0])])
        sage: B.is_zero()
        False

    Python

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

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

    EXAMPLES:

    Sage

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

    Python

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

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

    [Python]

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

    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:

    - `FiniteDimensionalAlgebraIdeal`; the unique maximal ideal of `self`. If `self` is not a local algebra, a `ValueError` is raised.

    EXAMPLES:

    Sage

        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()
        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()
        Traceback (most recent call last):
        ...
        ValueError: algebra is not local

    Python

        >>> 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()
        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()
        Traceback (most recent call last):
        ...
        ValueError: algebra is not local

  maximal_ideals()

    Return a list consisting of all maximal ideals of `self`.

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

    EXAMPLES:

    Sage

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

    Python

        >>> 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()
        [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()

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

    EXAMPLES:

    Sage

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

    Python

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

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

    EXAMPLES:

    Sage

        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

    Python

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

    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

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

    Python

        >>> 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()
        [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()
        [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`.

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

    INPUT:

    - `ideal` – a `FiniteDimensionalAlgebraIdeal`

    OUTPUT:

    - `FiniteDimensionalAlgebraMorphism`; the quotient homomorphism

    EXAMPLES:

    Sage

        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]

    Python

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

    Return a random element of `self`.

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

    EXAMPLES:

    Sage

        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

    Python

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

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

    EXAMPLES:

    Sage

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

    Python

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