Ticket #12173: trac_12173-doctests.patch

File trac_12173-doctests.patch, 27.3 KB (added by jpflori, 9 years ago)

Doctests.

  • sage/combinat/q_bernoulli.pyx

    # HG changeset patch
    # User Jean-Pierre Flori <jean-pierre.flor@ssi.gouv.fr>
    # Date 1366023901 -7200
    # Node ID 3c7e27b3171e0ec27b3e4ace438df1c0fd799397
    # Parent  0b229842ac297897b5ce8a4decd380dd6a8fe1da
    #12173: doctests
    
    diff --git a/sage/combinat/q_bernoulli.pyx b/sage/combinat/q_bernoulli.pyx
    a b  
    2929        sage: q_bernoulli(0)
    3030        1
    3131        sage: q_bernoulli(1)
    32         1/(-q - 1)
     32        -1/(q + 1)
    3333        sage: q_bernoulli(2)
    3434        q/(q^3 + 2*q^2 + 2*q + 1)
    3535        sage: all(q_bernoulli(i)(q=1)==bernoulli(i) for i in range(12))
  • sage/combinat/sf/jack.py

    diff --git a/sage/combinat/sf/jack.py b/sage/combinat/sf/jack.py
    a b  
    334334
    335335            sage: s = Sym.schur()
    336336            sage: JJ(s([3])) # indirect doctest
    337             ((-t^2+3*t-2)/(-6*t^2-18*t-12))*JackJ[1, 1, 1] + ((2*t-2)/(2*t^2+5*t+2))*JackJ[2, 1] + (1/(2*t^2+3*t+1))*JackJ[3]
     337            ((t^2-3*t+2)/(6*t^2+18*t+12))*JackJ[1, 1, 1] + ((2*t-2)/(2*t^2+5*t+2))*JackJ[2, 1] + (1/(2*t^2+3*t+1))*JackJ[3]
    338338            sage: JJ(s([2,1]))
    339339            ((t-1)/(3*t+6))*JackJ[1, 1, 1] + (1/(t+2))*JackJ[2, 1]
    340340            sage: JJ(s([1,1,1]))
     
    367367            sage: a.scalar(JP([1,1]))
    368368            0
    369369            sage: JP(JQp([2]))                        # todo: missing auto normalization
    370             ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2]
     370            ((t-1)/(t+1))*JackP[1, 1] + JackP[2]
    371371            sage: JP._normalize(JP(JQp([2])))
    372             ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2]
     372            ((t-1)/(t+1))*JackP[1, 1] + JackP[2]
    373373        """
    374374        return JackPolynomials_qp(self)
    375375
     
    572572        0
    573573        sage: s = P.realization_of().s()
    574574        sage: P(Qp([2]))                        # todo: missing auto normalization
    575         ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2]
     575        ((t-1)/(t+1))*JackP[1, 1] + JackP[2]
    576576        sage: P._normalize(P(Qp([2])))
    577         ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2]
     577        ((t-1)/(t+1))*JackP[1, 1] + JackP[2]
    578578    """
    579579    (R, t) = NoneConvention(R, t)
    580580    sage.misc.superseded.deprecation(5457, "Deprecation warning: In the future use SymmetricFunctions(R).jack(t=%s).Qp()"%(t))
     
    943943
    944944            sage: JJ = SymmetricFunctions(FractionField(QQ['t'])).jack().J()
    945945            sage: JJ([1])^2              # indirect doctest
    946             (-t/(-t-1))*JackJ[1, 1] + (1/(t+1))*JackJ[2]
     946            (t/(t+1))*JackJ[1, 1] + (1/(t+1))*JackJ[2]
    947947            sage: JJ([2])^2
    948             (-2*t^2/(-2*t^2-3*t-1))*JackJ[2, 2] + (-4*t/(-3*t^2-4*t-1))*JackJ[3, 1] + ((t+1)/(6*t^2+5*t+1))*JackJ[4]
     948            (2*t^2/(2*t^2+3*t+1))*JackJ[2, 2] + (4*t/(3*t^2+4*t+1))*JackJ[3, 1] + ((t+1)/(6*t^2+5*t+1))*JackJ[4]
    949949            sage: JQ = SymmetricFunctions(FractionField(QQ['t'])).jack().Q()
    950950            sage: JQ([1])^2              # indirect doctest
    951951            JackQ[1, 1] + (2/(t+1))*JackQ[2]
     
    992992
    993993            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
    994994            sage: Sym.jack().P()[2,2].coproduct() #indirect doctest
    995             JackP[] # JackP[2, 2] + (2/(t+1))*JackP[1] # JackP[2, 1] + ((-8*t-4)/(-t^3-4*t^2-5*t-2))*JackP[1, 1] # JackP[1, 1] + JackP[2] # JackP[2] + (2/(t+1))*JackP[2, 1] # JackP[1] + JackP[2, 2] # JackP[]
     995            JackP[] # JackP[2, 2] + (2/(t+1))*JackP[1] # JackP[2, 1] + ((8*t+4)/(t^3+4*t^2+5*t+2))*JackP[1, 1] # JackP[1, 1] + JackP[2] # JackP[2] + (2/(t+1))*JackP[2, 1] # JackP[1] + JackP[2, 2] # JackP[]
    996996        """
    997997        from sage.categories.tensor import tensor
    998998        s = self.realization_of().schur()
     
    11121112            sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())]
    11131113            sage: JP._m_cache(2)
    11141114            sage: l(JP._self_to_m_cache[2])
    1115             [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], -2/(-t - 1)), ([2], 1)])]
     1115            [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], 2/(t + 1)), ([2], 1)])]
    11161116            sage: l(JP._m_to_self_cache[2])
    1117             [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], 2/(-t - 1)), ([2], 1)])]
     1117            [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], -2/(t + 1)), ([2], 1)])]
    11181118            sage: JP._m_cache(3)
    11191119            sage: l(JP._m_to_self_cache[3])
    11201120            [([1, 1, 1], [([1, 1, 1], 1)]),
    11211121             ([2, 1], [([1, 1, 1], -6/(t + 2)), ([2, 1], 1)]),
    1122              ([3], [([1, 1, 1], -6/(-t^2 - 3*t - 2)), ([2, 1], -3/(2*t + 1)), ([3], 1)])]
     1122             ([3], [([1, 1, 1], 6/(t^2 + 3*t + 2)), ([2, 1], -3/(2*t + 1)), ([3], 1)])]
    11231123            sage: l(JP._self_to_m_cache[3])
    11241124            [([1, 1, 1], [([1, 1, 1], 1)]),
    11251125             ([2, 1], [([1, 1, 1], 6/(t + 2)), ([2, 1], 1)]),
    1126              ([3], [([1, 1, 1], -6/(-2*t^2 - 3*t - 1)), ([2, 1], 3/(2*t + 1)), ([3], 1)])]
     1126             ([3], [([1, 1, 1], 6/(2*t^2 + 3*t + 1)), ([2, 1], 3/(2*t + 1)), ([3], 1)])]
    11271127        """
    11281128        if n in self._self_to_m_cache:
    11291129            return
     
    11901190            sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P()
    11911191            sage: m = JP.symmetric_function_ring().m()
    11921192            sage: JP([1])^2 # indirect doctest
    1193             (-2*t/(-t-1))*JackP[1, 1] + JackP[2]
     1193            (2*t/(t+1))*JackP[1, 1] + JackP[2]
    11941194            sage: m(_)
    11951195            2*m[1, 1] + m[2]
    11961196            sage: JP = SymmetricFunctions(QQ).jack(t=2).P()
     
    13901390            sage: JQp = SymmetricFunctions(FractionField(QQ['t'])).jack().Qp()
    13911391            sage: h = JQp.symmetric_function_ring().h()
    13921392            sage: JQp([1])^2 # indirect doctest
    1393             JackQp[1, 1] + (-2/(-t-1))*JackQp[2]
     1393            JackQp[1, 1] + (2/(t+1))*JackQp[2]
    13941394            sage: h(_)
    13951395            h[1, 1]
    13961396            sage: JQp = SymmetricFunctions(QQ).jack(t=2).Qp()
     
    14191419            sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())]
    14201420            sage: JQp._h_cache(2)
    14211421            sage: l(JQp._self_to_h_cache[2])
    1422             [([1, 1], [([1, 1], 1), ([2], 2/(-t - 1))]), ([2], [([2], 1)])]
     1422            [([1, 1], [([1, 1], 1), ([2], -2/(t + 1))]), ([2], [([2], 1)])]
    14231423            sage: l(JQp._h_to_self_cache[2])
    1424             [([1, 1], [([1, 1], 1), ([2], -2/(-t - 1))]), ([2], [([2], 1)])]
     1424            [([1, 1], [([1, 1], 1), ([2], 2/(t + 1))]), ([2], [([2], 1)])]
    14251425            sage: JQp._h_cache(3)
    14261426            sage: l(JQp._h_to_self_cache[3])
    1427             [([1, 1, 1], [([1, 1, 1], 1), ([2, 1], 6/(t + 2)), ([3], -6/(-2*t^2 - 3*t - 1))]), ([2, 1], [([2, 1], 1), ([3], 3/(2*t + 1))]), ([3], [([3], 1)])]
     1427            [([1, 1, 1], [([1, 1, 1], 1), ([2, 1], 6/(t + 2)), ([3], 6/(2*t^2 + 3*t + 1))]), ([2, 1], [([2, 1], 1), ([3], 3/(2*t + 1))]), ([3], [([3], 1)])]
    14281428            sage: l(JQp._self_to_h_cache[3])
    1429             [([1, 1, 1], [([1, 1, 1], 1), ([2, 1], -6/(t + 2)), ([3], -6/(-t^2 - 3*t - 2))]), ([2, 1], [([2, 1], 1), ([3], -3/(2*t + 1))]), ([3], [([3], 1)])]
     1429            [([1, 1, 1], [([1, 1, 1], 1), ([2, 1], -6/(t + 2)), ([3], 6/(t^2 + 3*t + 2))]), ([2, 1], [([2, 1], 1), ([3], -3/(2*t + 1))]), ([3], [([3], 1)])]
    14301430        """
    14311431        if n in self._self_to_h_cache:
    14321432            return
     
    15201520            sage: Sym = SymmetricFunctions(QQ['t'].fraction_field())
    15211521            sage: JQp = Sym.jack().Qp()
    15221522            sage: JQp[2,2].coproduct()   #indirect doctest
    1523             JackQp[] # JackQp[2, 2] + (2*t/(t+1))*JackQp[1] # JackQp[2, 1] + JackQp[1, 1] # JackQp[1, 1] + ((-4*t^3-8*t^2)/(-2*t^3-5*t^2-4*t-1))*JackQp[2] # JackQp[2] + (2*t/(t+1))*JackQp[2, 1] # JackQp[1] + JackQp[2, 2] # JackQp[]
     1523            JackQp[] # JackQp[2, 2] + (2*t/(t+1))*JackQp[1] # JackQp[2, 1] + JackQp[1, 1] # JackQp[1, 1] + ((4*t^3+8*t^2)/(2*t^3+5*t^2+4*t+1))*JackQp[2] # JackQp[2] + (2*t/(t+1))*JackQp[2, 1] # JackQp[1] + JackQp[2, 2] # JackQp[]
    15241524        """
    15251525        h = elt.parent().realization_of().h()
    15261526        parent = elt.parent()
  • sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py

    diff --git a/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py b/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py
    a b  
    2727class Polynomial_padic_capped_relative_dense(Polynomial_generic_domain):
    2828    def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, absprec = infinity, relprec = infinity):
    2929        """
    30         TESTS:
     30        TESTS::
     31
    3132            sage: K = Qp(13,7)
    3233            sage: R.<t> = K[]
    3334            sage: R([K(13), K(1)])
     
    183184        """
    184185        Recomputes the list of coefficients.
    185186
    186         EXAMPLES:
    187         sage: K = Qp(13,7)
    188         sage: R.<t> = K[]
    189         sage: a = t[0:1]
    190         sage: a._comp_list()
    191         sage: a
    192         0
     187        EXAMPLES::
     188
     189            sage: K = Qp(13,7)
     190            sage: R.<t> = K[]
     191            sage: a = t[0:1]
     192            sage: a._comp_list()
     193            sage: a
     194            0
    193195        """
    194196        if self.degree() == -1 and self._valbase == infinity:
    195197            self._list = []
     
    283285        than expected since it includes any leading zeros
    284286        that have finite absolute precision.
    285287
    286         EXAMPLES:
    287         sage: K = Qp(13,7)
    288         sage: R.<t> = K[]       
    289         sage: a = 2*t^3 + 169*t - 1
    290         sage: a
    291         (2 + O(13^7))*t^3 + (13^2 + O(13^9))*t + (12 + 12*13 + 12*13^2 + 12*13^3 + 12*13^4 + 12*13^5 + 12*13^6 + O(13^7))
    292         sage: a.list()
    293         [12 + 12*13 + 12*13^2 + 12*13^3 + 12*13^4 + 12*13^5 + 12*13^6 + O(13^7),
    294          13^2 + O(13^9),
    295          0,
    296          2 + O(13^7)]
     288        EXAMPLES::
     289
     290            sage: K = Qp(13,7)
     291            sage: R.<t> = K[]       
     292            sage: a = 2*t^3 + 169*t - 1
     293            sage: a
     294            (2 + O(13^7))*t^3 + (13^2 + O(13^9))*t + (12 + 12*13 + 12*13^2 + 12*13^3 + 12*13^4 + 12*13^5 + 12*13^6 + O(13^7))
     295            sage: a.list()
     296            [12 + 12*13 + 12*13^2 + 12*13^3 + 12*13^4 + 12*13^5 + 12*13^6 + O(13^7),
     297            13^2 + O(13^9),
     298            0,
     299            2 + O(13^7)]
    297300         """
    298301
    299302        if self._list is None:
     
    302305
    303306    def _repr(self, name=None):
    304307        """
    305         TESTS:
     308        TESTS::
     309
    306310            sage: k = Qp(5,10)
    307311            sage: R.<x> = k[]
    308312            sage: f = R([k(0,-3), 0, k(0,-1)]); f
     
    349353
    350354        The content of the exact zero polynomial is zero.
    351355
    352         EXAMPLES:
    353         sage: K = Zp(13,7)
    354         sage: R.<t> = K[]       
    355         sage: a = 13^7*t^3 + K(169,4)*t - 13^4
    356         sage: a.content()
    357         13^2 + O(13^9)
    358         sage: R(0).content()
    359         0
    360         sage: P.<x> = ZZ[]
    361         sage: f = x + 2
    362         sage: f.content()
    363         1
    364         sage: fp = f.change_ring(pAdicRing(2, 10))
    365         sage: fp
    366         (1 + O(2^10))*x + (2 + O(2^11))
    367         sage: fp.content()
    368         1 + O(2^10)
    369         sage: (2*fp).content()
    370         2 + O(2^11)
     356        EXAMPLES::
     357
     358            sage: K = Zp(13,7)
     359            sage: R.<t> = K[]       
     360            sage: a = 13^7*t^3 + K(169,4)*t - 13^4
     361            sage: a.content()
     362            13^2 + O(13^9)
     363            sage: R(0).content()
     364            0
     365            sage: P.<x> = ZZ[]
     366            sage: f = x + 2
     367            sage: f.content()
     368            1
     369            sage: fp = f.change_ring(pAdicRing(2, 10))
     370            sage: fp
     371            (1 + O(2^10))*x + (2 + O(2^11))
     372            sage: fp.content()
     373            1 + O(2^10)
     374            sage: (2*fp).content()
     375            2 + O(2^11)
    371376        """
    372377        if self.base_ring().is_field():
    373378            raise TypeError, "ground ring is a field.  Answer is only defined up to units."
     
    385390              the same coefficients (ie same values and precisions): it will depend on how
    386391              the polynomials are created.
    387392
    388         EXAMPLES:
    389         sage: K = Qp(13,7)
    390         sage: R.<t> = K[]       
    391         sage: a = 13^7*t^3 + K(169,4)*t - 13^4
    392         sage: a.lift()
    393         62748517*t^3 + 169*t - 28561
     393        EXAMPLES::
     394
     395            sage: K = Qp(13,7)
     396            sage: R.<t> = K[]       
     397            sage: a = 13^7*t^3 + K(169,4)*t - 13^4
     398            sage: a.lift()
     399            62748517*t^3 + 169*t - 28561
    394400        """
    395401        return self.base_ring().prime_pow(self._valbase) * self._poly
    396402
     
    401407
    402408        EXAMPLES::
    403409
    404         sage: K = Qp(13,7)
    405         sage: R.<t> = K[]
    406         sage: a = 13^7*t^3 + K(169,4)*t - 13^4
    407         sage: a[1]
    408         13^2 + O(13^4)
    409         sage: a[1:2]
    410         (13^2 + O(13^4))*t
     410            sage: K = Qp(13,7)
     411            sage: R.<t> = K[]
     412            sage: a = 13^7*t^3 + K(169,4)*t - 13^4
     413            sage: a[1]
     414            13^2 + O(13^4)
     415            sage: a[1:2]
     416            (13^2 + O(13^4))*t
    411417        """
    412418        if isinstance(n, slice):
    413419            start, stop = n.start, n.stop
     
    445451        """
    446452        Returns the sum of self and right.
    447453
    448         EXAMPLES:
    449         sage: K = Qp(13,7)
    450         sage: R.<t> = K[]       
    451         sage: a = t^4 + 17*t^2 + 1
    452         sage: b = -t^4 + 9*t^2 + 13*t - 1
    453         sage: c = a + b; c
    454         (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7))
    455         sage: c.list()
    456         [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)]
     454        EXAMPLES::
     455
     456            sage: K = Qp(13,7)
     457            sage: R.<t> = K[]       
     458            sage: a = t^4 + 17*t^2 + 1
     459            sage: b = -t^4 + 9*t^2 + 13*t - 1
     460            sage: c = a + b; c
     461            (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7))
     462            sage: c.list()
     463            [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)]
    457464        """
    458465        selfpoly = self._poly
    459466        rightpoly = right._poly
     
    478485        """
    479486        Returns the sum of self and right.
    480487
    481         EXAMPLES:
    482         sage: K = Qp(13,7)
    483         sage: R.<t> = K[]       
    484         sage: a = t^4 + 17*t^2 + 1
    485         sage: b = t^4 - 9*t^2 - 13*t + 1
    486         sage: c = a - b; c
    487         (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7))
    488         sage: c.list()
    489         [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)]
     488        EXAMPLES::
     489
     490            sage: K = Qp(13,7)
     491            sage: R.<t> = K[]       
     492            sage: a = t^4 + 17*t^2 + 1
     493            sage: b = t^4 - 9*t^2 - 13*t + 1
     494            sage: c = a - b; c
     495            (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7))
     496            sage: c.list()
     497            [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)]
    490498        """
    491499        selfpoly = self._poly
    492500        rightpoly = right._poly
     
    549557        may very well change as we do more tests on the relative time
    550558        requirements of these operations.
    551559
    552         EXAMPLES:
    553         sage: K = Qp(13,7)
    554         sage: R.<t> = K[]       
    555         sage: a = t^4 + 17*t^2 + 1
    556         sage: b = -t^4 + 9*t^2 + 13*t - 1
    557         sage: c = a + b; c
    558         (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7))
    559         sage: d = R([K(1,4), K(2, 6), K(1, 5)]); d
    560         (1 + O(13^5))*t^2 + (2 + O(13^6))*t + (1 + O(13^4))
    561         sage: e = c * d; e
    562         (O(13^7))*t^6 + (O(13^7))*t^5 + (2*13 + O(13^6))*t^4 + (5*13 + O(13^6))*t^3 + (4*13 + O(13^5))*t^2 + (13 + O(13^5))*t + (O(13^7))
    563         sage: e.list()
    564         [O(13^7),
    565          13 + O(13^5),
    566          4*13 + O(13^5),
    567          5*13 + O(13^6),
    568          2*13 + O(13^6),
    569          O(13^7),
    570          O(13^7)]
     560        EXAMPLES::
     561
     562            sage: K = Qp(13,7)
     563            sage: R.<t> = K[]       
     564            sage: a = t^4 + 17*t^2 + 1
     565            sage: b = -t^4 + 9*t^2 + 13*t - 1
     566            sage: c = a + b; c
     567            (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7))
     568            sage: d = R([K(1,4), K(2, 6), K(1, 5)]); d
     569            (1 + O(13^5))*t^2 + (2 + O(13^6))*t + (1 + O(13^4))
     570            sage: e = c * d; e
     571            (O(13^7))*t^6 + (O(13^7))*t^5 + (2*13 + O(13^6))*t^4 + (5*13 + O(13^6))*t^3 + (4*13 + O(13^5))*t^2 + (13 + O(13^5))*t + (O(13^7))
     572            sage: e.list()
     573            [O(13^7),
     574            13 + O(13^5),
     575            4*13 + O(13^5),
     576            5*13 + O(13^6),
     577            2*13 + O(13^6),
     578            O(13^7),
     579            O(13^7)]
    571580        """
    572581        self._normalize()
    573582        right._normalize()
     
    591600        """
    592601        Returns self multiplied by a constant
    593602
    594         EXAMPLES:
    595         sage: K = Qp(13,7)
    596         sage: R.<t> = K[]
    597         sage: a = t^4 + K(13,5)*t^2 + 13
    598         sage: K(13,7) * a
    599         (13 + O(13^7))*t^4 + (13^2 + O(13^6))*t^2 + (13^2 + O(13^8))
     603        EXAMPLES::
     604
     605            sage: K = Qp(13,7)
     606            sage: R.<t> = K[]
     607            sage: a = t^4 + K(13,5)*t^2 + 13
     608            sage: K(13,7) * a
     609            (13 + O(13^7))*t^4 + (13^2 + O(13^6))*t^2 + (13^2 + O(13^8))
    600610        """
    601611        return None
    602612        # The code below has never been tested and is somehow subtly broken.
     
    617627        """
    618628        Returns the negation of self.
    619629
    620         EXAMPLES:
    621         sage: K = Qp(13,2)
    622         sage: R.<t> = K[]
    623         sage: a = t^4 + 13*t^2 + 4
    624         sage: -a
    625         (12 + 12*13 + O(13^2))*t^4 + (12*13 + 12*13^2 + O(13^3))*t^2 + (9 + 12*13 + O(13^2))
     630        EXAMPLES::
     631
     632            sage: K = Qp(13,2)
     633            sage: R.<t> = K[]
     634            sage: a = t^4 + 13*t^2 + 4
     635            sage: -a
     636            (12 + 12*13 + O(13^2))*t^4 + (12*13 + 12*13^2 + O(13^3))*t^2 + (9 + 12*13 + O(13^2))
    626637        """
    627638        return Polynomial_padic_capped_relative_dense(self.parent(), (-self._poly, self._valbase, self._relprecs, False, self._valaddeds, None), construct = True)
    628639
     
    630641        """
    631642        Returns a new polynomials whose coefficients are multiplied by p^shift.
    632643
    633         EXAMPLES:
    634         sage: K = Qp(13, 4)
    635         sage: R.<t> = K[]
    636         sage: a = t + 52
    637         sage: a.lshift_coeffs(3)
    638         (13^3 + O(13^7))*t + (4*13^4 + O(13^8))
     644        EXAMPLES::
     645
     646            sage: K = Qp(13, 4)
     647            sage: R.<t> = K[]
     648            sage: a = t + 52
     649            sage: a.lshift_coeffs(3)
     650            (13^3 + O(13^7))*t + (4*13^4 + O(13^8))
    639651        """
    640652        if shift < 0:
    641653            return self.rshift_coeffs(-shift, no_list)
     
    651663
    652664        NOTES: Type Qp(5)(0).__rshift__? for more information.
    653665
    654         EXAMPLES:
    655         sage: K = Zp(13, 4)
    656         sage: R.<t> = K[]
    657         sage: a = t^2 + K(13,3)*t + 169; a
    658         (1 + O(13^4))*t^2 + (13 + O(13^3))*t + (13^2 + O(13^6))
    659         sage: b = a.rshift_coeffs(1); b
    660         (O(13^3))*t^2 + (1 + O(13^2))*t + (13 + O(13^5))
    661         sage: b.list()
    662         [13 + O(13^5), 1 + O(13^2), O(13^3)]
    663         sage: b = a.rshift_coeffs(2); b
    664         (O(13^2))*t^2 + (O(13))*t + (1 + O(13^4))
    665         sage: b.list()
    666         [1 + O(13^4), O(13), O(13^2)]
     666        EXAMPLES::
     667
     668            sage: K = Zp(13, 4)
     669            sage: R.<t> = K[]
     670            sage: a = t^2 + K(13,3)*t + 169; a
     671            (1 + O(13^4))*t^2 + (13 + O(13^3))*t + (13^2 + O(13^6))
     672            sage: b = a.rshift_coeffs(1); b
     673            (O(13^3))*t^2 + (1 + O(13^2))*t + (13 + O(13^5))
     674            sage: b.list()
     675            [13 + O(13^5), 1 + O(13^2), O(13^3)]
     676            sage: b = a.rshift_coeffs(2); b
     677            (O(13^2))*t^2 + (O(13))*t + (1 + O(13^4))
     678            sage: b.list()
     679            [1 + O(13^4), O(13), O(13^2)]
    667680        """
    668681        if shift < 0:
    669682            return self.lshift_coeffs(-shift, no_list) # We can't just absorb this into the next if statement because we allow rshift to preserve _normalized
     
    763776        Returns the degree of self, i.e., the largest $n$ so that the
    764777        coefficient of $x^n$ does not compare equal to $0$.
    765778
    766         EXAMPLES:
     779        EXAMPLES::
     780
    767781            sage: K = Qp(3,10)
    768782            sage: x = O(3^5)
    769783            sage: li =[3^i * x for i in range(0,5)]; li
     
    873887        If n is None, defaults to the degree of self.
    874888        If n is smaller than the degree of self, some coefficients will be discarded.
    875889
    876         EXAMPLES:
    877         sage: K = Qp(13,7)
    878         sage: R.<t> = K[]
    879         sage: f = t^3 + 4*t; f
    880         (1 + O(13^7))*t^3 + (4 + O(13^7))*t
    881         sage: f.reverse()
    882         (4 + O(13^7))*t^2 + (1 + O(13^7))
    883         sage: f.reverse(3)
    884         (4 + O(13^7))*t^2 + (1 + O(13^7))
    885         sage: f.reverse(2)
    886         (4 + O(13^7))*t
    887         sage: f.reverse(4)
    888         (4 + O(13^7))*t^3 + (1 + O(13^7))*t
    889         sage: f.reverse(6)
    890         (4 + O(13^7))*t^5 + (1 + O(13^7))*t^3
     890        EXAMPLES::
     891
     892            sage: K = Qp(13,7)
     893            sage: R.<t> = K[]
     894            sage: f = t^3 + 4*t; f
     895            (1 + O(13^7))*t^3 + (4 + O(13^7))*t
     896            sage: f.reverse()
     897            (4 + O(13^7))*t^2 + (1 + O(13^7))
     898            sage: f.reverse(3)
     899            (4 + O(13^7))*t^2 + (1 + O(13^7))
     900            sage: f.reverse(2)
     901            (4 + O(13^7))*t
     902            sage: f.reverse(4)
     903            (4 + O(13^7))*t^3 + (1 + O(13^7))*t
     904            sage: f.reverse(6)
     905            (4 + O(13^7))*t^5 + (1 + O(13^7))*t^3
    891906        """
    892907        if n is None:
    893908            n = self._poly.degree()
     
    913928
    914929        NOTE:  Need to write this function for integer polynomials before this works.
    915930
    916         EXAMPLES:
     931        EXAMPLES::
     932
    917933            sage: K = Zp(13, 5)
    918934            sage: R.<t> = K[]
    919935            sage: f = t^3 + K(13, 3) * t
     
    9901006        """
    9911007        Returns a list of the Newton slopes of this polynomial.  These are the valuations of the roots of this polynomial.
    9921008
    993         EXAMPLES:
    994         sage: K = Qp(13)
    995         sage: R.<t> = K[]
    996         sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7
    997         sage: f.newton_polygon()
    998         [(0, 7), (1, 2), (4, 0)]
    999         sage: f.newton_slopes()
    1000         [5, 2/3, 2/3, 2/3]
     1009        EXAMPLES::
     1010
     1011            sage: K = Qp(13)
     1012            sage: R.<t> = K[]
     1013            sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7
     1014            sage: f.newton_polygon()
     1015            [(0, 7), (1, 2), (4, 0)]
     1016            sage: f.newton_slopes()
     1017            [5, 2/3, 2/3, 2/3]
    10011018        """
    10021019        polygon = self.newton_polygon()
    10031020        if polygon == []:
     
    10161033        NOTES:
    10171034        The vertices are listed so that the first coordinates are strictly increasing, up to the polynomial's degree (not the limit of available precision information).  Also note that if some coefficients have very low precision an error is raised.
    10181035
    1019         EXAMPLES:
    1020         sage: K = Qp(13)
    1021         sage: R.<t> = K[]
    1022         sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7
    1023         sage: f.newton_polygon()
    1024         [(0, 7), (1, 2), (4, 0)]
     1036        EXAMPLES::
     1037
     1038            sage: K = Qp(13)
     1039            sage: R.<t> = K[]
     1040            sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7
     1041            sage: f.newton_polygon()
     1042            [(0, 7), (1, 2), (4, 0)]
    10251043        """
    10261044        if self._poly == 0:
    10271045            return []
  • sage/rings/polynomial/polynomial_integer_dense_flint.pyx

    diff --git a/sage/rings/polynomial/polynomial_integer_dense_flint.pyx b/sage/rings/polynomial/polynomial_integer_dense_flint.pyx
    a b  
    260260
    261261    def __call__(self, *x, **kwds):
    262262        """
    263         Calls this polynomial with the given parameters, which can be 
    264         interpreted as polynomial composition or evaluation by this 
     263        Calls this polynomial with the given parameters, which can be
     264        interpreted as polynomial composition or evaluation by this
    265265        method.
    266266
    267         If the argument is not simply an integer (``int``, ``long`` or 
    268         ``Integer``) or a polynomial (of the same type as ``self``), 
    269         the call is passed on to the generic implementation in the 
     267        If the argument is not simply an integer (``int``, ``long`` or
     268        ``Integer``) or a polynomial (of the same type as ``self``),
     269        the call is passed on to the generic implementation in the
    270270        ``Polynomial`` class.
    271271
    272272        EXAMPLES:
    273273
    274274        The first example illustrates polynomial composition::
    275        
     275
    276276            sage: R.<t> = ZZ[]
    277277            sage: f = t^2 - 1
    278278            sage: g = t + 1
    279279            sage: f(g)          # indirect doctest
    280280            t^2 + 2*t
    281                
    282         Now we illustrate how a polynomial can be evaluated at an 
     281
     282        Now we illustrate how a polynomial can be evaluated at an
    283283        integer::
    284        
     284
    285285            sage: f(2)          # indirect doctest
    286286            3
    287287        """
     
    291291        cdef unsigned long limbs
    292292        cdef fmpz_t a_fmpz
    293293        cdef fmpz_t z_fmpz
    294        
    295         if len(x) == 1: 
     294
     295        if len(x) == 1:
    296296            x0 = x[0]
    297297            if isinstance(x, Polynomial_integer_dense_flint):
    298298                f = self._new()
  • sage/rings/polynomial/polynomial_zmod_flint.pyx

    diff --git a/sage/rings/polynomial/polynomial_zmod_flint.pyx b/sage/rings/polynomial/polynomial_zmod_flint.pyx
    a b  
    497497        EXAMPLES::
    498498
    499499            sage: P.<a>=GF(7)[]
    500             sage: a = P(range(10)); b = P(range(5, 15))
    501             sage: a._mul_trunc_opposite(b, 10)
     500            sage: b = P(range(10)); c = P(range(5, 15))
     501            sage: (b._mul_trunc_opposite(c, 10))[10:18]
    502502            5*a^17 + 2*a^16 + 6*a^15 + 4*a^14 + 4*a^13 + 5*a^10
    503             sage: a._mul_trunc_opposite(b, 18)
     503            sage: (b._mul_trunc_opposite(c, 18))[18:]
    504504            0
    505505
    506506        TESTS::
  • sage/schemes/elliptic_curves/ell_padic_field.py

    diff --git a/sage/schemes/elliptic_curves/ell_padic_field.py b/sage/schemes/elliptic_curves/ell_padic_field.py
    a b  
    3939    def __init__(self, x, y=None):
    4040        """
    4141        Constructor from [a1,a2,a3,a4,a6] or [a4,a6].
    42         EXAMPLES:
    43         sage: Qp=pAdicField(17)
    44         sage: E=EllipticCurve(Qp,[2,3]); E
    45         Elliptic Curve defined by y^2  = x^3 + (2+O(17^20))*x + (3+O(17^20)) over 17-adic Field with capped relative precision 20
    46         sage: E == loads(dumps(E))
    47         True
     42
     43        EXAMPLES::
     44
     45            sage: Qp=pAdicField(17)
     46            sage: E=EllipticCurve(Qp,[2,3]); E
     47            Elliptic Curve defined by y^2  = x^3 + (2+O(17^20))*x + (3+O(17^20)) over 17-adic Field with capped relative precision 20
     48            sage: E == loads(dumps(E))
     49            True
    4850        """
    4951        if y is None:
    5052            if isinstance(x, list):
     
    7173        Returns the Frobenius as a function on the group of points of
    7274        this elliptic curve.
    7375
    74         EXAMPLE:
     76        EXAMPLE::
     77
    7578            sage: Qp=pAdicField(13)
    7679            sage: E=EllipticCurve(Qp,[1,1])
    7780            sage: type(E.frobenius())
     
    8689            K = self.base_field()
    8790            p = K.prime()
    8891            x = PolynomialRing(K, 'x').gen(0)
    89            
     92
    9093            a1, a2, a3, a4, a6 = self.a_invariants()
    9194            if a1 != 0 or a2 != 0:
    9295                raise NotImplementedError, "Curve must be in weierstrass normal form."
    93            
     96
    9497            f = x*x*x + a2*x*x + a4*x + a6
    9598            h = (f(x**p) - f**p)
    9699
     
    104107                if (yres-y0).valuation() == 0:
    105108                    yres=-yres
    106109                return self.point([xres,yres, K(1)])
    107                
     110
    108111            self._frob = _frob
    109            
     112
    110113        if P is None:
    111114            return _frob
    112115        else:
    113             return _frob(P)       
     116            return _frob(P)