1 from sage
.matrix
.constructor
import matrix
3 from mjo
.eja
.eja_algebra
import FiniteDimensionalEuclideanJordanAlgebra
4 from mjo
.eja
.eja_element
import FiniteDimensionalEuclideanJordanAlgebraElement
7 class FiniteDimensionalEuclideanJordanElementSubalgebraElement(FiniteDimensionalEuclideanJordanAlgebraElement
):
11 sage: from mjo.eja.eja_algebra import random_eja
15 The natural representation of an element in the subalgebra is
16 the same as its natural representation in the superalgebra::
18 sage: set_random_seed()
19 sage: A = random_eja().random_element().subalgebra_generated_by()
20 sage: y = A.random_element()
21 sage: actual = y.natural_representation()
22 sage: expected = y.superalgebra_element().natural_representation()
23 sage: actual == expected
28 def superalgebra_element(self
):
30 Return the object in our algebra's superalgebra that corresponds
35 sage: from mjo.eja.eja_algebra import (RealSymmetricEJA,
40 sage: J = RealSymmetricEJA(3)
41 sage: x = sum(J.gens())
43 e0 + e1 + e2 + e3 + e4 + e5
44 sage: A = x.subalgebra_generated_by()
47 sage: A(x).superalgebra_element()
48 e0 + e1 + e2 + e3 + e4 + e5
52 We can convert back and forth faithfully::
54 sage: set_random_seed()
55 sage: J = random_eja()
56 sage: x = J.random_element()
57 sage: A = x.subalgebra_generated_by()
58 sage: A(x).superalgebra_element() == x
60 sage: y = A.random_element()
61 sage: A(y.superalgebra_element()) == y
65 return self
.parent().superalgebra().linear_combination(
66 zip(self
.parent()._superalgebra
_basis
, self
.to_vector()) )
71 class FiniteDimensionalEuclideanJordanElementSubalgebra(FiniteDimensionalEuclideanJordanAlgebra
):
73 The subalgebra of an EJA generated by a single element.
75 def __init__(self
, elt
):
76 superalgebra
= elt
.parent()
78 # First compute the vector subspace spanned by the powers of
80 V
= superalgebra
.vector_space()
81 superalgebra_basis
= [superalgebra
.one()]
82 basis_vectors
= [superalgebra
.one().to_vector()]
83 W
= V
.span_of_basis(basis_vectors
)
84 for exponent
in range(1, V
.dimension()):
85 new_power
= elt
**exponent
86 basis_vectors
.append( new_power
.to_vector() )
88 W
= V
.span_of_basis(basis_vectors
)
89 superalgebra_basis
.append( new_power
)
91 # Vectors weren't independent; bail and keep the
92 # last subspace that worked.
95 # Make the basis hashable for UniqueRepresentation.
96 superalgebra_basis
= tuple(superalgebra_basis
)
98 # Now figure out the entries of the right-multiplication
99 # matrix for the successive basis elements b0, b1,... of
101 field
= superalgebra
.base_ring()
103 for b_right
in superalgebra_basis
:
105 # The first row of the right-multiplication matrix by
106 # b1 is what we get if we apply that matrix to b1. The
107 # second row of the right multiplication matrix by b1
108 # is what we get when we apply that matrix to b2...
110 # IMPORTANT: this assumes that all vectors are COLUMN
111 # vectors, unlike our superclass (which uses row vectors).
112 for b_left
in superalgebra_basis
:
113 # Multiply in the original EJA, but then get the
114 # coordinates from the subalgebra in terms of its
116 this_row
= W
.coordinates((b_left
*b_right
).to_vector())
117 b_right_rows
.append(this_row
)
118 b_right_matrix
= matrix(field
, b_right_rows
)
119 mult_table
.append(b_right_matrix
)
123 mult_table
= tuple(mult_table
)
125 # TODO: We'll have to redo this and make it unique again...
128 # The rank is the highest possible degree of a minimal
129 # polynomial, and is bounded above by the dimension. We know
130 # in this case that there's an element whose minimal
131 # polynomial has the same degree as the space's dimension
132 # (remember how we constructed the space?), so that must be
136 category
= superalgebra
.category().Associative()
137 natural_basis
= tuple( b
.natural_representation()
138 for b
in superalgebra_basis
)
140 self
._superalgebra
= superalgebra
141 self
._vector
_space
= W
142 self
._superalgebra
_basis
= superalgebra_basis
145 fdeja
= super(FiniteDimensionalEuclideanJordanElementSubalgebra
, self
)
146 return fdeja
.__init
__(field
,
151 natural_basis
=natural_basis
)
154 def _element_constructor_(self
, elt
):
156 Construct an element of this subalgebra from the given one.
157 The only valid arguments are elements of the parent algebra
158 that happen to live in this subalgebra.
162 sage: from mjo.eja.eja_algebra import RealSymmetricEJA
163 sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanElementSubalgebra
167 sage: J = RealSymmetricEJA(3)
168 sage: x = sum( i*J.gens()[i] for i in range(6) )
169 sage: K = FiniteDimensionalEuclideanJordanElementSubalgebra(x)
170 sage: [ K(x^k) for k in range(J.rank()) ]
176 if elt
in self
.superalgebra():
177 coords
= self
.vector_space().coordinate_vector(elt
.to_vector())
178 return self
.from_vector(coords
)
181 def superalgebra(self
):
183 Return the superalgebra that this algebra was generated from.
185 return self
._superalgebra
188 def vector_space(self
):
192 sage: from mjo.eja.eja_algebra import RealSymmetricEJA
193 sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanElementSubalgebra
197 sage: J = RealSymmetricEJA(3)
198 sage: x = sum( i*J.gens()[i] for i in range(6) )
199 sage: K = FiniteDimensionalEuclideanJordanElementSubalgebra(x)
200 sage: K.vector_space()
201 Vector space of degree 6 and dimension 3 over Rational Field
206 sage: (x^0).to_vector()
208 sage: (x^1).to_vector()
210 sage: (x^2).to_vector()
211 (10, 14, 21, 19, 31, 50)
214 return self
._vector
_space
217 Element
= FiniteDimensionalEuclideanJordanElementSubalgebraElement