Ticket #10084: trac_10084-lazy_power_series_order-mh.patch

File trac_10084-lazy_power_series_order-mh.patch, 2.6 KB (added by mhansen, 8 years ago)
  • sage/combinat/species/series.py

    # HG changeset patch
    # User Mike Hansen <mhansen@gmail.com>
    # Date 1344600243 36000
    # Node ID f74a348253451652db0d98c991820fa9d36155a2
    # Parent  b9e9ed6430f1f29bc733b4ad9421db889f14ce34
    #10084: Lazy power series are created with incorrect order
    
    diff --git a/sage/combinat/species/series.py b/sage/combinat/species/series.py
    a b  
    804804            sage: s = L()
    805805            sage: s._name = 's'
    806806            sage: s.define(one+monom*s)
    807             sage: s.aorder
     807            sage: s.get_aorder()
    808808            0
    809809            sage: s.order
    810810            Unknown series order
     
    818818            sage: s = L()
    819819            sage: s._name = 's'
    820820            sage: s.define(one+monom*s*s)
    821             sage: s.aorder
     821            sage: s.get_aorder()
    822822            0
    823823            sage: s.order
    824824            Unknown series order
     
    832832            sage: s = L()
    833833            sage: s._name = 's'
    834834            sage: s.define(monom + s*s)
    835             sage: s.aorder
     835            sage: s.get_aorder()
    836836            1
    837837            sage: s.order
    838838            Unknown series order
     
    977977            self._reference._copy(self)
    978978
    979979    def _new(self, compute_coefficients, order_op, *series, **kwds):
     980        """
     981        TESTS:
     982
     983        We check that :trac:`10084` is indeed fixed::
     984
     985            sage: S = LazyPowerSeriesRing(ZZ)
     986            sage: one = S(0) + S(1)
     987            sage: one.coefficients(3)
     988            [1, 0, 0]
     989
     990            sage: from sage.combinat.species.stream import Stream
     991            sage: zero = S(0)
     992            sage: test_series = zero._new(lambda ao: Stream(const=1), lambda: 0)
     993            sage: test_series.coefficients(3)
     994            [1, 1, 1]
     995        """
    980996        parent = kwds['parent'] if 'parent' in kwds else self.parent()
    981         new_fps = self.__class__(parent, stream=None, order=unk, aorder=self.aorder,
     997        new_fps = self.__class__(parent, stream=None, order=unk, aorder=unk,
    982998                                 aorder_changed=True, is_initialized=False)
    983999       
    9841000        new_fps.compute_aorder = lambda: new_fps._approximate_order(compute_coefficients, order_op, *series)
     
    11831199            sage: s = L([1])
    11841200            sage: t = L([0,0,1,0])
    11851201            sage: u = s(t)
    1186             sage: u.aorder
     1202            sage: u.get_aorder()
    11871203            0
    11881204            sage: u.order
    11891205            Unknown series order
     
    14831499            [1, 0, 4, 5, 6]
    14841500        """
    14851501        yield integration_constant
    1486         ao = self.aorder
     1502        ao = self.get_aorder()
    14871503        assert ao != unk
    14881504
    14891505        if ao == inf: