#10084: Lazy power series are created with incorrect order
-------------------------+--------------------------------------------------
   Reporter:  schilly    |       Owner:  burcin  
       Type:  defect     |      Status:  new     
   Priority:  major      |   Milestone:  sage-4.6
  Component:  symbolics  |    Keywords:          
     Author:             |    Upstream:  N/A     
   Reviewer:             |      Merged:          
Work_issues:             |  
-------------------------+--------------------------------------------------
 Reported by the "Report a Problem" Form:

 When typing the following:

 {{{
 S = LazyPowerSeriesRing(ZZ)
 one = S(0) + S(1)
 one.order
 }}}

 I get a "Infinite series order" message. When asking for
 {{{
 one.coefficients(3)
 }}}
 I get "[0, 0, 0]".

 Looking into the code sage/combinat/species/series.py, the _add_ method
 calls the _new method to create the sum series. Trying:
 {{{
 zero = S(0)
 test_series = zero._new(lambda ao: Stream(const=1), lambda: 0)
 test_series.order
 test_series.coefficients(3)
 }}}
 I again get "Infinite series order" and "[0, 0, 0]".

 As I understand it, the _new() method calls the __init__() method of
 !LazyPowerSeries in the line:
 {{{
 new_fps = self.__class__(parent, stream=None, order=unk,
 aorder=self.aorder, aorder_changed=True, is_initialized=False)
 }}}
 If the value self.aorder is inf, this puts new_fps.aorder to inf, which
 (in the __init__() code), also puts new_fps.order to inf, which makes Sage
 think that the series has infinite order.

 Changing the argument aorder=self.aorder to aorder=unk in the above line
 solved the problem.
 The sum of S(0) and S(1) should have order zero, and its first three
 coefficients should be [1, 0, 0].

 The series test_series should also have order zero, and its coefficients
 should be [1, 1, 1].

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10084>
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