X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feuclidean_jordan_algebra.py;h=0b6b15da68fd4404f69ce094f4f96d07ad2c6adc;hb=4b1bdeb8c097e6c162cb0a32c07ba2740d89b1e5;hp=08bce5f7c7b24a96d9fa982bb1ec0c77dc01807a;hpb=6db5d3bdea85cdc88c4dcdce1a75b888d1c4f1d8;p=sage.d.git diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index 08bce5f..0b6b15d 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -39,6 +39,15 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): class Element(FiniteDimensionalAlgebraElement): """ An element of a Euclidean Jordan algebra. + + Since EJAs are commutative, the "right multiplication" matrix is + also the left multiplication matrix and must be symmetric:: + + sage: set_random_seed() + sage: J = eja_ln(5) + sage: J.random_element().matrix().is_symmetric() + True + """ def __pow__(self, n): @@ -57,6 +66,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 +95,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()