#2508: Problem converting a Laurent Series from pari to Sage
--------------------------+-------------------------------------------------
   Reporter:  cremona     |       Owner:  was                 
       Type:  defect      |      Status:  new                 
   Priority:  major       |   Milestone:  sage-4.6            
  Component:  interfaces  |    Keywords:  Laurent series, pari
     Author:              |    Upstream:  N/A                 
   Reviewer:              |      Merged:                      
Work_issues:              |  
--------------------------+-------------------------------------------------
Changes (by jdemeyer):

 * cc: jdemeyer (added)
  * priority:  minor => major
  * upstream:  => N/A
  * milestone:  sage-4.5.2 => sage-4.6


Old description:

> The elliptic curve function modular_parametrization() returns a list of
> two pari objects which are Laurent Series in x (of degrees -2, -3).  I
> wanted to convert these into proper Sage Laurent Series, but that does
> not work.  However if I invert these (so they have positive degree, i.e.
> are power series) then I can coerce them into the Laurent series ring,
> and then invert again!
>
> {{{
> sage: X = E=EllipticCurve('389a1').modular_parametrization()[0]
> sage: type(X)
> <type 'sage.libs.pari.gen.gen'>
> sage: X
> x^-2 + 2*x^-1 + 4 + 7*x + 13*x^2 + 18*x^3 + 31*x^4 + 49*x^5 + 74*x^6 +
> 111*x^7 + 173*x^8 + 251*x^9 + 379*x^10 + 560*x^11 + 824*x^12 + 1199*x^13
> + 1773*x^14 + O(x^15)
> sage: R=LaurentSeriesRing(QQ,'q')
> sage: R(X)
> ---------------------------------------------------------------------------
> <class 'sage.libs.pari.gen.PariError'>    Traceback (most recent call
> last)
>
> /home/jec/<ipython console> in <module>()
>
> /home/jec/sage-2.10.3/local/lib/python2.5/site-
> packages/sage/rings/laurent_series_ring.py in __call__(self, x, n)
>     182             return self.gen()**n * x
>     183         else:
> --> 184             return
> laurent_series_ring_element.LaurentSeries(self, x, n)
>     185
>     186     def _coerce_impl(self, x):
>
> /home/jec/laurent_series_ring_element.pyx in
> sage.rings.laurent_series_ring_element.LaurentSeries.__init__()
>
> /home/jec/sage-2.10.3/local/lib/python2.5/site-
> packages/sage/rings/power_series_ring.py in __call__(self, f, prec,
> check)
>     324             v = sage_eval(f.Eltseq())
>     325             return self(v) * (self.gen(0)**f.Valuation())
> --> 326         return self.__power_series_class(self, f, prec,
> check=check)
>     327
>     328     def construction(self):
>
> /home/jec/power_series_poly.pyx in
> sage.rings.power_series_poly.PowerSeries_poly.__init__()
>
> /home/jec/sage-2.10.3/local/lib/python2.5/site-
> packages/sage/rings/polynomial/polynomial_ring.py in __call__(self, x,
> check, is_gen, construct, absprec)
>     237         elif isinstance(x, pari_gen):
>     238             if x.type() != 't_POL':
> --> 239                 x = x.Polrev()
>     240
>     241         C = self.__polynomial_class
>
> /home/jec/gen.pyx in sage.libs.pari.gen._pari_trap()
>
> <class 'sage.libs.pari.gen.PariError'>:  (8)
> sage: 1/R(1/X)
> q^-2 + 2*q^-1 + 4 + 7*q + 13*q^2 + 18*q^3 + 31*q^4 + 49*q^5 + 74*q^6 +
> 111*q^7 + 173*q^8 + 251*q^9 + 379*q^10 + 560*q^11 + 824*q^12 + 1199*q^13
> + 1773*q^14 + 2365*q^15 + 3463*q^16 + 4508*q^17 + O(q^18)
> }}}

New description:

 It seems that PARI laurent series can only be converted to Sage
 LaurentSeries if the valuation is >= 0.

 Simple example:
 {{{
 sage: R = LaurentSeriesRing(QQ, 'q')
 sage: R(pari('1/x'))
 0                       # Very wrong
 sage: R(pari('1/x + O(x^20)'))
 Traceback (most recent call last)
 [...]
 PariError:  (5)
 }}}

 Example from John Cremona:
 {{{
 sage: E = EllipticCurve('11a1')
 sage: R = LaurentSeriesRing(RationalField(),'q')
 sage: XY = E.pari_mincurve().elltaniyama()
 sage: [R(XY[0]),R(XY[1])]
 }}}

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2508#comment:4>
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.

Reply via email to