# 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 sage: q_bernoulli(0) 1 sage: q_bernoulli(1) 1/(-q - 1) -1/(q + 1) sage: q_bernoulli(2) q/(q^3 + 2*q^2 + 2*q + 1) 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 sage: s = Sym.schur() sage: JJ(s([3])) # indirect doctest ((-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] ((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] sage: JJ(s([2,1])) ((t-1)/(3*t+6))*JackJ[1, 1, 1] + (1/(t+2))*JackJ[2, 1] sage: JJ(s([1,1,1])) sage: a.scalar(JP([1,1])) 0 sage: JP(JQp([2]))                        # todo: missing auto normalization ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] ((t-1)/(t+1))*JackP[1, 1] + JackP[2] sage: JP._normalize(JP(JQp([2]))) ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] ((t-1)/(t+1))*JackP[1, 1] + JackP[2] """ return JackPolynomials_qp(self) 0 sage: s = P.realization_of().s() sage: P(Qp([2]))                        # todo: missing auto normalization ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] ((t-1)/(t+1))*JackP[1, 1] + JackP[2] sage: P._normalize(P(Qp([2]))) ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] ((t-1)/(t+1))*JackP[1, 1] + JackP[2] """ (R, t) = NoneConvention(R, t) sage.misc.superseded.deprecation(5457, "Deprecation warning: In the future use SymmetricFunctions(R).jack(t=%s).Qp()"%(t)) sage: JJ = SymmetricFunctions(FractionField(QQ['t'])).jack().J() sage: JJ([1])^2              # indirect doctest (-t/(-t-1))*JackJ[1, 1] + (1/(t+1))*JackJ[2] (t/(t+1))*JackJ[1, 1] + (1/(t+1))*JackJ[2] sage: JJ([2])^2 (-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] (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] sage: JQ = SymmetricFunctions(FractionField(QQ['t'])).jack().Q() sage: JQ([1])^2              # indirect doctest JackQ[1, 1] + (2/(t+1))*JackQ[2] sage: Sym = SymmetricFunctions(QQ['t'].fraction_field()) sage: Sym.jack().P()[2,2].coproduct() #indirect doctest 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[] 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[] """ from sage.categories.tensor import tensor s = self.realization_of().schur() sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())] sage: JP._m_cache(2) sage: l(JP._self_to_m_cache[2]) [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], -2/(-t - 1)), ([2], 1)])] [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], 2/(t + 1)), ([2], 1)])] sage: l(JP._m_to_self_cache[2]) [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], 2/(-t - 1)), ([2], 1)])] [([1, 1], [([1, 1], 1)]), ([2], [([1, 1], -2/(t + 1)), ([2], 1)])] sage: JP._m_cache(3) sage: l(JP._m_to_self_cache[3]) [([1, 1, 1], [([1, 1, 1], 1)]), ([2, 1], [([1, 1, 1], -6/(t + 2)), ([2, 1], 1)]), ([3], [([1, 1, 1], -6/(-t^2 - 3*t - 2)), ([2, 1], -3/(2*t + 1)), ([3], 1)])] ([3], [([1, 1, 1], 6/(t^2 + 3*t + 2)), ([2, 1], -3/(2*t + 1)), ([3], 1)])] sage: l(JP._self_to_m_cache[3]) [([1, 1, 1], [([1, 1, 1], 1)]), ([2, 1], [([1, 1, 1], 6/(t + 2)), ([2, 1], 1)]), ([3], [([1, 1, 1], -6/(-2*t^2 - 3*t - 1)), ([2, 1], 3/(2*t + 1)), ([3], 1)])] ([3], [([1, 1, 1], 6/(2*t^2 + 3*t + 1)), ([2, 1], 3/(2*t + 1)), ([3], 1)])] """ if n in self._self_to_m_cache: return sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: m = JP.symmetric_function_ring().m() sage: JP([1])^2 # indirect doctest (-2*t/(-t-1))*JackP[1, 1] + JackP[2] (2*t/(t+1))*JackP[1, 1] + JackP[2] sage: m(_) 2*m[1, 1] + m[2] sage: JP = SymmetricFunctions(QQ).jack(t=2).P() sage: JQp = SymmetricFunctions(FractionField(QQ['t'])).jack().Qp() sage: h = JQp.symmetric_function_ring().h() sage: JQp([1])^2 # indirect doctest JackQp[1, 1] + (-2/(-t-1))*JackQp[2] JackQp[1, 1] + (2/(t+1))*JackQp[2] sage: h(_) h[1, 1] sage: JQp = SymmetricFunctions(QQ).jack(t=2).Qp() sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())] sage: JQp._h_cache(2) sage: l(JQp._self_to_h_cache[2]) [([1, 1], [([1, 1], 1), ([2], 2/(-t - 1))]), ([2], [([2], 1)])] [([1, 1], [([1, 1], 1), ([2], -2/(t + 1))]), ([2], [([2], 1)])] sage: l(JQp._h_to_self_cache[2]) [([1, 1], [([1, 1], 1), ([2], -2/(-t - 1))]), ([2], [([2], 1)])] [([1, 1], [([1, 1], 1), ([2], 2/(t + 1))]), ([2], [([2], 1)])] sage: JQp._h_cache(3) sage: l(JQp._h_to_self_cache[3]) [([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)])] [([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)])] sage: l(JQp._self_to_h_cache[3]) [([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)])] [([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)])] """ if n in self._self_to_h_cache: return sage: Sym = SymmetricFunctions(QQ['t'].fraction_field()) sage: JQp = Sym.jack().Qp() sage: JQp[2,2].coproduct()   #indirect doctest 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[] 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[] """ h = elt.parent().realization_of().h() parent = elt.parent()

