From: Michael Orlitzky Date: Thu, 10 Oct 2019 13:24:17 +0000 (-0400) Subject: eja: add inverse() method for operators. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=f18fd7071b8e8165c3388cd408da11432edec806;p=sage.d.git eja: add inverse() method for operators. --- diff --git a/mjo/eja/eja_operator.py b/mjo/eja/eja_operator.py index 781d987..41d6856 100644 --- a/mjo/eja/eja_operator.py +++ b/mjo/eja/eja_operator.py @@ -383,6 +383,56 @@ class FiniteDimensionalEuclideanJordanAlgebraOperator(Map): return (self + (-other)) + def inverse(self): + """ + Return the inverse of this operator, if it exists. + + The reason this method is not simply an alias for the built-in + :meth:`__invert__` is that the built-in inversion is a bit magic + since it's intended to be a unary operator. If we alias ``inverse`` + to ``__invert__``, then we wind up having to call e.g. ``A.inverse`` + without parentheses. + + SETUP:: + + sage: from mjo.eja.eja_algebra import RealSymmetricEJA, random_eja + + EXAMPLES:: + + sage: J = RealSymmetricEJA(2) + sage: x = sum(J.gens()) + sage: x.operator().inverse().matrix() + [3/2 -1 1/2] + [ -1 2 -1] + [1/2 -1 3/2] + sage: x.operator().matrix().inverse() + [3/2 -1 1/2] + [ -1 2 -1] + [1/2 -1 3/2] + + TESTS: + + The identity operator is its own inverse:: + + sage: set_random_seed() + sage: J = random_eja() + sage: idJ = J.one().operator() + sage: idJ.inverse() == idJ + True + + The zero operator is never invertible:: + + sage: set_random_seed() + sage: J = random_eja() + sage: J.zero().operator().inverse() + Traceback (most recent call last): + ... + ZeroDivisionError: input matrix must be nonsingular + + """ + return ~self + + def is_invertible(self): """ Return whether or not this operator is invertible.