#9457: power series comparison should use padded_list
------------------------------------------------------------------------------------------------------------------------+
Reporter: niles
| Owner: malb
Type: defect
| Status: needs_work
Priority: minor
| Milestone: sage-4.5.2
Component: commutative algebra
| Keywords:
Author: niles
| Upstream: N/A
Reviewer:
| Merged:
Work_issues: Fix bug in sage.schemes.elliptic_curves.sha_tate.Sha.an_padic;
mention ticket number in commit messages. |
------------------------------------------------------------------------------------------------------------------------+
Changes (by niles):
* cc: SimonKing (added)
Comment:
Replying to [comment:10 SimonKing]:
Hi Simon,
I believe I have identified the problem; I think it is a problem with
negative valuation for p-adics. First, here is what
{{{Dp_valued_series}}} does:
With or without the patch, we have
{{{
sage: import sage.matrix.all as matrix
sage: p = 5
sage: prec = 2
sage: E = EllipticCurve('53a1')
sage: L = E.padic_lseries(5)
sage: lps = L.series(4)
sage: R = lps.base_ring().base_ring()
sage: QpT, T = PowerSeriesRing(R,'T',2).objgen()
sage: G = QpT([lps[n][0] for n in range(0,lps.prec())], prec)
sage: H = QpT([lps[n][1] for n in range(0,lps.prec())], prec)
sage: phi = matrix.matrix([[0,-1/p],[1,E.ap(p)/p]])
sage: lpv = vector([G + (E.ap(p))*H , - R(p) * H ])
sage: eps = (1-phi)**(-2)
sage: lpv
(O(5^3) + (2*5^-1 + O(5^0))*T + O(T^2), O(T^2))
sage: eps.transpose()
[ 5/9 25/18]
[-5/18 5/9]
}}}
Now {{{Dp_valued_series}}} ends by returning {{{lpv*eps.transpose()}}}.
Without the patch:
{{{
sage: lpv*eps.transpose()
(O(5^4) + (3 + O(5))*T + O(T^2), O(T^2))
}}}
And with the patch:
{{{
sage: lpv*eps.transpose()
(O(5^4) + (3 + O(5))*T + O(T^2), O(5^5) + (4*5 + O(5^2))*T + O(T^2))
}}}
I had thought the with-patch answer was clearly right, until I tried the
following (without the patch):
{{{
sage: a = vector([O(5^3) + (R(2/5).add_bigoh(0))*T + O(T^2), O(T^2)])
sage: M = matrix.matrix([[ 0, 1],[0, 1]]); M
[0 1]
[0 1]
sage: a
(O(5^3) + (2*5^-1 + O(5^0))*T + O(T^2), O(T^2))
sage: lpv
(O(5^3) + (2*5^-1 + O(5^0))*T + O(T^2), O(T^2))
sage: a*M
(0, O(5^3) + (2*5^-1 + O(5^0))*T + O(T^2))
sage: lpv*M
(0, O(5^3) + (2*5^-1 + O(5^0))*T + O(T^2))
sage: M = matrix.matrix([[ 0, 5],[0, 1]])
sage: a*M
(0, O(5^4) + (2 + O(5))*T + O(T^2))
sage: lpv*M
(0, O(T^2))
}}}
Now note the way {{{lpv[1]}}} is constructed: pull certain coefficients
from {{{lps}}} and make a power series (of precision 2) in {{{QpT}}} with
them. Here is the list of coefficients for {{{H}}}:
{{{
sage: [lps[n][1] for n in range(0,lps.prec())]
[O(5^2), O(5^-1), O(5^-1), O(5^-1), O(5^-1)]
sage: H
O(T^2)
}}}
So the {{{O(T^2)}}} in {{{lpv[1]}}} should really be {{{O(5^2) + O(5^-1)*T
+ O(T^2)}}}, and this explains why {{{lpv*M}}} really should be {{{(0,
O(T^2))}}} (when M has a 5 in the upper-right entry).
Here is a more direct test that passing to the power series ring over
5-adic field does not remember negative precision of 0 (this is without
the patch):
{{{
sage: R(0).add_bigoh(-1)
O(5^-1)
sage: QpT(R(0).add_bigoh(-1))
0
sage: R(0).add_bigoh(-1).precision_absolute()
-1
sage: QpT(R(0).add_bigoh(-1))[0].precision_absolute()
+Infinity
sage: QpT(R(1/25).add_bigoh(-1))
5^-2 + O(5^-1)
sage: QpT(R(1/25).add_bigoh(-1))[0].precision_absolute()
-1
}}}
I believe the correct arithmetic should be as follows:
{{{
(O(5^3) + (2*5^-1 + O(5^0))*T + O(T^2), O(5^2) + O(5^-1)*T + O(T^2))*
[ 5/9 25/18]
[-5/18 5/9]
}}}
should be
{{{
(O(5^3) + O(5^0)*T + O(T^2), O(5^3) + O(5^0)*T + O(T^2))
}}}
Does this seem right? If this were the output of {{{Dp_valued_series}}},
then {{{EllipticCurve('53a1').sha().an_padic(5)}}} would increase the
precision of {{{Dp_valued_series}}} from 2 to 3 and run it again; I tested
this, and with this precision
{{{EllipticCurve('53a1').sha().an_padic(5)}}} succeeds (with the patch
applied!) and gives the expected answer.
So I believe the problem is a bug with power series over p-adics, rather
than with this patch or with the elliptic curves code. Does this seem
right to you? If so, one possible route at this stage is to modify the
{{{an_padic}}} code so that rather than throwing the error it first runs
another loop with additional precision, and then submit a separate trac
ticket for the p-adic problem. This is sort of dodging the issue, but
helps keep the individual bugs separated.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9457#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.