def minimal_polynomial(self):
- return self.matrix().minimal_polynomial()
+ """
+ EXAMPLES::
+
+ sage: set_random_seed()
+ sage: n = ZZ.random_element(1,10).abs()
+ sage: J = eja_rn(n)
+ sage: x = J.random_element()
+ sage: x.degree() == x.minimal_polynomial().degree()
+ True
+
+ ::
+
+ sage: set_random_seed()
+ sage: n = ZZ.random_element(1,10).abs()
+ sage: J = eja_ln(n)
+ sage: x = J.random_element()
+ sage: x.degree() == x.minimal_polynomial().degree()
+ True
+
+ The minimal polynomial and the characteristic polynomial coincide
+ and are known (see Alizadeh, Example 11.11) for all elements of
+ the spin factor algebra that aren't scalar multiples of the
+ identity::
+
+ sage: set_random_seed()
+ sage: n = ZZ.random_element(2,10).abs()
+ sage: J = eja_ln(n)
+ sage: y = J.random_element()
+ sage: while y == y.coefficient(0)*J.one():
+ ....: y = J.random_element()
+ sage: y0 = y.vector()[0]
+ sage: y_bar = y.vector()[1:]
+ sage: actual = y.minimal_polynomial()
+ sage: x = SR.symbol('x', domain='real')
+ sage: expected = x^2 - 2*y0*x + (y0^2 - norm(y_bar)^2)
+ sage: bool(actual == expected)
+ True
+
+ """
+ V = self.span_of_powers()
+ assoc_subalg = self.subalgebra_generated_by()
+ # Mis-design warning: the basis used for span_of_powers()
+ # and subalgebra_generated_by() must be the same, and in
+ # the same order!
+ subalg_self = assoc_subalg(V.coordinates(self.vector()))
+ return subalg_self.matrix().minimal_polynomial()
+
def characteristic_polynomial(self):
return self.matrix().characteristic_polynomial()