`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 class Polynomial_padic_capped_relative_dense(Polynomial_generic_domain): def __init__(self, parent, x=None, check=True, is_gen=False, construct = False, absprec = infinity, relprec = infinity): """ TESTS: TESTS:: sage: K = Qp(13,7) sage: R. = K[] sage: R([K(13), K(1)]) """ Recomputes the list of coefficients. EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: a = t[0:1] sage: a._comp_list() sage: a 0 EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = t[0:1] sage: a._comp_list() sage: a 0 """ if self.degree() == -1 and self._valbase == infinity: self._list = [] than expected since it includes any leading zeros that have finite absolute precision. EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: a = 2*t^3 + 169*t - 1 sage: a (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)) sage: a.list() [12 + 12*13 + 12*13^2 + 12*13^3 + 12*13^4 + 12*13^5 + 12*13^6 + O(13^7), 13^2 + O(13^9), 0, 2 + O(13^7)] EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = 2*t^3 + 169*t - 1 sage: a (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)) sage: a.list() [12 + 12*13 + 12*13^2 + 12*13^3 + 12*13^4 + 12*13^5 + 12*13^6 + O(13^7), 13^2 + O(13^9), 0, 2 + O(13^7)] """ if self._list is None: def _repr(self, name=None): """ TESTS: TESTS:: sage: k = Qp(5,10) sage: R. = k[] sage: f = R([k(0,-3), 0, k(0,-1)]); f The content of the exact zero polynomial is zero. EXAMPLES: sage: K = Zp(13,7) sage: R. = K[] sage: a = 13^7*t^3 + K(169,4)*t - 13^4 sage: a.content() 13^2 + O(13^9) sage: R(0).content() 0 sage: P. = ZZ[] sage: f = x + 2 sage: f.content() 1 sage: fp = f.change_ring(pAdicRing(2, 10)) sage: fp (1 + O(2^10))*x + (2 + O(2^11)) sage: fp.content() 1 + O(2^10) sage: (2*fp).content() 2 + O(2^11) EXAMPLES:: sage: K = Zp(13,7) sage: R. = K[] sage: a = 13^7*t^3 + K(169,4)*t - 13^4 sage: a.content() 13^2 + O(13^9) sage: R(0).content() 0 sage: P. = ZZ[] sage: f = x + 2 sage: f.content() 1 sage: fp = f.change_ring(pAdicRing(2, 10)) sage: fp (1 + O(2^10))*x + (2 + O(2^11)) sage: fp.content() 1 + O(2^10) sage: (2*fp).content() 2 + O(2^11) """ if self.base_ring().is_field(): raise TypeError, "ground ring is a field.  Answer is only defined up to units." the same coefficients (ie same values and precisions): it will depend on how the polynomials are created. EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: a = 13^7*t^3 + K(169,4)*t - 13^4 sage: a.lift() 62748517*t^3 + 169*t - 28561 EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = 13^7*t^3 + K(169,4)*t - 13^4 sage: a.lift() 62748517*t^3 + 169*t - 28561 """ return self.base_ring().prime_pow(self._valbase) * self._poly EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = 13^7*t^3 + K(169,4)*t - 13^4 sage: a[1] 13^2 + O(13^4) sage: a[1:2] (13^2 + O(13^4))*t sage: K = Qp(13,7) sage: R. = K[] sage: a = 13^7*t^3 + K(169,4)*t - 13^4 sage: a[1] 13^2 + O(13^4) sage: a[1:2] (13^2 + O(13^4))*t """ if isinstance(n, slice): start, stop = n.start, n.stop """ Returns the sum of self and right. EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + 17*t^2 + 1 sage: b = -t^4 + 9*t^2 + 13*t - 1 sage: c = a + b; c (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7)) sage: c.list() [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)] EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + 17*t^2 + 1 sage: b = -t^4 + 9*t^2 + 13*t - 1 sage: c = a + b; c (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7)) sage: c.list() [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)] """ selfpoly = self._poly rightpoly = right._poly """ Returns the sum of self and right. EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + 17*t^2 + 1 sage: b = t^4 - 9*t^2 - 13*t + 1 sage: c = a - b; c (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7)) sage: c.list() [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)] EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + 17*t^2 + 1 sage: b = t^4 - 9*t^2 - 13*t + 1 sage: c = a - b; c (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7)) sage: c.list() [O(13^7), 13 + O(13^8), 2*13 + O(13^7), 0, O(13^7)] """ selfpoly = self._poly rightpoly = right._poly may very well change as we do more tests on the relative time requirements of these operations. EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + 17*t^2 + 1 sage: b = -t^4 + 9*t^2 + 13*t - 1 sage: c = a + b; c (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7)) sage: d = R([K(1,4), K(2, 6), K(1, 5)]); d (1 + O(13^5))*t^2 + (2 + O(13^6))*t + (1 + O(13^4)) sage: e = c * d; e (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)) sage: e.list() [O(13^7), 13 + O(13^5), 4*13 + O(13^5), 5*13 + O(13^6), 2*13 + O(13^6), O(13^7), O(13^7)] EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + 17*t^2 + 1 sage: b = -t^4 + 9*t^2 + 13*t - 1 sage: c = a + b; c (O(13^7))*t^4 + (2*13 + O(13^7))*t^2 + (13 + O(13^8))*t + (O(13^7)) sage: d = R([K(1,4), K(2, 6), K(1, 5)]); d (1 + O(13^5))*t^2 + (2 + O(13^6))*t + (1 + O(13^4)) sage: e = c * d; e (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)) sage: e.list() [O(13^7), 13 + O(13^5), 4*13 + O(13^5), 5*13 + O(13^6), 2*13 + O(13^6), O(13^7), O(13^7)] """ self._normalize() right._normalize() """ Returns self multiplied by a constant EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + K(13,5)*t^2 + 13 sage: K(13,7) * a (13 + O(13^7))*t^4 + (13^2 + O(13^6))*t^2 + (13^2 + O(13^8)) EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: a = t^4 + K(13,5)*t^2 + 13 sage: K(13,7) * a (13 + O(13^7))*t^4 + (13^2 + O(13^6))*t^2 + (13^2 + O(13^8)) """ return None # The code below has never been tested and is somehow subtly broken. """ Returns the negation of self. EXAMPLES: sage: K = Qp(13,2) sage: R. = K[] sage: a = t^4 + 13*t^2 + 4 sage: -a (12 + 12*13 + O(13^2))*t^4 + (12*13 + 12*13^2 + O(13^3))*t^2 + (9 + 12*13 + O(13^2)) EXAMPLES:: sage: K = Qp(13,2) sage: R. = K[] sage: a = t^4 + 13*t^2 + 4 sage: -a (12 + 12*13 + O(13^2))*t^4 + (12*13 + 12*13^2 + O(13^3))*t^2 + (9 + 12*13 + O(13^2)) """ return Polynomial_padic_capped_relative_dense(self.parent(), (-self._poly, self._valbase, self._relprecs, False, self._valaddeds, None), construct = True) """ Returns a new polynomials whose coefficients are multiplied by p^shift. EXAMPLES: sage: K = Qp(13, 4) sage: R. = K[] sage: a = t + 52 sage: a.lshift_coeffs(3) (13^3 + O(13^7))*t + (4*13^4 + O(13^8)) EXAMPLES:: sage: K = Qp(13, 4) sage: R. = K[] sage: a = t + 52 sage: a.lshift_coeffs(3) (13^3 + O(13^7))*t + (4*13^4 + O(13^8)) """ if shift < 0: return self.rshift_coeffs(-shift, no_list) NOTES: Type Qp(5)(0).__rshift__? for more information. EXAMPLES: sage: K = Zp(13, 4) sage: R. = K[] sage: a = t^2 + K(13,3)*t + 169; a (1 + O(13^4))*t^2 + (13 + O(13^3))*t + (13^2 + O(13^6)) sage: b = a.rshift_coeffs(1); b (O(13^3))*t^2 + (1 + O(13^2))*t + (13 + O(13^5)) sage: b.list() [13 + O(13^5), 1 + O(13^2), O(13^3)] sage: b = a.rshift_coeffs(2); b (O(13^2))*t^2 + (O(13))*t + (1 + O(13^4)) sage: b.list() [1 + O(13^4), O(13), O(13^2)] EXAMPLES:: sage: K = Zp(13, 4) sage: R. = K[] sage: a = t^2 + K(13,3)*t + 169; a (1 + O(13^4))*t^2 + (13 + O(13^3))*t + (13^2 + O(13^6)) sage: b = a.rshift_coeffs(1); b (O(13^3))*t^2 + (1 + O(13^2))*t + (13 + O(13^5)) sage: b.list() [13 + O(13^5), 1 + O(13^2), O(13^3)] sage: b = a.rshift_coeffs(2); b (O(13^2))*t^2 + (O(13))*t + (1 + O(13^4)) sage: b.list() [1 + O(13^4), O(13), O(13^2)] """ if shift < 0: 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 Returns the degree of self, i.e., the largest \$n\$ so that the coefficient of \$x^n\$ does not compare equal to \$0\$. EXAMPLES: EXAMPLES:: sage: K = Qp(3,10) sage: x = O(3^5) sage: li =[3^i * x for i in range(0,5)]; li If n is None, defaults to the degree of self. If n is smaller than the degree of self, some coefficients will be discarded. EXAMPLES: sage: K = Qp(13,7) sage: R. = K[] sage: f = t^3 + 4*t; f (1 + O(13^7))*t^3 + (4 + O(13^7))*t sage: f.reverse() (4 + O(13^7))*t^2 + (1 + O(13^7)) sage: f.reverse(3) (4 + O(13^7))*t^2 + (1 + O(13^7)) sage: f.reverse(2) (4 + O(13^7))*t sage: f.reverse(4) (4 + O(13^7))*t^3 + (1 + O(13^7))*t sage: f.reverse(6) (4 + O(13^7))*t^5 + (1 + O(13^7))*t^3 EXAMPLES:: sage: K = Qp(13,7) sage: R. = K[] sage: f = t^3 + 4*t; f (1 + O(13^7))*t^3 + (4 + O(13^7))*t sage: f.reverse() (4 + O(13^7))*t^2 + (1 + O(13^7)) sage: f.reverse(3) (4 + O(13^7))*t^2 + (1 + O(13^7)) sage: f.reverse(2) (4 + O(13^7))*t sage: f.reverse(4) (4 + O(13^7))*t^3 + (1 + O(13^7))*t sage: f.reverse(6) (4 + O(13^7))*t^5 + (1 + O(13^7))*t^3 """ if n is None: n = self._poly.degree() NOTE:  Need to write this function for integer polynomials before this works. EXAMPLES: EXAMPLES:: sage: K = Zp(13, 5) sage: R. = K[] sage: f = t^3 + K(13, 3) * t """ Returns a list of the Newton slopes of this polynomial.  These are the valuations of the roots of this polynomial. EXAMPLES: sage: K = Qp(13) sage: R. = K[] sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7 sage: f.newton_polygon() [(0, 7), (1, 2), (4, 0)] sage: f.newton_slopes() [5, 2/3, 2/3, 2/3] EXAMPLES:: sage: K = Qp(13) sage: R. = K[] sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7 sage: f.newton_polygon() [(0, 7), (1, 2), (4, 0)] sage: f.newton_slopes() [5, 2/3, 2/3, 2/3] """ polygon = self.newton_polygon() if polygon == []: NOTES: 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. EXAMPLES: sage: K = Qp(13) sage: R. = K[] sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7 sage: f.newton_polygon() [(0, 7), (1, 2), (4, 0)] EXAMPLES:: sage: K = Qp(13) sage: R. = K[] sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7 sage: f.newton_polygon() [(0, 7), (1, 2), (4, 0)] """ if self._poly == 0: 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 def __call__(self, *x, **kwds): """ Calls this polynomial with the given parameters, which can be interpreted as polynomial composition or evaluation by this Calls this polynomial with the given parameters, which can be interpreted as polynomial composition or evaluation by this method. If the argument is not simply an integer (``int``, ``long`` or ``Integer``) or a polynomial (of the same type as ``self``), the call is passed on to the generic implementation in the If the argument is not simply an integer (``int``, ``long`` or ``Integer``) or a polynomial (of the same type as ``self``), the call is passed on to the generic implementation in the ``Polynomial`` class. EXAMPLES: The first example illustrates polynomial composition:: sage: R. = ZZ[] sage: f = t^2 - 1 sage: g = t + 1 sage: f(g)          # indirect doctest t^2 + 2*t Now we illustrate how a polynomial can be evaluated at an Now we illustrate how a polynomial can be evaluated at an integer:: sage: f(2)          # indirect doctest 3 """ cdef unsigned long limbs cdef fmpz_t a_fmpz cdef fmpz_t z_fmpz if len(x) == 1: if len(x) == 1: x0 = x[0] if isinstance(x, Polynomial_integer_dense_flint): 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 EXAMPLES:: sage: P.=GF(7)[] sage: a = P(range(10)); b = P(range(5, 15)) sage: a._mul_trunc_opposite(b, 10) sage: b = P(range(10)); c = P(range(5, 15)) sage: (b._mul_trunc_opposite(c, 10))[10:18] 5*a^17 + 2*a^16 + 6*a^15 + 4*a^14 + 4*a^13 + 5*a^10 sage: a._mul_trunc_opposite(b, 18) sage: (b._mul_trunc_opposite(c, 18))[18:] 0 TESTS::
`diff --git a/sage/schemes/elliptic_curves/ell_padic_field.py b/sage/schemes/elliptic_curves/ell_padic_field.py`