SETUP::
sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+ ....: TrivialEJA,
....: random_eja)
EXAMPLES::
sage: x.det()
-1
+ The determinant of the sole element in the rank-zero trivial
+ algebra is ``1``, by three paths of reasoning. First, its
+ characteristic polynomial is a constant ``1``, so the constant
+ term in that polynomial is ``1``. Second, the characteristic
+ polynomial evaluated at zero is again ``1``. And finally, the
+ (empty) product of its eigenvalues is likewise just unity::
+
+ sage: J = TrivialEJA()
+ sage: J.zero().det()
+ 1
+
TESTS:
An element is invertible if and only if its determinant is
sage: x,y = J.random_elements(2)
sage: (x*y).det() == x.det()*y.det()
True
-
"""
P = self.parent()
r = P.rank()
- p = P._charpoly_coeff(0)
- # The _charpoly_coeff function already adds the factor of
- # -1 to ensure that _charpoly_coeff(0) is really what
- # appears in front of t^{0} in the charpoly. However,
- # we want (-1)^r times THAT for the determinant.
+
+ if r == 0:
+ # Special case, since we don't get the a0=1
+ # coefficient when the rank of the algebra
+ # is zero.
+ return P.base_ring().one()
+
+ p = P._charpoly_coefficients()[0]
+ # The _charpoly_coeff function already adds the factor of -1
+ # to ensure that _charpoly_coefficients()[0] is really what
+ # appears in front of t^{0} in the charpoly. However, we want
+ # (-1)^r times THAT for the determinant.
return ((-1)**r)*p(*self.to_vector())
result.append( (evalue, proj(A.one()).superalgebra_element()) )
return result
- def full_spectral_decomposition(self):
- if self.is_zero():
- # Following the convention that the empty sum is the
- # algebra's additive identity.
- return []
-
- A = self.subalgebra_generated_by(orthonormalize_basis=True)
- if A.dimension() == 1:
- # I'm a scalar multiple of the identity element
- s = self.norm() / A.one().norm()
- return [(s, self * ~s)]
-
- result = []
- for (evalue, proj) in A(self).operator().spectral_decomposition():
- c = proj(A.one()).superalgebra_element()
-
- # We know that "c" here is idempotent, so the only question is
- # whether or not it can be decomposed further.
- if c.is_primitive_idempotent():
- result.append( (evalue, c) )
- else:
- for b in A.gens():
- b_decomp = b.full_spectral_decomposition()
- if len(b_decomp) > 1:
- for (a,y) in b_decomp:
- y_sup = y.superalgebra_element()
- eigenvecs = [ r[1] for r in result ]
- if not y_sup in eigenvecs:
- result.append( ( evalue*a, y_sup) )
- return result
-
def subalgebra_generated_by(self, orthonormalize_basis=False):
"""
Return the associative subalgebra of the parent EJA generated
TESTS:
Ensure that we can find an idempotent in a non-trivial algebra
- where there are non-nilpotent elements::
+ where there are non-nilpotent elements, or that we get the dumb
+ solution in the trivial algebra::
sage: set_random_seed()
- sage: J = random_eja(nontrivial=True)
+ sage: J = random_eja()
sage: x = J.random_element()
- sage: while x.is_nilpotent():
+ sage: while x.is_nilpotent() and not J.is_trivial():
....: x = J.random_element()
sage: c = x.subalgebra_idempotent()
sage: c^2 == c
# the trace is an empty sum.
return P.base_ring().zero()
- p = P._charpoly_coeff(r-1)
+ p = P._charpoly_coefficients()[r-1]
# The _charpoly_coeff function already adds the factor of
# -1 to ensure that _charpoly_coeff(r-1) is really what
# appears in front of t^{r-1} in the charpoly. However,