X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feuclidean_jordan_algebra.py;h=2c496cd3ed893b3fd34f82f6e3ce730c757e0926;hb=ab8ae4abd5b5414d57059b985259337b58528793;hp=b5cef0a8ba16f8a2afb0a66a0f38a6ac6daaa6ae;hpb=9fca3c9328ffbdbdb853a889362f75f4c38a6d7d;p=sage.d.git diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index b5cef0a..2c496cd 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -110,31 +110,12 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): r = self.rank() n = self.dimension() - # First, compute the basis B... - x0 = self.zero() - c = 1 - for g in self.gens(): - x0 += c*g - c +=1 - if not x0.is_regular(): - raise ValueError("don't know a regular element") - - V = x0.vector().parent().ambient_vector_space() - V1 = V.span_of_basis( (x0**k).vector() for k in range(self.rank()) ) - B = (V1.basis() + V1.complement().basis()) - # Now switch to the polynomial rings. - names = ['X' + str(i) for i in range(1,n+1)] R = PolynomialRing(self.base_ring(), names) J = FiniteDimensionalEuclideanJordanAlgebra(R, self._multiplication_table, rank=r) - B = [ b.change_ring(R.fraction_field()) for b in B ] - # Get the vector space (as opposed to module) so that - # span_of_basis() works. - V = J.zero().vector().parent().ambient_vector_space() - W = V.span_of_basis(B) def e(k): # The coordinates of e_k with respect to the basis B. @@ -143,10 +124,10 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): # A matrix implementation 1 x = J(vector(R, R.gens())) - l1 = [column_matrix(W.coordinates((x**k).vector())) for k in range(r)] + l1 = [column_matrix((x**k).vector()) for k in range(r)] l2 = [e(k) for k in range(r+1, n+1)] A_of_x = block_matrix(1, n, (l1 + l2)) - xr = W.coordinates((x**r).vector()) + xr = (x**r).vector() a = [] denominator = A_of_x.det() # This is constant for i in range(n): @@ -410,17 +391,37 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): def characteristic_polynomial(self): """ - Return my characteristic polynomial (if I'm a regular - element). + Return the characteristic polynomial of this element. + + EXAMPLES: + + The rank of `R^3` is three, and the minimal polynomial of + the identity element is `(t-1)` from which it follows that + the characteristic polynomial should be `(t-1)^3`:: + + sage: J = RealCartesianProductEJA(3) + sage: J.one().characteristic_polynomial() + t^3 - 3*t^2 + 3*t - 1 + + Likewise, the characteristic of the zero element in the + rank-three algebra `R^{n}` should be `t^{3}`:: + + sage: J = RealCartesianProductEJA(3) + sage: J.zero().characteristic_polynomial() + t^3 + + The characteristic polynomial of an element should evaluate + to zero on that element:: + + sage: set_random_seed() + sage: x = RealCartesianProductEJA(3).random_element() + sage: p = x.characteristic_polynomial() + sage: x.apply_univariate_polynomial(p) + 0 - Eventually this should be implemented in terms of the parent - algebra's characteristic polynomial that works for ALL - elements. """ - if self.is_regular(): - return self.minimal_polynomial() - else: - raise NotImplementedError('irregular element') + p = self.parent().characteristic_polynomial() + return p(*self.vector()) def inner_product(self, other):