# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1296140175 3600
# Node ID 65f9ee74bab783e5fe303af748f0b6840525128d
# Parent ba96e49c19b5a372574359b189ad7d927ed3efd0
#4376: Avoid strings in conversion of power series to PARI
diff r ba96e49c19b5 r 65f9ee74bab7 sage/rings/power_series_ring_element.pyx
a

b


112  112  import rational_field, integer_ring 
113  113  from integer import Integer 
114  114  from sage.rings.finite_rings.integer_mod_ring import IntegerModRing 
115   import sage.libs.pari.all 
 115  from sage.libs.pari.all import pari 
116  116  from sage.libs.all import PariError 
117  117  from sage.misc.functional import sqrt, log 
118  118  from sage.rings.arith import integer_ceil as ceil 
… 
… 

1737  1737  sage: R.<x> = Zmod(6)[[]] 
1738  1738  sage: pari(1 + x + 8*x^3 + O(x^8)) # indirect doctest 
1739  1739  Mod(1, 6) + Mod(1, 6)*x + Mod(2, 6)*x^3 + O(x^8) 
 1740  
 1741  TESTS:: 
 1742  
 1743  sage: pari(1 + O(x^1)) 
 1744  Mod(1, 6) + O(x) 
 1745  sage: pari(O(x^1)) 
 1746  O(x) 
 1747  sage: pari(O(x^0)) 
 1748  O(1) 
1740  1749  """ 
1741  1750  n = self.prec() 
1742  1751  if n is infinity: 
1743  1752  raise ValueError, "series precision must be finite for conversion to pari object." 
1744   s = '+'.join([str(self.truncate()._pari_()), 'O(%s^%s)' % (self.variable(), n)]) 
1745   return sage.libs.pari.all.pari(s) 
 1753  s = self.truncate()._pari_() # PARI polynomial 
 1754  s += pari('O(%s^%d)' % (s.variable(), n)) # PARI series 
 1755  return s 
1746  1756  
1747  1757  def _solve_linear_de(R, N, L, a, b, f0): 
1748  1758  r""" 