#3979: Power series composition messes up precision
--------------------------------------------------------+-------------------
       Reporter:  kedlaya                               |         Owner:  
somebody                                                   
           Type:  defect                                |        Status:  
positive_review                                            
       Priority:  critical                              |     Milestone:  
sage-5.4                                                   
      Component:  algebra                               |    Resolution:        
                                                     
       Keywords:  power series, composition, precision  |   Work issues:        
                                                     
Report Upstream:  N/A                                   |     Reviewers:  Kiran 
Kedlaya, Luis Felipe Tabera Alonso, Frédéric Chapoton
        Authors:  Francis Clarke                        |     Merged in:        
                                                     
   Dependencies:                                        |      Stopgaps:  12783 
                                                     
--------------------------------------------------------+-------------------

Comment (by fwclarke):

 Replying to [comment:25 chapoton]:
 > The bot is back and is unhappy because the patch removes one test in
 rings/power_series_mpoly.pyx
 >
 > This should be easy to correct, if really required to close the ticket.

 As I said in July last year:

    I have also deleted the doctest in
 `sage.rings.power_series_mpoly.__call__` for two reasons : (1) it doesn't
 use this function; (2) it makes no sense anyway. Besides the first line of
 the file is
 {{{
 # NOT ready to be used -- possibly should be deleted.
 }}}

 And I explained this more fully a year ago:

    The reason I removed rather than corrected the doctest in
 `power_series_mpoly` was that it does not test this `__call__` function
 but the one in `power_series_poly` (I've seen too many such doctests). In
 fact I'm not sure that this file is used at all. In fact the first line is
 {{{
 # NOT ready to be used -- possibly should be deleted.
 }}}
    However I didn't have the confidence to delete it myself, and add other
 issues to an already complicated patch.

    Adding documentation to this function would be hard to do since the
 whole file is so poorly documented that I can't understand what it's for.

 I have now understood how to create an element of the relevant type
 (something that isn't done anywhere else, as far as I can see):
 {{{
 sage: S.<x> = QQ[]
 sage: R = sage.rings.power_series_ring.PowerSeriesRing_generic(S,
             't', use_lazy_mpoly_ring=True)
 sage: t = R.gen()
 sage: f = 3 - x*t^3 + O(t^5)
 sage: type(f)
 <type 'sage.rings.power_series_mpoly.PowerSeries_mpoly'>
 sage: f(2)
 -2*t^3 + 3
 sage: f(2, t^2)
 3 - 2*t^6
 }}}
 The final answers are wrong (they shouldn't have infinite precision),
 inconsistent (the first is a polynomial, the second a power series), and
 the syntax is non-standard.  Compare
 {{{
 sage: T.<u> = S[[]]
 sage: g = 3 - x*u^3 + O(u^5)
 sage: g(u^2, 2)
 3 - 2*u^6 + O(u^10)
 sage: g(u^2)
 3 - x*u^6 + O(u^10)
 }}}
 Of course `g(2)` raises an error.

 However, I have made a supplementary patch which reinserts into
 `power_series_mpoly.pyx` a doctest based on the above.  This should
 appease the patchbot, and though problematic it is less bad than before.
 The alternative would be to rewrite much of the code in
 `power_series_mpoly.pyx`, which would seem to be a waste of time if it is
 destined for deletion.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/3979#comment:26>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to