SETUP::
sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+ ....: RealSymmetricEJA,
....: random_eja)
TESTS:
sage: x.apply_univariate_polynomial(p)
0
+ The minimal polynomial is invariant under a change of basis,
+ and in particular, a re-scaling of the basis::
+
+ sage: set_random_seed()
+ sage: n = ZZ.random_element(1,5)
+ sage: J1 = RealSymmetricEJA(n)
+ sage: J2 = RealSymmetricEJA(n,QQ,False)
+ sage: X = random_matrix(QQ,n)
+ sage: X = X*X.transpose()
+ sage: x1 = J1(X)
+ sage: x2 = J2(X)
+ sage: x1.minimal_polynomial() == x2.minimal_polynomial()
+ True
+
"""
if self.is_zero():
# We would generate a zero-dimensional subalgebra
"""
B = self.parent().natural_basis()
- W = B[0].matrix_space()
+ W = self.parent().natural_basis_space()
return W.linear_combination(zip(B,self.to_vector()))
+ def norm(self):
+ """
+ The norm of this element with respect to :meth:`inner_product`.
+
+ SETUP::
+
+ sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+ ....: RealCartesianProductEJA)
+
+ EXAMPLES::
+
+ sage: J = RealCartesianProductEJA(2)
+ sage: x = sum(J.gens())
+ sage: x.norm()
+ sqrt(2)
+
+ ::
+
+ sage: J = JordanSpinEJA(4)
+ sage: x = sum(J.gens())
+ sage: x.norm()
+ 2
+
+ """
+ return self.inner_product(self).sqrt()
+
+
def operator(self):
"""
Return the left-multiplication-by-this-element
Property 2 (multiply on the right for :trac:`28272`):
- sage: alpha = QQ.random_element()
+ sage: alpha = J.base_ring().random_element()
sage: (alpha*x).quadratic_representation() == Qx*(alpha^2)
True
sage: set_random_seed()
sage: A = random_eja().zero().subalgebra_generated_by()
sage: A
- Euclidean Jordan algebra of dimension 0 over Rational Field
+ Euclidean Jordan algebra of dimension 0 over...
sage: A.one()
0
TESTS:
- The trace inner product is commutative::
-
- sage: set_random_seed()
- sage: J = random_eja()
- sage: x = J.random_element(); y = J.random_element()
- sage: x.trace_inner_product(y) == y.trace_inner_product(x)
- True
-
- The trace inner product is bilinear::
+ The trace inner product is commutative, bilinear, and satisfies
+ the Jordan axiom:
sage: set_random_seed()
sage: J = random_eja()
- sage: x = J.random_element()
+ sage: x = J.random_element();
sage: y = J.random_element()
sage: z = J.random_element()
- sage: a = QQ.random_element();
+ sage: # commutative
+ sage: x.trace_inner_product(y) == y.trace_inner_product(x)
+ True
+ sage: # bilinear
+ sage: a = J.base_ring().random_element();
sage: actual = (a*(x+z)).trace_inner_product(y)
sage: expected = ( a*x.trace_inner_product(y) +
....: a*z.trace_inner_product(y) )
....: a*x.trace_inner_product(z) )
sage: actual == expected
True
-
- The trace inner product satisfies the compatibility
- condition in the definition of a Euclidean Jordan algebra::
-
- sage: set_random_seed()
- sage: J = random_eja()
- sage: x = J.random_element()
- sage: y = J.random_element()
- sage: z = J.random_element()
+ sage: # jordan axiom
sage: (x*y).trace_inner_product(z) == y.trace_inner_product(x*z)
True
raise TypeError("'other' must live in the same algebra")
return (self*other).trace()
+
+
+ def trace_norm(self):
+ """
+ The norm of this element with respect to :meth:`trace_inner_product`.
+
+ SETUP::
+
+ sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+ ....: RealCartesianProductEJA)
+
+ EXAMPLES::
+
+ sage: J = RealCartesianProductEJA(2)
+ sage: x = sum(J.gens())
+ sage: x.trace_norm()
+ sqrt(2)
+
+ ::
+
+ sage: J = JordanSpinEJA(4)
+ sage: x = sum(J.gens())
+ sage: x.trace_norm()
+ 2*sqrt(2)
+
+ """
+ return self.trace_inner_product(self).sqrt()