sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.34k stars 453 forks source link

Incorrect/inconsistent treatment of inexact zeroes in coefficients of power series #14425

Open b11c8a96-399b-45f8-a2be-ae7169948853 opened 11 years ago

b11c8a96-399b-45f8-a2be-ae7169948853 commented 11 years ago

p-adic coefficients: first of all, the way an inexact zero is treated is different based on whether one is working with capped-absolute or capped-relative coefficients:

sage: R = ZpCA(3,5)
sage: PS.<z> = PowerSeriesRing(R)
sage: F = PS([1,2,3,O(3^3)])
sage: F
1 + O(3^5) + (2 + O(3^5))*z + (3 + O(3^5))*z^2
sage: F.list()
[1 + O(3^5), 2 + O(3^5), 3 + O(3^5)]
sage: F.coefficients()
[1 + O(3^5), 2 + O(3^5), 3 + O(3^5)]
sage: F[3]
O(3^5)

whereas the capped-relative p-adics (almost) behave as I would hope:

sage: RCR = ZpCR(3,5)
sage: PSCR.<w> = PowerSeriesRing(RCR)
sage: G = PSCR([1,2,3,O(3^3)])
sage: G
1 + O(3^5) + (2 + O(3^5))*w + (3 + O(3^6))*w^2 + O(3^3)*w^3
sage: G.list()
[1 + O(3^5), 2 + O(3^5), 3 + O(3^6), O(3^3)]
sage: G.coefficients()
[1 + O(3^5), 2 + O(3^5), 3 + O(3^6)]
sage: G[3]
0

This last command should return O(3^3), but returns an exact zero because if n > degree of the underlying polynomial of G, then G[n] returns an exact zero. Really, it should just return self.__f[n] in all cases.

The case of power series rings is similar to the capped-absolute case (unfortunately):

sage: S.<t> = PowerSeriesRing(ZZ)
sage: c = S(0,3)
sage: PSS.<u> = PowerSeriesRing(S)
sage: H = PSS([t,2,3,c], 5)
sage: H
t + 2*u + 3*u^2 + O(u^5)
sage: H.list()
[t, 2, 3]
sage: H.coefficients()
[t, 2, 3]
sage: H[3]
0

These problems I think trace back to the way the underlying polynomial treats things, and I think some people are working to revamp polynomials over inexact rings, but I wanted to point out these problems. For instance, some of these I think can be solved without change the polynomial code.

Component: padics

Keywords: power series, precision

Stopgaps: wrongAnswerMarker

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

ea1d0bf8-c27a-4548-8cb7-de0b1d02441a commented 8 years ago

Stopgaps: wrongAnswerMarker