# HG changeset patch
# User Matthieu Dien <matthieu.dien@gmail.com>
# Date 1370708355 -7200
# Node ID 58c07f33b3989be386d38e7af538e72b4aacb46f
# Parent 06515d305ef1954ac5f7fcd2e5b6a9a2dcd469c3
#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
|
class LazyPowerSeries(AlgebraElement): |
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 |
… |
… |
class LazyPowerSeries(AlgebraElement): |
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 | | break |
635 | 653 | |
636 | 654 | #Try to recognize the zero series |
637 | | if ao == n: |
| 655 | if ao == n and n > 0: |
638 | 656 | #For non-constant series, we cannot do anything |
639 | 657 | if not c.is_constant(): |
640 | 658 | return |