Elements of Finite Algebras - Algebras

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

# Elements of Finite Algebras

class sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra_element.FiniteDimensionalAlgebraElement

  Bases: `AlgebraElement`

  Create an element of a `FiniteDimensionalAlgebra` using a multiplication table.

  INPUT:

  - `A` – a `FiniteDimensionalAlgebra` which will be the parent

  - `elt` – vector, matrix or element of the base field (default: `None`)

  - `check` – boolean (default: `True`); if `False` and `elt` is a matrix, assume that it is known to be the matrix of an element

  If `elt` is a vector or a matrix consisting of a single row, it is interpreted as a vector of coordinates with respect to the given basis of `A`. If `elt` is a square matrix, it is interpreted as a multiplication matrix with respect to this basis.

  EXAMPLES:

  Sage

      sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]),
      ....:                                      Matrix([[0,1], [0,0]])])
      sage: A(17)
      2*e0
      sage: A([1,1])
      e0 + 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(Integer(17))
      2*e0
      >>> A([Integer(1),Integer(1)])
      e0 + e1

  characteristic_polynomial()

    Return the characteristic polynomial of `self`.

    Note

    This function just returns the characteristic polynomial of the matrix of right multiplication by `self`. This may not be a very meaningful invariant if the algebra is not unitary and associative.

    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(0).characteristic_polynomial()                                      # needs sage.libs.pari
        x^3
        sage: b = B.random_element()
        sage: f = b.characteristic_polynomial(); f  # random                        # needs sage.libs.pari
        x^3 - 8*x^2 + 16*x
        sage: f(b) == 0                                                             # needs sage.libs.pari
        True

    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(Integer(0)).characteristic_polynomial()                                      # needs sage.libs.pari
        x^3
        >>> b = B.random_element()
        >>> f = b.characteristic_polynomial(); f  # random                        # needs sage.libs.pari
        x^3 - 8*x^2 + 16*x
        >>> f(b) == Integer(0)                                                             # needs sage.libs.pari
        True

  inverse()

    Return the two-sided multiplicative inverse of `self`, if it exists.

    This assumes that the algebra to which `self` belongs is associative.

    Note

    If an element of a finite-dimensional unitary associative algebra over a field admits a left inverse, then this is the unique left inverse, and it is also a right inverse.

    EXAMPLES:

    Sage

        sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
        ....:                                   Matrix([[0,1], [-1,0]])])
        sage: C([1,2]).inverse()
        1/5*e0 - 2/5*e1

    Python

        >>> from sage.all import *
        >>> C = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]),
        ...                                   Matrix([[Integer(0),Integer(1)], [-Integer(1),Integer(0)]])])
        >>> C([Integer(1),Integer(2)]).inverse()
        1/5*e0 - 2/5*e1

  is_invertible()

    Return `True` if `self` has a two-sided multiplicative inverse.

    This assumes that the algebra to which `self` belongs is associative.

    Note

    If an element of a unitary finite-dimensional algebra over a field admits a left inverse, then this is the unique left inverse, and it is also a right inverse.

    EXAMPLES:

    Sage

        sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
        ....:                                   Matrix([[0,1], [-1,0]])])
        sage: C([1,2]).is_invertible()
        True
        sage: C(0).is_invertible()
        False

    Python

        >>> from sage.all import *
        >>> C = FiniteDimensionalAlgebra(QQ, [Matrix([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]),
        ...                                   Matrix([[Integer(0),Integer(1)], [-Integer(1),Integer(0)]])])
        >>> C([Integer(1),Integer(2)]).is_invertible()
        True
        >>> C(Integer(0)).is_invertible()
        False

  is_nilpotent()

    Return `True` if `self` is nilpotent.

    EXAMPLES:

    Sage

        sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
        ....:                                   Matrix([[0,1], [0,0]])])
        sage: C([1,0]).is_nilpotent()
        False
        sage: C([0,1]).is_nilpotent()
        True

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

    Python

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

        >>> A = FiniteDimensionalAlgebra(QQ, [Matrix([Integer(0)])])
        >>> A([Integer(1)]).is_nilpotent()
        True

  is_zerodivisor()

    Return `True` if `self` is a left or right zero-divisor.

    EXAMPLES:

    Sage

        sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
        ....:                                   Matrix([[0,1], [0,0]])])
        sage: C([1,0]).is_zerodivisor()
        False
        sage: C([0,1]).is_zerodivisor()
        True

    Python

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

  left_matrix()

    Return the matrix for multiplication by `self` from the left.

    EXAMPLES:

    Sage

        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([1,2,0]).left_matrix()
        [1 0 0]
        [0 1 0]
        [0 2 0]

    Python

        >>> from sage.all import *
        >>> 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([Integer(1),Integer(2),Integer(0)]).left_matrix()
        [1 0 0]
        [0 1 0]
        [0 2 0]

  matrix()

    Return the matrix for multiplication by `self` from the right.

    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(5).matrix()
        [5 0 0]
        [0 5 0]
        [0 0 5]

    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(Integer(5)).matrix()
        [5 0 0]
        [0 5 0]
        [0 0 5]

  minimal_polynomial()

    Return the minimal polynomial of `self`.

    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(0).minimal_polynomial()                                             # needs sage.libs.pari
        x
        sage: b = B.random_element()
        sage: f = b.minimal_polynomial(); f  # random                               # needs sage.libs.pari
        x^3 + 1/2*x^2 - 7/16*x + 1/16
        sage: f(b) == 0                                                             # needs sage.libs.pari
        True

    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(Integer(0)).minimal_polynomial()                                             # needs sage.libs.pari
        x
        >>> b = B.random_element()
        >>> f = b.minimal_polynomial(); f  # random                               # needs sage.libs.pari
        x^3 + 1/2*x^2 - 7/16*x + 1/16
        >>> f(b) == Integer(0)                                                             # needs sage.libs.pari
        True

  monomial_coefficients(copy=True)

    Return a dictionary whose keys are indices of basis elements in the support of `self` and whose values are the corresponding coefficients.

    INPUT:

    - `copy` – ignored

    EXAMPLES:

    Sage

        sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
        ....:                                   Matrix([[0,1], [-1,0]])])
        sage: elt = B(Matrix([[1,1], [-1,1]]))
        sage: elt.monomial_coefficients()
        {0: 1, 1: 1}
        sage: B.one().monomial_coefficients()
        {0: 1}

    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)]])])
        >>> elt = B(Matrix([[Integer(1),Integer(1)], [-Integer(1),Integer(1)]]))
        >>> elt.monomial_coefficients()
        {0: 1, 1: 1}
        >>> B.one().monomial_coefficients()
        {0: 1}

  vector()

    Return `self` as a vector.

    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(5).vector()
        (5, 0, 5)

    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(Integer(5)).vector()
        (5, 0, 5)

sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra_element.unpickle_FiniteDimensionalAlgebraElement(A, vec, mat)

  Helper for unpickling of finite dimensional algebra elements.