Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy power series are created with incorrect order #10084

Closed
haraldschilly opened this issue Oct 6, 2010 · 8 comments
Closed

Lazy power series are created with incorrect order #10084

haraldschilly opened this issue Oct 6, 2010 · 8 comments

Comments

@haraldschilly
Copy link
Member

Reported by the "Report a Problem" Form:

When typing the following:

S = LazyPowerSeriesRing(ZZ)
one = S(0) + S(1)
one.order

I get a "Infinite series order" message. When asking for

one.coefficients(3)

I get "[0, 0, 0]".

Looking into the code sage/combinat/species/series.py, the _add_ method calls the _new method to create the sum series. Trying:

zero = S(0)
test_series = zero._new(lambda ao: Stream(const=1), lambda: 0)
test_series.order
test_series.coefficients(3)

I again get "Infinite series order" and "[0, 0, 0]".

As I understand it, the _new() method calls the init() method of LazyPowerSeries in the line:

new_fps = self.__class__(parent, stream=None, order=unk, aorder=self.aorder, aorder_changed=True, is_initialized=False)

If the value self.aorder is inf, this puts new_fps.aorder to inf, which (in the init() code), also puts new_fps.order to inf, which makes Sage think that the series has infinite order.

Changing the argument aorder=self.aorder to aorder=unk in the above line solved the problem.
The sum of S(0) and S(1) should have order zero, and its first three coefficients should be [1, 0, 0].

The series test_series should also have order zero, and its coefficients should be [1, 1, 1].

CC: axel.bacher@labri.fr @mwhansen @mantepse

Component: combinatorics

Keywords: LazyPowerSeries

Stopgaps: todo

Reviewer: Travis Scrimshaw

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

@mwhansen
Copy link
Contributor

Author: Mike Hansen

@mwhansen
Copy link
Contributor

comment:2

Attachment: trac_10084-lazy_power_series_order-mh.patch.gz

@mantepse
Copy link
Collaborator

Changed keywords from none to LazyPowerSeries

@mwhansen
Copy link
Contributor

comment:6

A fix is in #15673

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@sagetrac-jakobkroeker
Copy link
Mannequin

sagetrac-jakobkroeker mannequin commented Aug 25, 2015

Stopgaps: todo

@mantepse
Copy link
Collaborator

comment:11

This is no longer relevant, since #32367.

@mantepse mantepse removed this from the sage-6.4 milestone Sep 21, 2022
@tscrim
Copy link
Collaborator

tscrim commented Oct 22, 2022

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Oct 22, 2022

Changed author from Mike Hansen to none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants