Open kedlaya opened 15 years ago
A closely related issue is #3979.
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.
Attachment: trac_5075.2.patch.gz
rebased against 4.0
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.
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.
Stopgaps: todo
Ping. Is this issue due to be resolved by other developments on p-adics?
Ping again. The original example still behaves the same way in Sage 8.0.
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).
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:
This was recognized earlier for p-adics and fixed (I'm not sure which ticket this was):
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