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
27 def __init__(self
, A
, elt
):
31 sage: from mjo.eja.eja_algebra import RealSymmetricEJA
32 sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanElementSubalgebra
36 sage: J = RealSymmetricEJA(3)
37 sage: x = sum( i*J.gens()[i] for i in range(6) )
38 sage: K = FiniteDimensionalEuclideanJordanElementSubalgebra(x)
39 sage: [ K.element_class(K,x^k) for k in range(J.rank()) ]
45 if elt
in A
.superalgebra():
46 # Try to convert a parent algebra element into a
47 # subalgebra element...
49 coords
= A
.vector_space().coordinate_vector(elt
.to_vector())
50 elt
= A
.from_vector(coords
).monomial_coefficients()
51 except AttributeError:
52 # Catches a missing method in elt.to_vector()
55 s
= super(FiniteDimensionalEuclideanJordanElementSubalgebraElement
,
61 def superalgebra_element(self
):
63 Return the object in our algebra's superalgebra that corresponds
68 sage: from mjo.eja.eja_algebra import (RealSymmetricEJA,
73 sage: J = RealSymmetricEJA(3)
74 sage: x = sum(J.gens())
76 e0 + e1 + e2 + e3 + e4 + e5
77 sage: A = x.subalgebra_generated_by()
78 sage: A.element_class(A,x)
80 sage: A.element_class(A,x).superalgebra_element()
81 e0 + e1 + e2 + e3 + e4 + e5
85 We can convert back and forth faithfully::
87 sage: set_random_seed()
88 sage: J = random_eja()
89 sage: x = J.random_element()
90 sage: A = x.subalgebra_generated_by()
91 sage: A.element_class(A,x).superalgebra_element() == x
93 sage: y = A.random_element()
94 sage: A.element_class(A,y.superalgebra_element()) == y
98 return self
.parent().superalgebra().linear_combination(
99 zip(self
.parent()._superalgebra
_basis
, self
.to_vector()) )
104 class FiniteDimensionalEuclideanJordanElementSubalgebra(FiniteDimensionalEuclideanJordanAlgebra
):
106 The subalgebra of an EJA generated by a single element.
108 def __init__(self
, elt
):
109 superalgebra
= elt
.parent()
111 # First compute the vector subspace spanned by the powers of
113 V
= superalgebra
.vector_space()
114 superalgebra_basis
= [superalgebra
.one()]
115 basis_vectors
= [superalgebra
.one().to_vector()]
116 W
= V
.span_of_basis(basis_vectors
)
117 for exponent
in range(1, V
.dimension()):
118 new_power
= elt
**exponent
119 basis_vectors
.append( new_power
.to_vector() )
121 W
= V
.span_of_basis(basis_vectors
)
122 superalgebra_basis
.append( new_power
)
124 # Vectors weren't independent; bail and keep the
125 # last subspace that worked.
128 # Make the basis hashable for UniqueRepresentation.
129 superalgebra_basis
= tuple(superalgebra_basis
)
131 # Now figure out the entries of the right-multiplication
132 # matrix for the successive basis elements b0, b1,... of
134 field
= superalgebra
.base_ring()
136 for b_right
in superalgebra_basis
:
138 # The first row of the right-multiplication matrix by
139 # b1 is what we get if we apply that matrix to b1. The
140 # second row of the right multiplication matrix by b1
141 # is what we get when we apply that matrix to b2...
143 # IMPORTANT: this assumes that all vectors are COLUMN
144 # vectors, unlike our superclass (which uses row vectors).
145 for b_left
in superalgebra_basis
:
146 # Multiply in the original EJA, but then get the
147 # coordinates from the subalgebra in terms of its
149 this_row
= W
.coordinates((b_left
*b_right
).to_vector())
150 b_right_rows
.append(this_row
)
151 b_right_matrix
= matrix(field
, b_right_rows
)
152 mult_table
.append(b_right_matrix
)
156 mult_table
= tuple(mult_table
)
158 # TODO: We'll have to redo this and make it unique again...
161 # The rank is the highest possible degree of a minimal
162 # polynomial, and is bounded above by the dimension. We know
163 # in this case that there's an element whose minimal
164 # polynomial has the same degree as the space's dimension
165 # (remember how we constructed the space?), so that must be
169 category
= superalgebra
.category().Associative()
170 natural_basis
= tuple( b
.natural_representation()
171 for b
in superalgebra_basis
)
173 self
._superalgebra
= superalgebra
174 self
._vector
_space
= W
175 self
._superalgebra
_basis
= superalgebra_basis
178 fdeja
= super(FiniteDimensionalEuclideanJordanElementSubalgebra
, self
)
179 return fdeja
.__init
__(field
,
184 natural_basis
=natural_basis
)
188 def superalgebra(self
):
190 Return the superalgebra that this algebra was generated from.
192 return self
._superalgebra
195 def vector_space(self
):
199 sage: from mjo.eja.eja_algebra import RealSymmetricEJA
200 sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanElementSubalgebra
204 sage: J = RealSymmetricEJA(3)
205 sage: x = sum( i*J.gens()[i] for i in range(6) )
206 sage: K = FiniteDimensionalEuclideanJordanElementSubalgebra(x)
207 sage: K.vector_space()
208 Vector space of degree 6 and dimension 3 over Rational Field
213 sage: (x^0).to_vector()
215 sage: (x^1).to_vector()
217 sage: (x^2).to_vector()
218 (5, 11, 14, 26, 34, 45)
221 return self
._vector
_space
224 Element
= FiniteDimensionalEuclideanJordanElementSubalgebraElement