]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: fix the characteristic polynomial in subalgebras.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 9 Aug 2019 23:39:15 +0000 (19:39 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 9 Aug 2019 23:39:15 +0000 (19:39 -0400)
mjo/eja/eja_algebra.py
mjo/eja/eja_element.py

index 832e7a19d5857fcd429a11b8693565aa781ba617..06f6f531ac46305da59ec2b4290ba808602cea50 100644 (file)
@@ -12,7 +12,7 @@ from sage.matrix.constructor import matrix
 from sage.misc.cachefunc import cached_method
 from sage.misc.prandom import choice
 from sage.misc.table import table
-from sage.modules.free_module import VectorSpace
+from sage.modules.free_module import FreeModule, VectorSpace
 from sage.rings.integer_ring import ZZ
 from sage.rings.number_field.number_field import QuadraticField
 from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
@@ -207,8 +207,13 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         determinant).
         """
         z = self._a_regular_element()
-        V = self.vector_space()
-        V1 = V.span_of_basis( (z**k).to_vector() for k in range(self.rank()) )
+        # Don't use the parent vector space directly here in case this
+        # happens to be a subalgebra. In that case, we would be e.g.
+        # two-dimensional but span_of_basis() would expect three
+        # coordinates.
+        V = VectorSpace(self.base_ring(), self.vector_space().dimension())
+        basis = [ (z**k).to_vector() for k in range(self.rank()) ]
+        V1 = V.span_of_basis( basis )
         b =  (V1.basis() + V1.complement().basis())
         return V.span_of_basis(b)
 
@@ -263,7 +268,13 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         # have multivatiate polynomial entries.
         names = tuple('X' + str(i) for i in range(1,n+1))
         R = PolynomialRing(self.base_ring(), names)
-        V = self.vector_space().change_ring(R)
+
+        # Using change_ring() on the parent's vector space doesn't work
+        # here because, in a subalgebra, that vector space has a basis
+        # and change_ring() tries to bring the basis along with it. And
+        # that doesn't work unless the new ring is a PID, which it usually
+        # won't be.
+        V = FreeModule(R,n)
 
         # Now let x = (X1,X2,...,Xn) be the vector whose entries are
         # indeterminates...
index c47156d31e2c6989e1fe863091794520f395523c..e1f75630bf5b3fc33292e4c84fa657fed715828a 100644 (file)
@@ -165,6 +165,21 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
             sage: x.apply_univariate_polynomial(p)
             0
 
+        The characteristic polynomials of the zero and unit elements
+        should be what we think they are in a subalgebra, too::
+
+            sage: J = RealCartesianProductEJA(3)
+            sage: p1 = J.one().characteristic_polynomial()
+            sage: q1 = J.zero().characteristic_polynomial()
+            sage: e0,e1,e2 = J.gens()
+            sage: A = (e0 + 2*e1 + 3*e2).subalgebra_generated_by() # dim 3
+            sage: p2 = A.one().characteristic_polynomial()
+            sage: q2 = A.zero().characteristic_polynomial()
+            sage: p1 == p2
+            True
+            sage: q1 == q2
+            True
+
         """
         p = self.parent().characteristic_polynomial()
         return p(*self.to_vector())
@@ -368,6 +383,16 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
             sage: x.is_invertible() == (x.det() != 0)
             True
 
+        Ensure that the determinant is multiplicative on an associative
+        subalgebra as in Faraut and Koranyi's Proposition II.2.2::
+
+            sage: set_random_seed()
+            sage: J = random_eja().random_element().subalgebra_generated_by()
+            sage: x = J.random_element()
+            sage: y = J.random_element()
+            sage: (x*y).det() == x.det()*y.det()
+            True
+
         """
         P = self.parent()
         r = P.rank()