]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: recurse more directly in minimal_polynomial().
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 25 Jun 2019 21:13:41 +0000 (17:13 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 29 Jul 2019 03:19:01 +0000 (23:19 -0400)
mjo/eja/euclidean_jordan_algebra.py

index bb460194970e3da92709082a81f78c86a6c88d5c..8f623b4491ca1439d0905b5b91bcfe25cf754ecb 100644 (file)
@@ -242,18 +242,25 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
                 True
 
             """
-            if self.parent().is_associative():
-                return self.matrix().minimal_polynomial()
+            # The element we're going to call "minimal_polynomial()" on.
+            # Either myself, interpreted as an element of a finite-
+            # dimensional algebra, or an element of an associative
+            # subalgebra.
+            elt = None
 
-            V = self.span_of_powers()
-            assoc_subalg = self.subalgebra_generated_by()
-            # Mis-design warning: the basis used for span_of_powers()
-            # and subalgebra_generated_by() must be the same, and in
-            # the same order!
-            subalg_self = assoc_subalg(V.coordinates(self.vector()))
-            # Recursive call, but should work since the subalgebra is
-            # associative.
-            return subalg_self.minimal_polynomial()
+            if self.parent().is_associative():
+                elt = FiniteDimensionalAlgebraElement(self.parent(), self)
+            else:
+                V = self.span_of_powers()
+                assoc_subalg = self.subalgebra_generated_by()
+                # Mis-design warning: the basis used for span_of_powers()
+                # and subalgebra_generated_by() must be the same, and in
+                # the same order!
+                elt = assoc_subalg(V.coordinates(self.vector()))
+
+            # Recursive call, but should work since elt lives in an
+            # associative algebra.
+            return elt.minimal_polynomial()
 
 
         def characteristic_polynomial(self):