Skip to content

sage.rings.power_series_poly.PowerSeries_poly.pade, reads out of range #21212

@edgarcosta

Description

@edgarcosta
sage: QQx.<x> = QQ[[]]
sage: (1+x+O(x^100)).pade(2,2)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-2-9cb1c03a10fc> in <module>()
----> 1 (Integer(1)+x+O(x**Integer(100))).pade(Integer(2),Integer(2))

/Applications/sage-7.3/src/sage/rings/power_series_poly.pyx in sage.rings.power_series_poly.PowerSeries_poly.pade (/Applications/sage-7.3/src/build/cythonized/sage/rings/power_series_poly.c:12104)()
   1120         for i in range(1, n + 1):
   1121             for j in range(n + 1):
-> 1122                 mat[i, j] = c[m + i - j]
   1123         for j in range(n + 1):
   1124             mat[0, j] = z ** j

IndexError: list index out of range

Here is a quick fix:

for i in range(1, n + 1):
            for j in range(n + 1):
                if m + i - j < len(c): # new line
                # or
                # if m + i - j < self.degree(): 
                    mat[i, j] = c[m + i - j]

Depends on #23534

Component: commutative algebra

Keywords: Power Series, pade, sd87, days88, IMA coding sprints

Author: Edgar Costa

Branch/Commit: bf520b9

Reviewer: Frédéric Chapoton, Aly Deines, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/21212

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions