"""
Return the Jordan-multiplicative inverse of this element.
- We can't use the superclass method because it relies on the
- algebra being associative.
+ ALGORITHM:
+
+ We appeal to the quadratic representation as in Koecher's
+ Theorem 12 in Chapter III, Section 5.
EXAMPLES:
sage: (not x.is_invertible()) or (x.inverse()*x == J.one())
True
- """
- if not self.is_invertible():
- raise ValueError("element not invertible")
+ The inverse of the inverse is what we started with::
- if self.parent().is_associative():
- elt = FiniteDimensionalAlgebraElement(self.parent(), self)
- # elt is in the right coordinates, but has the wrong class.
- return self.parent()(elt.inverse().vector())
+ sage: set_random_seed()
+ sage: J = random_eja()
+ sage: x = J.random_element()
+ sage: (not x.is_invertible()) or (x.inverse().inverse() == x)
+ True
- # We do this a little different than the usual recursive
- # call to a finite-dimensional algebra element, because we
- # wind up with an inverse that lives in the subalgebra and
- # we need information about the parent to convert it back.
- 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!
- elt = assoc_subalg(V.coordinates(self.vector()))
+ The zero element is never invertible::
+
+ sage: set_random_seed()
+ sage: J = random_eja().zero().inverse()
+ Traceback (most recent call last):
+ ...
+ ValueError: element is not invertible
- # This will be in the subalgebra's coordinates...
- fda_elt = FiniteDimensionalAlgebraElement(assoc_subalg, elt)
- subalg_inverse = fda_elt.inverse()
+ """
+ if not self.is_invertible():
+ raise ValueError("element is not invertible")
- # So we have to convert back...
- basis = [ self.parent(v) for v in V.basis() ]
- pairs = zip(subalg_inverse.vector(), basis)
- return self.parent().linear_combination(pairs)
+ P = self.parent()
+ return P(self.quadratic_representation().inverse()*self.vector())
def is_invertible(self):