]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: add a test for the inverse via charpoly.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 13 Oct 2019 00:15:09 +0000 (20:15 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 13 Oct 2019 00:15:09 +0000 (20:15 -0400)
mjo/eja/eja_element.py

index eee8f69bd76ddfba49e3cb4531f55d0e970ebd1d..e7dff7529026cf007056a5ecd66a8f9fba98562a 100644 (file)
@@ -407,7 +407,8 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
 
         SETUP::
 
-            sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+            sage: from mjo.eja.eja_algebra import (ComplexHermitianEJA,
+            ....:                                  JordanSpinEJA,
             ....:                                  random_eja)
 
         EXAMPLES:
@@ -473,6 +474,22 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
             ....:    x.operator().inverse()(J.one()) == x.inverse() )
             True
 
+        Proposition II.2.4 in Faraut and Korányi gives a formula for
+        the inverse based on the characteristic polynomial and the
+        Cayley-Hamilton theorem for Euclidean Jordan algebras::
+
+            sage: set_random_seed()
+            sage: J = ComplexHermitianEJA(3)
+            sage: x = J.random_element()
+            sage: while not x.is_invertible():
+            ....:     x = J.random_element()
+            sage: r = J.rank()
+            sage: a = x.characteristic_polynomial().coefficients(sparse=False)
+            sage: expected  = (-1)^(r+1)/x.det()
+            sage: expected *= sum( a[i+1]*x^i for i in range(r) )
+            sage: x.inverse() == expected
+            True
+
         """
         if not self.is_invertible():
             raise ValueError("element is not invertible")