#13215: Skew polynomials
-------------------------------------+-------------------------------------
       Reporter:  caruso             |        Owner:  tbd
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-7.3
      Component:  algebra            |   Resolution:
       Keywords:  skew polynomials   |    Merged in:
        Authors:  Xavier Caruso      |    Reviewers:  Burcin Erocal
Report Upstream:  N/A                |  Work issues:  see comment #25
         Branch:                     |       Commit:
  u/arpitdm/skew_polynomials         |  dd5c575e26faaa88140e67c92130085b28e8b0a2
   Dependencies:  #13214, #13303,    |     Stopgaps:
  #13640, #13641, #13642             |
-------------------------------------+-------------------------------------
Changes (by jsrn):

 * commit:  18c7982a3d363ad004760d91e874783eab4c72ae =>
     dd5c575e26faaa88140e67c92130085b28e8b0a2


Comment:

 One of the bugs in the doctest has to do with failing in the proper manner
 when the twist map is not invertible (this is the `TypeError: bad operand
 type for unary ~` bug). This is because `self._map ** n` is being called
 with negative `n`, which will then try to invert `self._map` using the
 unary `~` operator which is not supported by `self._map` of type
 `Homomorphism_im_gens`.

 But the code was always supposed to fail! The doc-test just expected the
 error NotImplementedError, while the error nowadays is this unhelpful
 unary-~-stuff.

 One solution is therefore simply to catch the strange error and rethrow a
 NotImplementedException. The following patch should be put in
 `skew_polynomial_ring.py` (the line numbers are not completely correct):

 {{{
 @@ -534,9 +534,18 @@ class
 SkewPolynomialRing_general(sage.algebras.algebra.Algebra,UniqueRepresentat
          try:
              return self._maps[n]
          except KeyError:
 -            map = self._map**n
 -            self._maps[n] = map
 -            return map
 +            if n >= 0:
 +                map = self._map**n
 +                self._maps[n] = map
 +                return map
 +            else:
 +                try:
 +                    map = self._map**n
 +                except TypeError:
 +                    raise NotImplementedError("Inversion of the twist map
 %s" % self._map)
 +                self._maps[n] = map
 +                return map
 +
 }}}

 Best,
 Johan
 ----
 New commits:
 
||[https://git.sagemath.org/sage.git/commit?id=c6183bcfb9eb863f5052a3d3cd05e35e85a62c29
 c6183bc]||{{{Merge branch 'develop' into temp3}}}||
 
||[https://git.sagemath.org/sage.git/commit?id=dd5c575e26faaa88140e67c92130085b28e8b0a2
 dd5c575]||{{{Editing declarations of cython functions so as to make them
 compatible.}}}||

--
Ticket URL: <https://trac.sagemath.org/ticket/13215#comment:42>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to