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:
False
"""
- zero = self.parent().zero()
+ # In fact, we only need to know if the constant term is non-zero,
+ # so we can pass in the field's zero element instead.
+ zero = self.base_ring().zero()
p = self.minimal_polynomial()
return not (p(zero) == zero)
"""
A = self.subalgebra_generated_by()
- return A.element_class(A,self).operator().minimal_polynomial()
+ return A(self).operator().minimal_polynomial()
"""
P = self.parent()
+ left_mult_by_self = lambda y: self*y
+ L = P.module_morphism(function=left_mult_by_self, codomain=P)
return FiniteDimensionalEuclideanJordanAlgebraOperator(
P,
P,
- self.to_matrix() )
+ L.matrix() )
def quadratic_representation(self, other=None):
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
sage: A(x^2) == A(x)*A(x)
True
+ The subalgebra generated by the zero element is trivial::
+
+ sage: set_random_seed()
+ sage: A = random_eja().zero().subalgebra_generated_by()
+ sage: A
+ Euclidean Jordan algebra of dimension 0 over Rational Field
+ sage: A.one()
+ 0
+
"""
return FiniteDimensionalEuclideanJordanElementSubalgebra(self)
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()