From: Michael Orlitzky Date: Sat, 6 Jul 2019 17:41:42 +0000 (-0400) Subject: eja: add more quadratic representation tests. X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=80ce7379dd56aee7cc622b7218823137e9848a47;p=sage.d.git eja: add more quadratic representation tests. --- diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index d6235d3..87a0ca0 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -323,7 +323,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): return elt.minimal_polynomial() - def quadratic_representation(self): + def quadratic_representation(self, other=None): """ Return the quadratic representation of this element. @@ -332,6 +332,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): The explicit form in the spin factor algebra is given by Alizadeh's Example 11.12:: + sage: set_random_seed() sage: n = ZZ.random_element(1,10).abs() sage: J = JordanSpinSimpleEJA(n) sage: x = J.random_element() @@ -348,8 +349,55 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): sage: Q == x.quadratic_representation() True + Test all of the properties from Theorem 11.2 in Alizadeh:: + + sage: set_random_seed() + sage: J = random_eja() + sage: x = J.random_element() + sage: y = J.random_element() + + Property 1: + + sage: actual = x.quadratic_representation(y) + sage: expected = ( (x+y).quadratic_representation() + ....: -x.quadratic_representation() + ....: -y.quadratic_representation() ) / 2 + sage: actual == expected + True + + Property 2: + + sage: alpha = QQ.random_element() + sage: actual = (alpha*x).quadratic_representation() + sage: expected = (alpha^2)*x.quadratic_representation() + sage: actual == expected + True + + Property 5: + + sage: Qy = y.quadratic_representation() + sage: actual = J(Qy*x.vector()).quadratic_representation() + sage: expected = Qy*x.quadratic_representation()*Qy + sage: actual == expected + True + + Property 6: + + sage: k = ZZ.random_element(1,10).abs() + sage: actual = (x^k).quadratic_representation() + sage: expected = (x.quadratic_representation())^k + sage: actual == expected + True + """ - return 2*(self.matrix()**2) - (self**2).matrix() + if other is None: + other=self + elif not other in self.parent(): + raise ArgumentError("'other' must live in the same algebra") + + return ( self.matrix()*other.matrix() + + other.matrix()*self.matrix() + - (self*other).matrix() ) def span_of_powers(self):