Skip to content

error in the computing of the approximate order in LazyPowerSeries #14685

@MatthieuDien

Description

@MatthieuDien

Hi,

I found a bug in the LazyPowerSeries class of package combinat. There is mistake in the computing of the approximate order of a serie. A demonstration of the bug :

sage: R = LazyPowerSeriesRing(QQ)
sage: B = R([0,0,0,1,0])
sage: B.aorder
0
sage: B.coefficients(10)
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
sage: B.aorder
1

The good result should be 3 and not 1 (the order of the series B = x3 is 3 not 1 )

The bug is that the aorder is computed one time and never updated. This is because the order was assigned the first time then the condition self.order != unk becomes false and the update never comes.

After the patch, we obtain :

sage: R = LazyPowerSeriesRing(QQ)
sage: B = R([0,0,0,1,0])
sage: B.aorder
0
sage: B.coefficients(10)
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
sage: B.aorder
3

What we expected.

PS : Thanks you for the commments, I tried to answer them.
PS 2 : I modified the patch as you asked

CC: @mantepse

Component: combinatorics

Keywords: LazyPowerSeries aorder approximate order

Reviewer: Travis Scrimshaw, Martin Rubey

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions