dir(self.__class__) )
- def __init__(self, A, elt):
- """
-
- SETUP::
-
- sage: from mjo.eja.eja_algebra import (RealSymmetricEJA,
- ....: random_eja)
-
- EXAMPLES:
-
- The identity in `S^n` is converted to the identity in the EJA::
-
- sage: J = RealSymmetricEJA(3)
- sage: I = matrix.identity(QQ,3)
- sage: J(I) == J.one()
- True
-
- This skew-symmetric matrix can't be represented in the EJA::
-
- sage: J = RealSymmetricEJA(3)
- sage: A = matrix(QQ,3, lambda i,j: i-j)
- sage: J(A)
- Traceback (most recent call last):
- ...
- ArithmeticError: vector is not in free module
-
- TESTS:
-
- Ensure that we can convert any element of the parent's
- underlying vector space back into an algebra element whose
- vector representation is what we started with::
-
- sage: set_random_seed()
- sage: J = random_eja()
- sage: v = J.vector_space().random_element()
- sage: J(v).to_vector() == v
- True
-
- """
- # Goal: if we're given a matrix, and if it lives in our
- # parent algebra's "natural ambient space," convert it
- # into an algebra element.
- #
- # The catch is, we make a recursive call after converting
- # the given matrix into a vector that lives in the algebra.
- # This we need to try the parent class initializer first,
- # to avoid recursing forever if we're given something that
- # already fits into the algebra, but also happens to live
- # in the parent's "natural ambient space" (this happens with
- # vectors in R^n).
- ifme = super(FiniteDimensionalEuclideanJordanAlgebraElement, self)
- try:
- ifme.__init__(A, elt)
- except ValueError:
- natural_basis = A.natural_basis()
- if elt in natural_basis[0].matrix_space():
- # Thanks for nothing! Matrix spaces aren't vector
- # spaces in Sage, so we have to figure out its
- # natural-basis coordinates ourselves.
- V = VectorSpace(elt.base_ring(), elt.nrows()**2)
- W = V.span( _mat2vec(s) for s in natural_basis )
- coords = W.coordinate_vector(_mat2vec(elt))
- ifme.__init__(A, coords)
def __pow__(self, n):
sage: coeff = ~(x0^2 - x_bar.inner_product(x_bar))
sage: inv_vec = x_vec.parent()([x0] + (-x_bar).list())
sage: x_inverse = coeff*inv_vec
- sage: x.inverse() == J(x_inverse)
+ sage: x.inverse() == J.from_vector(x_inverse)
True
TESTS:
"""
A = self.subalgebra_generated_by()
- return A.element_class(A,self).operator().minimal_polynomial()
+ return A(self).operator().minimal_polynomial()
sage: J = ComplexHermitianEJA(3)
sage: J.one()
- e0 + e5 + e8
+ e0 + e3 + e8
sage: J.one().natural_representation()
[1 0 0 0 0 0]
[0 1 0 0 0 0]
sage: J = QuaternionHermitianEJA(3)
sage: J.one()
- e0 + e9 + e14
+ e0 + e5 + e14
sage: J.one().natural_representation()
[1 0 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 0 0]
sage: from mjo.eja.eja_algebra import random_eja
- TESTS::
+ TESTS:
+
+ This subalgebra, being composed of only powers, is associative::
sage: set_random_seed()
- sage: x = random_eja().random_element()
- sage: x.subalgebra_generated_by().is_associative()
+ sage: x0 = random_eja().random_element()
+ sage: A = x0.subalgebra_generated_by()
+ sage: x = A.random_element()
+ sage: y = A.random_element()
+ sage: z = A.random_element()
+ sage: (x*y)*z == x*(y*z)
True
Squaring in the subalgebra should work the same as in
raise ValueError("this only works with non-nilpotent elements!")
J = self.subalgebra_generated_by()
- u = J.from_vector(self.to_vector())
+ u = J(self)
# The image of the matrix of left-u^m-multiplication
# will be minimal for some natural number s...
# Our FiniteDimensionalAlgebraElement superclass uses rows.
u_next = u**(s+1)
A = u_next.operator().matrix()
- c = J(A.solve_right(u_next.to_vector()))
+ c = J.from_vector(A.solve_right(u_next.to_vector()))
# Now c is the idempotent we want, but it still lives in the subalgebra.
return c.superalgebra_element()