]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/euclidean_jordan_algebra.py
eja: finally enable tests for the trace inner product.
[sage.d.git] / mjo / eja / euclidean_jordan_algebra.py
index 74c0bf1cb11e38460f39aef4920fa70f60d02409..c37ace0b2bbf1ce19f20e3127a4a5c80b7191b4e 100644 (file)
@@ -1233,6 +1233,47 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
         def trace_inner_product(self, other):
             """
             Return the trace inner product of myself and ``other``.
+
+            TESTS:
+
+            The trace inner product is commutative::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: x = J.random_element(); y = J.random_element()
+                sage: x.trace_inner_product(y) == y.trace_inner_product(x)
+                True
+
+            The trace inner product is bilinear::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: x = J.random_element()
+                sage: y = J.random_element()
+                sage: z = J.random_element()
+                sage: a = QQ.random_element();
+                sage: actual = (a*(x+z)).trace_inner_product(y)
+                sage: expected = ( a*x.trace_inner_product(y) +
+                ....:              a*z.trace_inner_product(y) )
+                sage: actual == expected
+                True
+                sage: actual = x.trace_inner_product(a*(y+z))
+                sage: expected = ( a*x.trace_inner_product(y) +
+                ....:              a*x.trace_inner_product(z) )
+                sage: actual == expected
+                True
+
+            The trace inner product satisfies the compatibility
+            condition in the definition of a Euclidean Jordan algebra::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: x = J.random_element()
+                sage: y = J.random_element()
+                sage: z = J.random_element()
+                sage: (x*y).trace_inner_product(z) == y.trace_inner_product(x*z)
+                True
+
             """
             if not other in self.parent():
                 raise TypeError("'other' must live in the same algebra")