Opened 8 years ago
Closed 8 years ago
#15707 closed defect (fixed)
conversion of power series with zero bigoh to polynomials
Reported by:  rws  Owned by:  rws 

Priority:  major  Milestone:  sage6.2 
Component:  algebra  Keywords:  
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  u/rws/ticket/15707 (Commits, GitHub, GitLab)  Commit:  4ea496344014a2f3d50779e7f53e5f91d5150e67 
Dependencies:  Stopgaps: 
Description
sage: R.<x> = PowerSeriesRing(ZZ) sage: P.<x> = ZZ[] sage: r=R([1,1,1,1]) sage: r 1 + x + x^2 + x^3 sage: P(r) TypeError: unable to coerce <type 'sage.rings.power_series_poly.PowerSeries_poly'> to an integer
Sage power series can have zero bigoh term, and such series are identical to polynomials, so coercion should be no problem.
If we should allow zero bigoh in power series is another matter.
Change History (15)
comment:1 Changed 8 years ago by
 Owner changed from (none) to rws
comment:2 Changed 8 years ago by
comment:3 Changed 8 years ago by
 Component changed from algebra to coercion
comment:4 Changed 8 years ago by
Note that this is a conversion problem, not a coercion problem. There should be no coercion from PowerSeriesRing
to PolynomialRing
at all.
In fact, it may even be acceptable to let conversion from PowerSeries? to
Polynomials` simply be truncation: conversion is allowed to just be best effort (this is all completely compatible with Peter's comment above).
comment:5 Changed 8 years ago by
 Summary changed from coercion of power series with zero bigoh to polynomials to conversion of power series with zero bigoh to polynomials
comment:6 Changed 8 years ago by
 Component changed from coercion to algebra
comment:7 Changed 8 years ago by
Agree, after sleeping over it and rereading the documentation.
comment:8 Changed 8 years ago by
 Branch set to u/rws/ticket/15707
 Created changed from 01/22/14 11:34:31 to 01/22/14 11:34:31
 Modified changed from 01/23/14 07:20:01 to 01/23/14 07:20:01
comment:9 Changed 8 years ago by
 Commit set to 22058aaaf0d20fa767782baad05fe659fac3f6cb
Branch pushed to git repo; I updated commit sha1. New commits:
22058aa  Trac #15707: convert power series to polynomial by truncation

comment:10 Changed 8 years ago by
 Status changed from new to needs_review
comment:11 Changed 8 years ago by
I agree with this as well (and it's coherent with what we do with real fields to QQ
), but could you add an doctest showing this is fixed?
Thanks,
Travis
comment:12 Changed 8 years ago by
 Commit changed from 22058aaaf0d20fa767782baad05fe659fac3f6cb to 4ea496344014a2f3d50779e7f53e5f91d5150e67
Branch pushed to git repo; I updated commit sha1. New commits:
4ea4963  trac #15707: doctest

comment:13 Changed 8 years ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM
comment:14 Changed 8 years ago by
 Milestone changed from sage6.1 to sage6.2
comment:15 Changed 8 years ago by
 Resolution set to fixed
 Status changed from positive_review to closed
This should be fixed, probably also for series with finite precision, i.e. that do have an O(x^{n}) term. There is already the method
r.polynomial()
which returns exactly the desired result; we just have to tellP(r)
to use this.