Opened 8 years ago

Closed 8 years ago

conversion of power series with zero bigoh to polynomials

Reported by: Owned by: rws rws major sage-6.2 algebra Ralf Stephan Travis Scrimshaw N/A u/rws/ticket/15707 4ea496344014a2f3d50779e7f53e5f91d5150e67

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.

comment:1 Changed 8 years ago by rws

• Owner changed from (none) to rws

comment:2 Changed 8 years ago by pbruin

This should be fixed, probably also for series with finite precision, i.e. that do have an O(xn) term. There is already the method `r.polynomial()` which returns exactly the desired result; we just have to tell `P(r)` to use this.

comment:3 Changed 8 years ago by rws

• Component changed from algebra to coercion

comment:4 Changed 8 years ago by nbruin

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 nbruin

• 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 rws

• Component changed from coercion to algebra

comment:7 Changed 8 years ago by rws

Agree, after sleeping over it and rereading the documentation.

comment:8 Changed 8 years ago by rws

• 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 git

• 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 rws

• Status changed from new to needs_review

comment:11 Changed 8 years ago by tscrim

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 git

• 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 tscrim

• Authors set to Ralf Stephan
• Reviewers set to Travis Scrimshaw
• Status changed from needs_review to positive_review

LGTM

comment:14 Changed 8 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

comment:15 Changed 8 years ago by vbraun

• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.