]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: add polarization-identity and power-associativity tests.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 14 Jul 2019 17:28:47 +0000 (13:28 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 14 Jul 2019 17:28:47 +0000 (13:28 -0400)
mjo/eja/euclidean_jordan_algebra.py

index a1102461714c43e318130052669fb898d218914e..747e198f8922e3d6c195c4c7552829526463d405 100644 (file)
@@ -52,6 +52,19 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
                  assume_associative=False,
                  category=None,
                  rank=None):
+        """
+        EXAMPLES:
+
+        By definition, Jordan multiplication commutes::
+
+            sage: set_random_seed()
+            sage: J = random_eja()
+            sage: x = J.random_element()
+            sage: y = J.random_element()
+            sage: x*y == y*x
+            True
+
+        """
         self._rank = rank
         fda = super(FiniteDimensionalEuclideanJordanAlgebra, self)
         fda.__init__(field,
@@ -95,11 +108,20 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
                 instead of column vectors! We, on the other hand, assume column
                 vectors everywhere.
 
-            EXAMPLES:
+            EXAMPLES::
+
+                sage: set_random_seed()
+                sage: x = random_eja().random_element()
+                sage: x.matrix()*x.vector() == (x^2).vector()
+                True
+
+            A few examples of power-associativity::
 
                 sage: set_random_seed()
                 sage: x = random_eja().random_element()
-                sage: x.matrix()*x.vector() == (x**2).vector()
+                sage: x*(x*x)*(x*x) == x^5
+                True
+                sage: (x*x)*(x*x*x) == x^5
                 True
 
             """
@@ -351,6 +373,60 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
             We have to override this because the superclass method
             returns a matrix that acts on row vectors (that is, on
             the right).
+
+            EXAMPLES:
+
+            Test the first polarization identity from my notes, Koecher Chapter
+            III, or from Baes (2.3)::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: x = J.random_element()
+                sage: y = J.random_element()
+                sage: Lx = x.matrix()
+                sage: Ly = y.matrix()
+                sage: Lxx = (x*x).matrix()
+                sage: Lxy = (x*y).matrix()
+                sage: bool(2*Lx*Lxy + Ly*Lxx == 2*Lxy*Lx + Lxx*Ly)
+                True
+
+            Test the second polarization identity from my notes or from
+            Baes (2.4)::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: x = J.random_element()
+                sage: y = J.random_element()
+                sage: z = J.random_element()
+                sage: Lx = x.matrix()
+                sage: Ly = y.matrix()
+                sage: Lz = z.matrix()
+                sage: Lzy = (z*y).matrix()
+                sage: Lxy = (x*y).matrix()
+                sage: Lxz = (x*z).matrix()
+                sage: bool(Lx*Lzy + Lz*Lxy + Ly*Lxz == Lzy*Lx + Lxy*Lz + Lxz*Ly)
+                True
+
+            Test the third polarization identity from my notes or from
+            Baes (2.5)::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: u = J.random_element()
+                sage: y = J.random_element()
+                sage: z = J.random_element()
+                sage: Lu = u.matrix()
+                sage: Ly = y.matrix()
+                sage: Lz = z.matrix()
+                sage: Lzy = (z*y).matrix()
+                sage: Luy = (u*y).matrix()
+                sage: Luz = (u*z).matrix()
+                sage: Luyz = (u*(y*z)).matrix()
+                sage: lhs = Lu*Lzy + Lz*Luy + Ly*Luz
+                sage: rhs = Luyz + Ly*Lu*Lz + Lz*Lu*Ly
+                sage: bool(lhs == rhs)
+                True
+
             """
             fda_elt = FiniteDimensionalAlgebraElement(self.parent(), self)
             return fda_elt.matrix().transpose()