]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: fix base ring of fast _charpoly_coefficients().
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 10 Nov 2020 13:39:25 +0000 (08:39 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 10 Nov 2020 13:39:25 +0000 (08:39 -0500)
mjo/eja/eja_algebra.py

index 1fc3618005eb0ac8be12e0e3e09849ab6f983819..e288c6cf4f5bbab7e27b80f239380d07762c19df 100644 (file)
@@ -1049,6 +1049,26 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr
         r"""
         Override the parent method with something that tries to compute
         over a faster (non-extension) field.
+
+        SETUP::
+
+            sage: from mjo.eja.eja_algebra import JordanSpinEJA
+
+        EXAMPLES:
+
+        The base ring of the resulting polynomial coefficients is what
+        it should be, and not the rationals (unless the algebra was
+        already over the rationals)::
+
+            sage: J = JordanSpinEJA(3)
+            sage: J._charpoly_coefficients()
+            (X1^2 - X2^2 - X3^2, -2*X1)
+            sage: a0 = J._charpoly_coefficients()[0]
+            sage: J.base_ring()
+            Algebraic Real Field
+            sage: a0.base_ring()
+            Algebraic Real Field
+
         """
         if self.base_ring() is QQ:
             # There's no need to construct *another* algebra over the
@@ -1068,7 +1088,8 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr
                                                     mult_table,
                                                     check_field=False,
                                                     check_axioms=False)
-        return J._charpoly_coefficients()
+        a = J._charpoly_coefficients()
+        return tuple(map(lambda x: x.change_ring(self.base_ring()), a))
 
 
 class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra):