X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feuclidean_jordan_algebra.py;h=8f508bc305304d249440294267cc56f6099c631b;hb=1ba2e2b5a4b46933c820ec7cc61cc6dcb8cadc6b;hp=0ea9a4debe9c2ad0e33652f50b779fb8fc3838d3;hpb=9c34119f1c650df0a4c2c20ea4723152de80edae;p=sage.d.git diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index 0ea9a4d..8f508bc 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -71,6 +71,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): """ self._rank = rank self._natural_basis = natural_basis + self._multiplication_table = mult_table fda = super(FiniteDimensionalEuclideanJordanAlgebra, self) fda.__init__(field, mult_table, @@ -86,6 +87,54 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): return fmt.format(self.degree(), self.base_ring()) + def characteristic_polynomial(self): + r = self.rank() + n = self.dimension() + + 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) + x0 = J.zero() + c = 1 + for g in J.gens(): + x0 += c*g + c +=1 + if not x0.is_regular(): + raise ValueError("don't know a regular element") + + # Get the vector space (as opposed to module) so that + # span_of_basis() works. + V = x0.vector().parent().ambient_vector_space() + V1 = V.span_of_basis( (x0**k).vector() for k in range(r) ) + B = V1.basis() + V1.complement().basis() + W = V.span_of_basis(B) + + def e(k): + # The coordinates of e_k with respect to the basis B. + # But, the e_k are elements of B... + return identity_matrix(J.base_ring(), n).column(k-1).column() + + # A matrix implementation 1 + x = J(vector(R, R.gens())) + l1 = [column_matrix(W.coordinates((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()) + a = [] + for i in range(n): + A_cols = A.columns() + A_cols[i] = xr + numerator = column_matrix(A.base_ring(), A_cols).det() + denominator = A.det() + ai = numerator/denominator + a.append(ai) + + # Note: all entries past the rth should be zero. + return a + + def inner_product(self, x, y): """ The inner product associated with this Euclidean Jordan algebra. @@ -626,6 +675,9 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): def minimal_polynomial(self): """ + Return the minimal polynomial of this element, + as a function of the variable `t`. + ALGORITHM: We restrict ourselves to the associative subalgebra @@ -633,14 +685,20 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): polynomial of this element's operator matrix (in that subalgebra). This works by Baes Proposition 2.3.16. - EXAMPLES:: + TESTS: + + The minimal polynomial of the identity and zero elements are + always the same:: sage: set_random_seed() - sage: x = random_eja().random_element() - sage: x.degree() == x.minimal_polynomial().degree() - True + sage: J = random_eja() + sage: J.one().minimal_polynomial() + t - 1 + sage: J.zero().minimal_polynomial() + t - :: + The degree of an element is (by one definition) the degree + of its minimal polynomial:: sage: set_random_seed() sage: x = random_eja().random_element() @@ -661,8 +719,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): sage: y0 = y.vector()[0] sage: y_bar = y.vector()[1:] sage: actual = y.minimal_polynomial() - sage: x = SR.symbol('x', domain='real') - sage: expected = x^2 - 2*y0*x + (y0^2 - norm(y_bar)^2) + sage: t = PolynomialRing(J.base_ring(),'t').gen(0) + sage: expected = t^2 - 2*y0*t + (y0^2 - norm(y_bar)^2) sage: bool(actual == expected) True @@ -673,7 +731,11 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): # and subalgebra_generated_by() must be the same, and in # the same order! elt = assoc_subalg(V.coordinates(self.vector())) - return elt.operator_matrix().minimal_polynomial() + + # We get back a symbolic polynomial in 'x' but want a real + # polynomial in 't'. + p_of_x = elt.operator_matrix().minimal_polynomial() + return p_of_x.change_variable_name('t') def natural_representation(self): @@ -876,7 +938,10 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): # 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() + # + # We do the extra ambient_vector_space() in case we're messing + # with polynomials and the direct parent is a module. + V = self.vector().parent().ambient_vector_space() return V.span( (self**d).vector() for d in xrange(V.dimension()) )