# HG changeset patch
# User Matthieu Dien <matthieu.dien@gmail.com>
# Date 1370708355 7200
# Node ID 858e4d2fae458e1376789c3d88d3497b7d986630
# Parent 799aad4a9c8ba9d9034353fca15a2f523483e87b
#14685: error in the computing of the approximate order in LazyPowerSeries
diff git a/sage/combinat/species/series.py b/sage/combinat/species/series.py
a

b


606  606  sage: a.refine_aorder() 
607  607  sage: a.aorder 
608  608  2 
 609  
 610  :: 
 611  
 612  sage: L = LazyPowerSeriesRing(QQ) 
 613  sage: a = L([0,0,0,0,1]) 
 614  sage: a.aorder 
 615  0 
 616  sage: a.coefficient(4) 
 617  1 
 618  sage: a.aorder 
 619  0 
 620  sage: a.order 
 621  Unknown series order 
 622  sage: a.refine_aorder() 
 623  sage: a.aorder 
 624  4 
 625  sage: a.order 
 626  4 
609  627  """ 
610  628  #If we already know the order, then we don't have 
611  629  #to worry about the approximate order 
… 
… 

624  642  c = self._stream 
625  643  n = c.number_computed() 
626  644  
 645  while ao < n: 
 646  if self._stream[ao] == 0: 
 647  self.aorder += 1 
 648  ao += 1 
 649  else: 
 650  self.order = ao 
 651  break 
627  652  
628   if ao == 0 and n > 0: 
629   while ao < n: 
630   if self._stream[ao] == 0: 
631   self.aorder += 1 
632   ao += 1 
633   else: 
634   self.order = ao 
635   break 
636  653  
637  654  #Try to recognize the zero series 
638   if ao == n: 
 655  if ao == n and n > 0: 
639  656  #For nonconstant series, we cannot do anything 
640  657  if not c.is_constant(): 
641  658  return 
… 
… 

643  660  self.aorder = inf 
644  661  self.order = inf 
645  662  return 
646   
647   if self.order == unk: 
648   while ao < n: 
649   if self._stream[ao] == 0: 
650   self.aorder += 1 
651   ao += 1 
652   else: 
653   self.order = ao 
654   break 
655  663  
656   # if ao < n: 
657   # self.order = ao 
658   
659   
660  664  if hasattr(self, '_reference') and self._reference is not None: 
661  665  self._reference._copy(self) 
662  666  