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

Polynomials over inexact rings should not truncate inexact leading zeroes #5075

Open
kedlaya opened this issue Jan 23, 2009 · 9 comments
Open

Comments

@kedlaya
Copy link
Sponsor Contributor

kedlaya commented Jan 23, 2009

The generic polynomial class truncates leading zeroes, and this can cause problems when working over an inexact ring in which is_zero can return True even for an inexact zero (e.g., see #2943). Here is a simple example:

sage: C.<t> = PowerSeriesRing(Integers())
sage: D.<s> = PolynomialRing(C)
sage: y = O(t)
sage: y
O(t^1)
sage: z = y*s
sage: z
0
sage: z.list()
[]

This was recognized earlier for p-adics and fixed (I'm not sure which ticket this was):

sage: C = pAdicField(11)
sage: D.<s> = PolynomialRing(C)
sage: y = O(11)
sage: y
O(11)
sage: z = y*s
sage: z
(O(11))*s

The other main class of inexact rings are interval fields, but I believe for those is_zero returns False for an inexact zero, so this doesn't come up.

CC: @sagetrac-dmharvey @nilesjohnson @categorie

Component: algebra

Keywords: polynomials, power series, inexact rings

Stopgaps: todo

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

@kedlaya kedlaya added this to the sage-5.11 milestone Jan 23, 2009
@kedlaya
Copy link
Sponsor Contributor Author

kedlaya commented Jan 23, 2009

comment:2

A closely related issue is #3979.

@roed314
Copy link
Contributor

roed314 commented Apr 26, 2009

Attachment: trac_5075.patch.gz

In progress. I think it fixes the problem, but I'm working on a larger project for p-adic polynomials that this is part of.

@roed314
Copy link
Contributor

roed314 commented Jun 11, 2009

Attachment: trac_5075.2.patch.gz

rebased against 4.0

@kedlaya
Copy link
Sponsor Contributor Author

kedlaya commented Aug 1, 2011

comment:3

I tried to apply this against 4.7.1.rc1 and got a bunch of merge failures in power_series_poly.pyx. Probably another trivial rebase is needed.

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@nilesjohnson
Copy link
Mannequin

nilesjohnson mannequin commented Feb 3, 2014

comment:6

David, could you give us a rebase for sage 6.1? I know you're doing a lot of other work for padics, but we're trying to solve a more basic issue with power series comparison at #9457. Power series over padics are a confusing obstacle there, and we wanted to see if the patch here would help.

Here's the specific bug we're trying to track down (in sage 6.1): Power series over p-adics are changing inexact zeros to exact zeros -- this looks similar to the problem with polynomials on this ticket, but notice that the problem happens even for p-adics:

sage: Ct.<t> = PowerSeriesRing(Qp(11))
sage: O(11^2) # inexact zero
O(11^2)
sage: Ct(O(11^2)) # coercing to power series ring looses finite precision
0
sage: Ct(1+O(11^2)) # finite precision is retained for non-zero elements
1 + O(11^2)

There is a problem with multiplication of a p-adic by an element of the power series ring, which might be caused by the problem above:

sage: 1+O(11^2)*t  # finite precision is retained
1 + O(11^20) + O(11^2)*t  

sage: O(11^2)*t  # finite precision is lost
0

Note that there is a similar problem for more general power series ring over power series ring:

sage: D.<x> = PowerSeriesRing(QQ)
sage: Ds.<s> = PowerSeriesRing(D)
sage: O(x)  # inexact zero
O(x^1)
sage: Ds(O(x)) # finite precision is lost
0
sage: Ds(1+O(x)) # finite precision is retained
1 + O(x)

sage: 1+O(x)*s # !! this is different from behavior of power series over padic ring
1

My hope is that starting with a rebase of this patch would be a step toward solving this problem. Perhaps it will have to be extended to power series over inexact rings too. Unfortunately I don't understand the current status of padics well enough to do this rebase myself.

@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 19, 2015

Stopgaps: todo

@kedlaya
Copy link
Sponsor Contributor Author

kedlaya commented Mar 23, 2016

comment:10

Ping. Is this issue due to be resolved by other developments on p-adics?

@kedlaya
Copy link
Sponsor Contributor Author

kedlaya commented Sep 6, 2017

comment:11

Ping again. The original example still behaves the same way in Sage 8.0.

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
@martinluedtke
Copy link

There is a problem also with the evaluation of p-adic polynomials whose leading coefficient is an inexact zero. It looks like inexact leading zeros are treated as exact zeros, resulting in wrong precisions. For example:

sage: R.<x> = Qp(2)['x']
sage: f = O(2)*x + 1
sage: f
O(2)*x + 1 + O(2^20)
sage: f(1)
1 + O(2^20)

Here, the value f(1) should be 1 + O(2), not 1 + O(2^20).

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

5 participants