#18600: Fix several methods for sparse polynomials
-------------------------------------+-------------------------------------
       Reporter:  bruno              |        Owner:
           Type:  defect             |       Status:  needs_info
       Priority:  major              |    Milestone:  sage-6.9
      Component:  commutative        |   Resolution:
  algebra                            |    Merged in:
       Keywords:  sparse polynomial  |    Reviewers:  Vincent Delecroix
        Authors:  Bruno Grenet       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  public/18600       |  29331f254d9255c23c673393c6fd0121c04d9d6c
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_info
 * commit:  809bc3ea6da046dd4bf7582c44ea8ef90319ea73 =>
     29331f254d9255c23c673393c6fd0121c04d9d6c
 * branch:  u/bruno/polynomial_sparse => public/18600


Comment:

 Hello,

 For non integral domain, there are some failures for `integral`
 {{{
 sage: x = polygen(Zmod(4))
 sage: p = x**4 + 1
 sage: p.integral()
 Traceback (most recent call last):
 ...
 ZeroDivisionError: Inverse does not exist.
 }}}
 And for more complicated rings as well
 {{{
 sage: Sx.<x> = ZZ[]
 sage: Sxy.<y> = Sx[]
 sage: Sxyz.<z> = Sxy[]
 sage: p = 1 + x*y + x*z + y*z^2
 sage: p.integral(y)
 Traceback (most recent call last):
 ...
 TypeError: no conversion of this rational to integer
 }}}
 Moreover, you kept the {{{self.constant_coefficient()/1}}}. In some cases
 (like the one above) there is no fraction field, so it makes sense to ask
 for the result of the division. But this is also accessible from the
 coercion model
 {{{
 sage: cm = get_coercion_model()
 sage: cm.division_parent(ZZ)
 Rational Field
 sage: cm.division_parent(Zmod(4))
 Ring of integers modulo 4
 }}}
 That way you avoid a useless division (and a coercion since you used `1`
 instead of `base_ring.one()`).

 That being said, there are plenty of broken thing in the coercion model. I
 ended up with a relatively robust solution but not ideal. In order to be
 improved, one has to work more on the coercion model and the polynomial
 division.

 Tell me what you think.

 Vincent
 ----
 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=29331f254d9255c23c673393c6fd0121c04d9d6c
 29331f2]||{{{trac #18600: better parent for integral of polynomials}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/18600#comment:6>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to