X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feuclidean_jordan_algebra.py;h=da1145d1851c91cf1f7faef014ba8a519d5d3fcf;hb=90738291f084c62d009a51bba56346a83f88f950;hp=c4b085089462c87be5db2ef8301583193c000770;hpb=6e48d7f92e380202e94ea9400fd8359ed660fd73;p=sage.d.git diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index c4b0850..da1145d 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -315,6 +315,49 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): return A( (self.operator_matrix()**(n-1))*self.vector() ) + def apply_univariate_polynomial(self, p): + """ + Apply the univariate polynomial ``p`` to this element. + + A priori, SageMath won't allow us to apply a univariate + polynomial to an element of an EJA, because we don't know + that EJAs are rings (they are usually not associative). Of + course, we know that EJAs are power-associative, so the + operation is ultimately kosher. This function sidesteps + the CAS to get the answer we want and expect. + + EXAMPLES:: + + sage: R = PolynomialRing(QQ, 't') + sage: t = R.gen(0) + sage: p = t^4 - t^3 + 5*t - 2 + sage: J = RealCartesianProductEJA(5) + sage: J.one().apply_univariate_polynomial(p) == 3*J.one() + True + + TESTS: + + We should always get back an element of the algebra:: + + sage: set_random_seed() + sage: p = PolynomialRing(QQ, 't').random_element() + sage: J = random_eja() + sage: x = J.random_element() + sage: x.apply_univariate_polynomial(p) in J + True + + """ + if len(p.variables()) > 1: + raise ValueError("not a univariate polynomial") + P = self.parent() + R = P.base_ring() + # Convert the coeficcients to the parent's base ring, + # because a priori they might live in an (unnecessarily) + # larger ring for which P.sum() would fail below. + cs = [ R(c) for c in p.coefficients(sparse=False) ] + return P.sum( cs[k]*(self**k) for k in range(len(cs)) ) + + def characteristic_polynomial(self): """ Return my characteristic polynomial (if I'm a regular @@ -724,6 +767,14 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): sage: bool(actual == expected) True + The minimal polynomial should always kill its element:: + + sage: set_random_seed() + sage: x = random_eja().random_element() + sage: p = x.minimal_polynomial() + sage: x.apply_univariate_polynomial(p) + 0 + """ V = self.span_of_powers() assoc_subalg = self.subalgebra_generated_by()