]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/euclidean_jordan_algebra.py
eja: add is_regular() method on elements.
[sage.d.git] / mjo / eja / euclidean_jordan_algebra.py
index ef5249bc6abe4f9d4dd62bf0f5de07caa85fed26..60a7ba1ede07bac242eb9aef6bcf9b722340c595 100644 (file)
@@ -126,6 +126,30 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
                 return A.element_class(A, (self.matrix()**(n-1))*self.vector())
 
 
+        def is_regular(self):
+            """
+            Return whether or not this is a regular element.
+
+            EXAMPLES:
+
+            The identity element always has degree one, but any element
+            linearly-independent from it is regular::
+
+                sage: J = eja_ln(5)
+                sage: J.one().is_regular()
+                False
+                sage: e0, e1, e2, e3, e4 = J.gens() # e0 is the identity
+                sage: for x in J.gens():
+                ....:     (J.one() + x).is_regular()
+                False
+                True
+                True
+                True
+                True
+
+            """
+            return self.degree() == self.parent().rank()
+
         def span_of_powers(self):
             """
             Return the vector space spanned by successive powers of
@@ -168,6 +192,19 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
             return self.span_of_powers().dimension()
 
 
+        def matrix(self):
+            """
+            Return the matrix that represents left- (or right-)
+            multiplication by this element in the parent algebra.
+
+            We have to override this because the superclass method
+            returns a matrix that acts on row vectors (that is, on
+            the right).
+            """
+            fda_elt = FiniteDimensionalAlgebraElement(self.parent(), self)
+            return fda_elt.matrix().transpose()
+
+
         def subalgebra_generated_by(self):
             """
             Return the associative subalgebra of the parent EJA generated
@@ -351,6 +388,19 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
             """
             Find an idempotent in the associative subalgebra I generate
             using Proposition 2.3.5 in Baes.
+
+            TESTS::
+
+                sage: set_random_seed()
+                sage: J = eja_rn(5)
+                sage: c = J.random_element().subalgebra_idempotent()
+                sage: c^2 == c
+                True
+                sage: J = eja_ln(5)
+                sage: c = J.random_element().subalgebra_idempotent()
+                sage: c^2 == c
+                True
+
             """
             if self.is_nilpotent():
                 raise ValueError("this only works with non-nilpotent elements!")