From a7bc94b1e0a3ebeabc9e12b4d705d188257195dc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 24 Jun 2019 12:05:47 -0400 Subject: [PATCH] eja/euclidean_jordan_algebra.py: add span_of_powers() method. --- mjo/eja/euclidean_jordan_algebra.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index 08bce5f..ce6f6e5 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -57,6 +57,18 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): return A.element_class(A, self.vector()*(self.matrix()**(n-1))) + def span_of_powers(self): + """ + Return the vector space spanned by successive powers of + this element. + """ + # The dimension of the subalgebra can't be greater than + # the big algebra, so just put everything into a list + # and let span() get rid of the excess. + V = self.vector().parent() + return V.span( (self**d).vector() for d in xrange(V.dimension()) ) + + def degree(self): """ Compute the degree of this element the straightforward way @@ -74,13 +86,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): 2 """ - d = 0 - V = self.vector().parent() - vectors = [(self**d).vector()] - while V.span(vectors).dimension() > d: - d += 1 - vectors.append((self**d).vector()) - return d + return self.span_of_powers().dimension() + def minimal_polynomial(self): return self.matrix().minimal_polynomial() -- 2.44.2