From: Michael Orlitzky Date: Thu, 18 Jul 2019 21:15:56 +0000 (-0400) Subject: eja: define operator_matrix() to eventually replace matrix(). X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=6ca4fb6c40e9e8f65eec8cafd0044992fae79f02;p=sage.d.git eja: define operator_matrix() to eventually replace matrix(). --- diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index 4713ff0..c0b7787 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -112,7 +112,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): sage: set_random_seed() sage: x = random_eja().random_element() - sage: x.matrix()*x.vector() == (x^2).vector() + sage: x.operator_matrix()*x.vector() == (x^2).vector() True A few examples of power-associativity:: @@ -131,8 +131,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): sage: x = random_eja().random_element() sage: m = ZZ.random_element(0,10) sage: n = ZZ.random_element(0,10) - sage: Lxm = (x^m).matrix() - sage: Lxn = (x^n).matrix() + sage: Lxm = (x^m).operator_matrix() + sage: Lxn = (x^n).operator_matrix() sage: Lxm*Lxn == Lxn*Lxm True @@ -143,7 +143,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): elif n == 1: return self else: - return A.element_class(A, (self.matrix()**(n-1))*self.vector()) + return A( (self.operator_matrix()**(n-1))*self.vector() ) def characteristic_polynomial(self): @@ -193,8 +193,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): if not other in self.parent(): raise ArgumentError("'other' must live in the same algebra") - A = self.matrix() - B = other.matrix() + A = self.operator_matrix() + B = other.operator_matrix() return (A*B == B*A) @@ -432,10 +432,10 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): 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: Lx = x.operator_matrix() + sage: Ly = y.operator_matrix() + sage: Lxx = (x*x).operator_matrix() + sage: Lxy = (x*y).operator_matrix() sage: bool(2*Lx*Lxy + Ly*Lxx == 2*Lxy*Lx + Lxx*Ly) True @@ -447,12 +447,12 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): 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: Lx = x.operator_matrix() + sage: Ly = y.operator_matrix() + sage: Lz = z.operator_matrix() + sage: Lzy = (z*y).operator_matrix() + sage: Lxy = (x*y).operator_matrix() + sage: Lxz = (x*z).operator_matrix() sage: bool(Lx*Lzy + Lz*Lxy + Ly*Lxz == Lzy*Lx + Lxy*Lz + Lxz*Ly) True @@ -464,13 +464,13 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): 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: Lu = u.operator_matrix() + sage: Ly = y.operator_matrix() + sage: Lz = z.operator_matrix() + sage: Lzy = (z*y).operator_matrix() + sage: Luy = (u*y).operator_matrix() + sage: Luz = (u*z).operator_matrix() + sage: Luyz = (u*(y*z)).operator_matrix() sage: lhs = Lu*Lzy + Lz*Luy + Ly*Luz sage: rhs = Luyz + Ly*Lu*Lz + Lz*Lu*Ly sage: bool(lhs == rhs) @@ -480,6 +480,14 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): fda_elt = FiniteDimensionalAlgebraElement(self.parent(), self) return fda_elt.matrix().transpose() + # + # The plan is to eventually phase out "matrix()", which sounds + # too much like "matrix_representation()", in favor of the more- + # accurate "operator_matrix()". But we need to override matrix() + # to keep parent class methods happy in the meantime. + # + operator_matrix = matrix + def minimal_polynomial(self): """ @@ -610,9 +618,9 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): 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() ) + L = self.operator_matrix() + M = other.operator_matrix() + return ( L*M + M*L - (self*other).operator_matrix() ) def span_of_powers(self): @@ -645,7 +653,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): sage: set_random_seed() sage: x = random_eja().random_element() sage: u = x.subalgebra_generated_by().random_element() - sage: u.matrix()*u.vector() == (u**2).vector() + sage: u.operator_matrix()*u.vector() == (u**2).vector() True """ @@ -717,7 +725,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): s = 0 minimal_dim = V.dimension() for i in xrange(1, V.dimension()): - this_dim = (u**i).matrix().image().dimension() + this_dim = (u**i).operator_matrix().image().dimension() if this_dim < minimal_dim: minimal_dim = this_dim s = i @@ -734,7 +742,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): # Beware, solve_right() means that we're using COLUMN vectors. # Our FiniteDimensionalAlgebraElement superclass uses rows. u_next = u**(s+1) - A = u_next.matrix() + A = u_next.operator_matrix() c_coordinates = A.solve_right(u_next.vector()) # Now c_coordinates is the idempotent we want, but it's in