#9457: power series equality fails when trailing coefficients are zero
-------------------------------------+-------------------------------------
       Reporter:  niles              |        Owner:  malb
           Type:  defect             |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.1
      Component:  commutative        |   Resolution:
  algebra                            |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:  niles              |  Work issues:  resolve problems with
Report Upstream:  N/A                |  sha_tate.py
         Branch:                     |       Commit:
  u/niles/ticket/9457                |  e2219602a9d360f465ad79b098e4f923765ab791
   Dependencies:                     |     Stopgaps:  #15748
-------------------------------------+-------------------------------------

Comment (by niles):

 Replying to [comment:26 wuthrich]:
 > Of course, I offer my help with this as I am at the origin of the code
 that causes troubles.

 Thanks :)  The last real progress I made in understanding this is up in
 comments [comment:13] and [comment:14], where I worked through the
 offending doctest by hand -- see
 
[https://github.com/sagemath/sage/blob/master/src/sage/schemes/elliptic_curves/sha_tate.py#L632
 the block starting on line 632].

 One helpful thing would be to verify the calculations below:

 Using the objects constructed in comment [comment:13], sage says

 {{{
 sage: G
 O(5^3) + (2*5^-1 + O(5^0))*T + O(T^2)
 sage: H
 O(T^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]
 }}}

 I think that `H` is not correct, as it it built from the following list of
 coefficients
 {{{
 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)]
 }}}

 So I think the correct value should be `H = O(5^2) + O(5^-1)*T + O(T^2)`
 and hence
 `-R(p) * H = O(5^3) + O(5^0)*T + O(T^2)`.  Converting `eps.transpose()` to
 the 5-adics `R`, so that I can check `lpv * eps.transpose()` by hand, I
 have

 {{{
 sage: Matrix(R,2,2,[R(_) for _ in eps.transpose().list()])
 [      4*5 + 2*5^2 + 5^4 + 2*5^5 + O(5^6)     2*5^2 + 5^3 + 3*5^5 + 3*5^6
 + O(5^7)]
 [3*5 + 3*5^2 + 4*5^3 + 5^4 + 5^5 + O(5^6)       4*5 + 2*5^2 + 5^4 + 2*5^5
 + O(5^6)]
 }}}

 Therefore `lpv * eps.transpose()` should be
 {{{
 ( O(5^3) + (3 + O(5))*T + O(T^2) , O(5^4) + O(5^1)*T + O(T^2) )
 }}}

 Can you verify these calculations, and verify that if this were the output
 of `lpv*eps.transpose()`, then the rest of the code would work correctly
 and return `1`, as expected?  (I think I was confused about this last
 point when I made my comment [comment:14]; but this value for `lpv *
 eps.transpose()` should make `shan0 = 1` and `shan1 = 0`, and if I read
 the rest of that block correctly then this will lead to the expected
 output).


 ----------

 If the analysis above is right, then the only problem remaining to solve
 is why `H` is not computed correctly.  The problem seems to be that the
 power series ring over p-adics does not keep track of negative precision
 when there are no non-zero coefficients:

 {{{
 sage: R(0).add_bigoh(-1)
 O(5^-1)
 sage: QpT(R(0).add_bigoh(-1))
 0   # should be same as line above

 sage: QpT(1/25 + R(0).add_bigoh(-1))
 5^-2 + O(5^-1)  # precision remembered when non-zero coefficients are
 present
 }}}

 I guess there is some problem with positive precision too:
 {{{
 sage: QpT(R(0).add_bigoh(1))
 0
 sage: QpT(1 + R(0).add_bigoh(1))
 1 + O(5)
 }}}

 Is this issue already part of one of the other padic bug tickets?

--
Ticket URL: <http://trac.sagemath.org/ticket/9457#comment:27>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to