From f98ab4d7afa92a853e7ddc75cdac803d2da4fcb9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 1 Mar 2021 10:39:50 -0500 Subject: [PATCH] eja: use "b" as the default prefix. --- mjo/eja/eja_algebra.py | 116 +++++++++++++++++++------------------- mjo/eja/eja_element.py | 30 +++++----- mjo/eja/eja_operator.py | 4 +- mjo/eja/eja_subalgebra.py | 28 ++++----- 4 files changed, 89 insertions(+), 89 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index da008d0..c55061e 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -141,7 +141,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): cartesian_product=False, check_field=True, check_axioms=True, - prefix='e'): + prefix="b"): n = len(basis) @@ -210,7 +210,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): # ambient vector space V that our (vectorized) basis lives in, # as well as a subspace W of V spanned by those (vectorized) # basis elements. The W-coordinates are the coefficients that - # we see in things like x = 1*e1 + 2*e2. + # we see in things like x = 1*b1 + 2*b2. vector_basis = basis degree = 0 @@ -337,16 +337,16 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: set_random_seed() sage: J = random_eja() sage: n = J.dimension() - sage: ei = J.zero() - sage: ej = J.zero() - sage: ei_ej = J.zero()*J.zero() + sage: bi = J.zero() + sage: bj = J.zero() + sage: bi_bj = J.zero()*J.zero() sage: if n > 0: ....: i = ZZ.random_element(n) ....: j = ZZ.random_element(n) - ....: ei = J.monomial(i) - ....: ej = J.monomial(j) - ....: ei_ej = J.product_on_basis(i,j) - sage: ei*ej == ei_ej + ....: bi = J.monomial(i) + ....: bj = J.monomial(j) + ....: bi_bj = J.product_on_basis(i,j) + sage: bi*bj == bi_bj True """ @@ -618,7 +618,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: J2 = RealSymmetricEJA(2) sage: J = cartesian_product([J1,J2]) sage: J( (J1.matrix_basis()[1], J2.matrix_basis()[2]) ) - e1 + e5 + b1 + b5 TESTS: @@ -893,15 +893,15 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: J = JordanSpinEJA(4) sage: J.multiplication_table() +----++----+----+----+----+ - | * || e0 | e1 | e2 | e3 | + | * || b0 | b1 | b2 | b3 | +====++====+====+====+====+ - | e0 || e0 | e1 | e2 | e3 | + | b0 || b0 | b1 | b2 | b3 | +----++----+----+----+----+ - | e1 || e1 | e0 | 0 | 0 | + | b1 || b1 | b0 | 0 | 0 | +----++----+----+----+----+ - | e2 || e2 | 0 | e0 | 0 | + | b2 || b2 | 0 | b0 | 0 | +----++----+----+----+----+ - | e3 || e3 | 0 | 0 | e0 | + | b3 || b3 | 0 | 0 | b0 | +----++----+----+----+----+ """ @@ -955,7 +955,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: J = RealSymmetricEJA(2) sage: J.basis() - Finite family {0: e0, 1: e1, 2: e2} + Finite family {0: b0, 1: b1, 2: b2} sage: J.matrix_basis() ( [1 0] [ 0 0.7071067811865475?] [0 0] @@ -966,7 +966,7 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: J = JordanSpinEJA(2) sage: J.basis() - Finite family {0: e0, 1: e1} + Finite family {0: b0, 1: b1} sage: J.matrix_basis() ( [1] [0] @@ -1048,20 +1048,20 @@ class FiniteDimensionalEJA(CombinatorialFreeModule): sage: J = HadamardEJA(5) sage: J.one() - e0 + e1 + e2 + e3 + e4 + b0 + b1 + b2 + b3 + b4 The unit element in the Hadamard EJA is inherited in the subalgebras generated by its elements:: sage: J = HadamardEJA(5) sage: J.one() - e0 + e1 + e2 + e3 + e4 + b0 + b1 + b2 + b3 + b4 sage: x = sum(J.gens()) sage: A = x.subalgebra_generated_by(orthonormalize=False) sage: A.one() - f0 + c0 sage: A.one().superalgebra_element() - e0 + e1 + e2 + e3 + e4 + b0 + b1 + b2 + b3 + b4 TESTS: @@ -1864,13 +1864,13 @@ class RealSymmetricEJA(ConcreteEJA, RealMatrixEJA): EXAMPLES:: sage: J = RealSymmetricEJA(2) - sage: e0, e1, e2 = J.gens() - sage: e0*e0 - e0 - sage: e1*e1 - 1/2*e0 + 1/2*e2 - sage: e2*e2 - e2 + sage: b0, b1, b2 = J.gens() + sage: b0*b0 + b0 + sage: b1*b1 + 1/2*b0 + 1/2*b2 + sage: b2*b2 + b2 In theory, our "field" can be any subfield of the reals:: @@ -2621,19 +2621,19 @@ class HadamardEJA(ConcreteEJA): This multiplication table can be verified by hand:: sage: J = HadamardEJA(3) - sage: e0,e1,e2 = J.gens() - sage: e0*e0 - e0 - sage: e0*e1 + sage: b0,b1,b2 = J.gens() + sage: b0*b0 + b0 + sage: b0*b1 0 - sage: e0*e2 + sage: b0*b2 0 - sage: e1*e1 - e1 - sage: e1*e2 + sage: b1*b1 + b1 + sage: b1*b2 0 - sage: e2*e2 - e2 + sage: b2*b2 + b2 TESTS: @@ -2874,20 +2874,20 @@ class JordanSpinEJA(BilinearFormEJA): This multiplication table can be verified by hand:: sage: J = JordanSpinEJA(4) - sage: e0,e1,e2,e3 = J.gens() - sage: e0*e0 - e0 - sage: e0*e1 - e1 - sage: e0*e2 - e2 - sage: e0*e3 - e3 - sage: e1*e2 + sage: b0,b1,b2,b3 = J.gens() + sage: b0*b0 + b0 + sage: b0*b1 + b1 + sage: b0*b2 + b2 + sage: b0*b3 + b3 + sage: b1*b2 0 - sage: e1*e3 + sage: b1*b3 0 - sage: e2*e3 + sage: b2*b3 0 We can change the generator prefix:: @@ -3099,23 +3099,23 @@ class CartesianProductEJA(FiniteDimensionalEJA): sage: J = cartesian_product([J1,cartesian_product([J2,J3])]) sage: J.multiplication_table() +----++----+----+----+ - | * || e0 | e1 | e2 | + | * || b0 | b1 | b2 | +====++====+====+====+ - | e0 || e0 | 0 | 0 | + | b0 || b0 | 0 | 0 | +----++----+----+----+ - | e1 || 0 | e1 | 0 | + | b1 || 0 | b1 | 0 | +----++----+----+----+ - | e2 || 0 | 0 | e2 | + | b2 || 0 | 0 | b2 | +----++----+----+----+ sage: HadamardEJA(3).multiplication_table() +----++----+----+----+ - | * || e0 | e1 | e2 | + | * || b0 | b1 | b2 | +====++====+====+====+ - | e0 || e0 | 0 | 0 | + | b0 || b0 | 0 | 0 | +----++----+----+----+ - | e1 || 0 | e1 | 0 | + | b1 || 0 | b1 | 0 | +----++----+----+----+ - | e2 || 0 | 0 | e2 | + | b2 || 0 | 0 | b2 | +----++----+----+----+ TESTS: diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 52933e2..ff25b82 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -167,8 +167,8 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): sage: J = HadamardEJA(3) sage: p1 = J.one().characteristic_polynomial() sage: q1 = J.zero().characteristic_polynomial() - sage: e0,e1,e2 = J.gens() - sage: A = (e0 + 2*e1 + 3*e2).subalgebra_generated_by() # dim 3 + sage: b0,b1,b2 = J.gens() + sage: A = (b0 + 2*b1 + 3*b2).subalgebra_generated_by() # dim 3 sage: p2 = A.one().characteristic_polynomial() sage: q2 = A.zero().characteristic_polynomial() sage: p1 == p2 @@ -348,7 +348,6 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): EXAMPLES:: sage: J = JordanSpinEJA(2) - sage: e0,e1 = J.gens() sage: x = sum( J.gens() ) sage: x.det() 0 @@ -356,7 +355,6 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): :: sage: J = JordanSpinEJA(3) - sage: e0,e1,e2 = J.gens() sage: x = sum( J.gens() ) sage: x.det() -1 @@ -793,7 +791,9 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): sage: J = JordanSpinEJA(5) sage: J.one().is_regular() False - sage: e0, e1, e2, e3, e4 = J.gens() # e0 is the identity + sage: b0, b1, b2, b3, b4 = J.gens() + sage: b0 == J.one() + True sage: for x in J.gens(): ....: (J.one() + x).is_regular() False @@ -843,8 +843,8 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): sage: J = JordanSpinEJA(4) sage: J.one().degree() 1 - sage: e0,e1,e2,e3 = J.gens() - sage: (e0 - e1).degree() + sage: b0,b1,b2,b3 = J.gens() + sage: (b0 - b1).degree() 2 In the spin factor algebra (of rank two), all elements that @@ -1096,7 +1096,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): sage: J = ComplexHermitianEJA(3) sage: J.one() - e0 + e3 + e8 + b0 + b3 + b8 sage: J.one().to_matrix() [1 0 0 0 0 0] [0 1 0 0 0 0] @@ -1109,7 +1109,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): sage: J = QuaternionHermitianEJA(2) sage: J.one() - e0 + e5 + b0 + b5 sage: J.one().to_matrix() [1 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0] @@ -1355,11 +1355,11 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): sage: J = RealSymmetricEJA(3) sage: J.one() - e0 + e2 + e5 + b0 + b2 + b5 sage: J.one().spectral_decomposition() - [(1, e0 + e2 + e5)] + [(1, b0 + b2 + b5)] sage: J.zero().spectral_decomposition() - [(0, e0 + e2 + e5)] + [(0, b0 + b2 + b5)] TESTS:: @@ -1384,13 +1384,13 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): The spectral decomposition should work in subalgebras, too:: sage: J = RealSymmetricEJA(4) - sage: (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) = J.gens() - sage: A = 2*e5 - 2*e8 + sage: (b0, b1, b2, b3, b4, b5, b6, b7, b8, b9) = J.gens() + sage: A = 2*b5 - 2*b8 sage: (lambda1, c1) = A.spectral_decomposition()[1] sage: (J0, J5, J1) = J.peirce_decomposition(c1) sage: (f0, f1, f2) = J1.gens() sage: f0.spectral_decomposition() - [(0, f2), (1, f0)] + [(0, c2), (1, c0)] """ A = self.subalgebra_generated_by(orthonormalize=True) diff --git a/mjo/eja/eja_operator.py b/mjo/eja/eja_operator.py index 4d24b35..7100ea6 100644 --- a/mjo/eja/eja_operator.py +++ b/mjo/eja/eja_operator.py @@ -239,8 +239,8 @@ class FiniteDimensionalEJAOperator(Map): We can scale an operator on a rational algebra by a rational number:: sage: J = RealSymmetricEJA(2) - sage: e0,e1,e2 = J.gens() - sage: x = 2*e0 + 4*e1 + 16*e2 + sage: b0,b1,b2 = J.gens() + sage: x = 2*b0 + 4*b1 + 16*b2 sage: x.operator() Linear operator between finite-dimensional Euclidean Jordan algebras represented by the matrix: diff --git a/mjo/eja/eja_subalgebra.py b/mjo/eja/eja_subalgebra.py index 92fd296..1b86d23 100644 --- a/mjo/eja/eja_subalgebra.py +++ b/mjo/eja/eja_subalgebra.py @@ -51,20 +51,20 @@ class FiniteDimensionalEJASubalgebraElement(FiniteDimensionalEJAElement): sage: J = RealSymmetricEJA(3) sage: x = sum(J.gens()) sage: x - e0 + e1 + e2 + e3 + e4 + e5 + b0 + b1 + b2 + b3 + b4 + b5 sage: A = x.subalgebra_generated_by(orthonormalize=False) sage: A(x) - f1 + c1 sage: A(x).superalgebra_element() - e0 + e1 + e2 + e3 + e4 + e5 + b0 + b1 + b2 + b3 + b4 + b5 sage: y = sum(A.gens()) sage: y - f0 + f1 + c0 + c1 sage: B = y.subalgebra_generated_by(orthonormalize=False) sage: B(y) - g1 + d1 sage: B(y).superalgebra_element() - f0 + f1 + c0 + c1 TESTS: @@ -121,17 +121,18 @@ class FiniteDimensionalEJASubalgebra(FiniteDimensionalEJA): TESTS: - Ensure that our generator names don't conflict with the superalgebra:: + Ensure that our generator names don't conflict with the + superalgebra:: sage: J = JordanSpinEJA(3) sage: J.one().subalgebra_generated_by().gens() - (f0,) + (c0,) sage: J = JordanSpinEJA(3, prefix='f') sage: J.one().subalgebra_generated_by().gens() (g0,) - sage: J = JordanSpinEJA(3, prefix='b') + sage: J = JordanSpinEJA(3, prefix='a') sage: J.one().subalgebra_generated_by().gens() - (c0,) + (b0,) Ensure that we can find subalgebras of subalgebras:: @@ -139,7 +140,6 @@ class FiniteDimensionalEJASubalgebra(FiniteDimensionalEJA): sage: B = A.one().subalgebra_generated_by() sage: B.dimension() 1 - """ def __init__(self, superalgebra, basis, **kwargs): self._superalgebra = superalgebra @@ -152,7 +152,7 @@ class FiniteDimensionalEJASubalgebra(FiniteDimensionalEJA): # try to "increment" the parent algebra's prefix, although # this idea goes out the window fast because some prefixen # are off-limits. - prefixen = [ 'f', 'g', 'h', 'a', 'b', 'c', 'd' ] + prefixen = ["b","c","d","e","f","g","h","l","m"] try: prefix = prefixen[prefixen.index(self._superalgebra.prefix()) + 1] except ValueError: @@ -200,9 +200,9 @@ class FiniteDimensionalEJASubalgebra(FiniteDimensionalEJA): ....: associative=True, ....: orthonormalize=False) sage: K(J.one()) - f1 + c1 sage: K(J.one() + x) - f0 + f1 + c0 + c1 :: -- 2.44.2