Elements of Finite Algebras#

class sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra_element.FiniteDimensionalAlgebraElement[source]#

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: 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
```
```>>> 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()[source]#

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: 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
```
```>>> 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()[source]#

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: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]),
....:                                   Matrix([[0,1], [-1,0]])])
sage: C([1,2]).inverse()
1/5*e0 - 2/5*e1
```
```>>> 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()[source]#

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: 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
```
```>>> 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()[source]#

Return `True` if `self` is nilpotent.

EXAMPLES:

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

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

EXAMPLES:

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

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

EXAMPLES:

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

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

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

Return the minimal polynomial of `self`.

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

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: 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}
```
```>>> 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}
```
vector()[source]#

Return `self` as a vector.

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(5).vector()
(5, 0, 5)
```
```>>> 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)[source]#

Helper for unpickling of finite dimensional algebra elements.