1 from sage
.matrix
.constructor
import matrix
3 from mjo
.eja
.eja_algebra
import FiniteDimensionalEuclideanJordanAlgebra
4 from mjo
.eja
.eja_element
import FiniteDimensionalEuclideanJordanAlgebraElement
6 class FiniteDimensionalEuclideanJordanSubalgebraElement(FiniteDimensionalEuclideanJordanAlgebraElement
):
10 sage: from mjo.eja.eja_algebra import random_eja
14 The natural representation of an element in the subalgebra is
15 the same as its natural representation in the superalgebra::
17 sage: set_random_seed()
18 sage: A = random_eja().random_element().subalgebra_generated_by()
19 sage: y = A.random_element()
20 sage: actual = y.natural_representation()
21 sage: expected = y.superalgebra_element().natural_representation()
22 sage: actual == expected
25 The left-multiplication-by operator for elements in the subalgebra
26 works like it does in the superalgebra, even if we orthonormalize
29 sage: set_random_seed()
30 sage: x = random_eja(AA).random_element()
31 sage: A = x.subalgebra_generated_by(orthonormalize_basis=True)
32 sage: y = A.random_element()
33 sage: y.operator()(A.one()) == y
38 def superalgebra_element(self
):
40 Return the object in our algebra's superalgebra that corresponds
45 sage: from mjo.eja.eja_algebra import (RealSymmetricEJA,
50 sage: J = RealSymmetricEJA(3)
51 sage: x = sum(J.gens())
53 e0 + e1 + e2 + e3 + e4 + e5
54 sage: A = x.subalgebra_generated_by()
57 sage: A(x).superalgebra_element()
58 e0 + e1 + e2 + e3 + e4 + e5
62 We can convert back and forth faithfully::
64 sage: set_random_seed()
65 sage: J = random_eja()
66 sage: x = J.random_element()
67 sage: A = x.subalgebra_generated_by()
68 sage: A(x).superalgebra_element() == x
70 sage: y = A.random_element()
71 sage: A(y.superalgebra_element()) == y
75 return self
.parent().superalgebra().linear_combination(
76 zip(self
.parent()._superalgebra
_basis
, self
.to_vector()) )
81 class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJordanAlgebra
):
83 A subalgebra of an EJA with a given basis.
87 sage: from mjo.eja.eja_algebra import (ComplexHermitianEJA,
89 ....: RealSymmetricEJA)
90 sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanSubalgebra
94 The following Peirce subalgebras of the 2-by-2 real symmetric
95 matrices do not contain the superalgebra's identity element::
97 sage: J = RealSymmetricEJA(2)
98 sage: E11 = matrix(QQ, [ [1,0],
100 sage: E22 = matrix(QQ, [ [0,0],
102 sage: K1 = FiniteDimensionalEuclideanJordanSubalgebra(J, (J(E11),))
103 sage: K1.one().natural_representation()
106 sage: K2 = FiniteDimensionalEuclideanJordanSubalgebra(J, (J(E22),))
107 sage: K2.one().natural_representation()
113 Ensure that our generator names don't conflict with the superalgebra::
115 sage: J = JordanSpinEJA(3)
116 sage: J.one().subalgebra_generated_by().gens()
118 sage: J = JordanSpinEJA(3, prefix='f')
119 sage: J.one().subalgebra_generated_by().gens()
121 sage: J = JordanSpinEJA(3, prefix='b')
122 sage: J.one().subalgebra_generated_by().gens()
125 Ensure that we can find subalgebras of subalgebras::
127 sage: A = ComplexHermitianEJA(3).one().subalgebra_generated_by()
128 sage: B = A.one().subalgebra_generated_by()
133 def __init__(self
, superalgebra
, basis
, rank
=None, category
=None):
134 self
._superalgebra
= superalgebra
135 V
= self
._superalgebra
.vector_space()
136 field
= self
._superalgebra
.base_ring()
138 category
= self
._superalgebra
.category()
140 # A half-assed attempt to ensure that we don't collide with
141 # the superalgebra's prefix (ignoring the fact that there
142 # could be super-superelgrbas in scope). If possible, we
143 # try to "increment" the parent algebra's prefix, although
144 # this idea goes out the window fast because some prefixen
146 prefixen
= [ 'f', 'g', 'h', 'a', 'b', 'c', 'd' ]
148 prefix
= prefixen
[prefixen
.index(self
._superalgebra
.prefix()) + 1]
152 basis_vectors
= [ b
.to_vector() for b
in basis
]
153 superalgebra_basis
= [ self
._superalgebra
.from_vector(b
)
154 for b
in basis_vectors
]
156 W
= V
.span_of_basis( V
.from_vector(v
) for v
in basis_vectors
)
157 n
= len(superalgebra_basis
)
158 mult_table
= [[W
.zero() for i
in range(n
)] for j
in range(n
)]
161 product
= superalgebra_basis
[i
]*superalgebra_basis
[j
]
162 # product.to_vector() might live in a vector subspace
163 # if our parent algebra is already a subalgebra. We
164 # use V.from_vector() to make it "the right size" in
166 product_vector
= V
.from_vector(product
.to_vector())
167 mult_table
[i
][j
] = W
.coordinate_vector(product_vector
)
169 natural_basis
= tuple( b
.natural_representation()
170 for b
in superalgebra_basis
)
173 self
._vector
_space
= W
174 self
._superalgebra
_basis
= superalgebra_basis
177 fdeja
= super(FiniteDimensionalEuclideanJordanSubalgebra
, self
)
178 return fdeja
.__init
__(field
,
183 natural_basis
=natural_basis
)
187 def _element_constructor_(self
, elt
):
189 Construct an element of this subalgebra from the given one.
190 The only valid arguments are elements of the parent algebra
191 that happen to live in this subalgebra.
195 sage: from mjo.eja.eja_algebra import RealSymmetricEJA
196 sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanSubalgebra
200 sage: J = RealSymmetricEJA(3)
201 sage: X = matrix(QQ, [ [0,0,1],
205 sage: basis = ( x, x^2 ) # x^2 is the identity matrix
206 sage: K = FiniteDimensionalEuclideanJordanSubalgebra(J, basis)
215 if elt
not in self
.superalgebra():
216 raise ValueError("not an element of this subalgebra")
218 coords
= self
.vector_space().coordinate_vector(elt
.to_vector())
219 return self
.from_vector(coords
)
223 def natural_basis_space(self
):
225 Return the natural basis space of this algebra, which is identical
226 to that of its superalgebra.
228 This is correct "by definition," and avoids a mismatch when the
229 subalgebra is trivial (with no natural basis to infer anything
230 from) and the parent is not.
232 return self
.superalgebra().natural_basis_space()
235 def superalgebra(self
):
237 Return the superalgebra that this algebra was generated from.
239 return self
._superalgebra
242 def vector_space(self
):
246 sage: from mjo.eja.eja_algebra import RealSymmetricEJA
247 sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanSubalgebra
251 sage: J = RealSymmetricEJA(3)
252 sage: E11 = matrix(QQ, [ [1,0,0],
255 sage: E22 = matrix(QQ, [ [0,0,0],
260 sage: basis = (b1, b2)
261 sage: K = FiniteDimensionalEuclideanJordanSubalgebra(J,basis)
262 sage: K.vector_space()
263 Vector space of degree 6 and dimension 2 over...
273 return self
._vector
_space
276 Element
= FiniteDimensionalEuclideanJordanSubalgebraElement