p-adic Capped Relative Dense Polynomials

class sage.rings.polynomial.padics.polynomial_padic_capped_relative_dense.Polynomial_padic_capped_relative_dense(parent, x=None, check=True, is_gen=False, construct=False, absprec=+Infinity, relprec=+Infinity)

Bases: sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_domain, sage.rings.polynomial.padics.polynomial_padic.Polynomial_padic

TESTS:

sage: K = Qp(13,7)
sage: R.<t> = K[]
sage: R([K(13), K(1)])
(1 + O(13^7))*t + (13 + O(13^8))
sage: T.<t> = ZZ[]
sage: R(t + 2)
(1 + O(13^7))*t + (2 + O(13^7))

Check that trac ticket #13620 has been fixed:

sage: f = R.zero()
sage: R(f.dict())
0
content()

Returns the content of self.

The content is returned to maximum precision: since it’s only defined up to a unit, we can choose p^k as the representative.

Returns an error if the base ring is actually a field: this is probably not a function you want to be using then, since any nonzero answer will be correct.

The content of the exact zero polynomial is zero.

EXAMPLES:

sage: K = Zp(13,7)
sage: R.<t> = 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.<x> = 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)
degree()

Returns the degree of self, i.e., the largest n so that the coefficient of x^n does not compare equal to 0.

EXAMPLES:

sage: K = Qp(3,10)
sage: x = O(3^5)
sage: li =[3^i * x for i in range(0,5)]; li
[O(3^5), O(3^6), O(3^7), O(3^8), O(3^9)]
sage: R.<T> = K[]
sage: f = R(li); f
(O(3^9))*T^4 + (O(3^8))*T^3 + (O(3^7))*T^2 + (O(3^6))*T + (O(3^5))
sage: f.degree()
-1
disc()
factor_mod()

Returns the factorization of self modulo p.

hensel_lift(a)
lift()

Returns an integer polynomial congruent to this one modulo the precision of each coefficient.

NOTE: The lift that is returned will not necessarily be the same for polynomials with
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.<t> = K[]
sage: a = 13^7*t^3 + K(169,4)*t - 13^4
sage: a.lift()
62748517*t^3 + 169*t - 28561
list()

Returns a list of coefficients of self.

NOTE: The length of the list returned may be greater than expected since it includes any leading zeros that have finite absolute precision.

EXAMPLES:

sage: K = Qp(13,7)
sage: R.<t> = 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)]
lshift_coeffs(shift, no_list=False)

Returns a new polynomials whose coefficients are multiplied by p^shift.

EXAMPLES:

sage: K = Qp(13, 4)
sage: R.<t> = K[]
sage: a = t + 52
sage: a.lshift_coeffs(3)
(13^3 + O(13^7))*t + (4*13^4 + O(13^8))
newton_polygon()

Returns the Newton polygon of this polynomial.

Note

If some coefficients have not enough precision an error is raised.

OUTPUT:

  • a Newton polygon

EXAMPLES:

sage: K = Qp(2, prec=5)
sage: P.<x> = K[]
sage: f = x^4 + 2^3*x^3 + 2^13*x^2 + 2^21*x + 2^37
sage: f.newton_polygon()
Finite Newton polygon with 4 vertices: (0, 37), (1, 21), (3, 3), (4, 0)

sage: K = Qp(5)
sage: R.<t> = K[]
sage: f = 5 + 3*t + t^4 + 25*t^10
sage: f.newton_polygon()
Finite Newton polygon with 4 vertices: (0, 1), (1, 0), (4, 0), (10, 2)

Here is an example where the computation fails because precision is not sufficient:

sage: g = f + K(0,0)*t^4; g
(5^2 + O(5^22))*t^10 + (O(5^0))*t^4 + (3 + O(5^20))*t + (5 + O(5^21))
sage: g.newton_polygon()
Traceback (most recent call last):
...
PrecisionError: The coefficient of t^4 has not enough precision

TESTS:

sage: (5*f).newton_polygon()
Finite Newton polygon with 4 vertices: (0, 2), (1, 1), (4, 1), (10, 3)

AUTHOR:

  • Xavier Caruso (2013-03-20)
newton_slopes(repetition=True)

Returns a list of the Newton slopes of this polynomial.

These are the valuations of the roots of this polynomial.

If repetition is True, each slope is repeated a number of times equal to its multiplicity. Otherwise it appears only one time.

INPUT:

  • repetition – boolean (default True)

OUTPUT:

  • a list of rationals

EXAMPLES:

sage: K = Qp(5)
sage: R.<t> = K[]
sage: f = 5 + 3*t + t^4 + 25*t^10
sage: f.newton_polygon()
Finite Newton polygon with 4 vertices: (0, 1), (1, 0), (4, 0), (10, 2)
sage: f.newton_slopes()
[1, 0, 0, 0, -1/3, -1/3, -1/3, -1/3, -1/3, -1/3]

sage: f.newton_slopes(repetition=False)
[1, 0, -1/3]

AUTHOR:

  • Xavier Caruso (2013-03-20)
prec_degree()

Returns the largest n so that precision information is stored about the coefficient of x^n.

Always greater than or equal to degree.

precision_absolute(n=None)

Returns absolute precision information about self.

INPUT: self – a p-adic polynomial n – None or an integer (default None).

OUTPUT: If n == None, returns a list of absolute precisions of coefficients. Otherwise, returns the absolute precision of the coefficient of x^n.

precision_relative(n=None)

Returns relative precision information about self.

INPUT: self – a p-adic polynomial n – None or an integer (default None).

OUTPUT: If n == None, returns a list of relative precisions of coefficients. Otherwise, returns the relative precision of the coefficient of x^n.

quo_rem(right)
rescale(a)

Return f(a*X)

NOTE: Need to write this function for integer polynomials before this works.

EXAMPLES:

sage: K = Zp(13, 5)
sage: R.<t> = K[]
sage: f = t^3 + K(13, 3) * t
sage: f.rescale(2)  # not implemented
reverse(n=None)

Returns a new polynomial whose coefficients are the reversed coefficients of self, where self is considered as a polynomial of degree n.

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.<t> = 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
rshift_coeffs(shift, no_list=False)

Returns a new polynomial whose coefficients are p-adiclly shifted to the right by shift.

NOTES: Type Qp(5)(0).__rshift__? for more information.

EXAMPLES:

sage: K = Zp(13, 4)
sage: R.<t> = 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)]
valuation(val_of_var=None)

Returns the valuation of self

INPUT: self – a p-adic polynomial val_of_var – None or a rational (default None).

OUTPUT: If val_of_var == None, returns the largest power of the variable dividing self. Otherwise, returns the valuation of self where the variable is assigned valuation val_of_var

valuation_of_coefficient(n=None)

Returns valuation information about self’s coefficients.

INPUT: self – a p-adic polynomial n – None or an integer (default None).

OUTPUT: If n == None, returns a list of valuations of coefficients. Otherwise, returns the valuation of the coefficient of x^n.

xgcd(right)

Extended gcd of self and other.

INPUT:

  • other – an element with the same parent as self

OUTPUT:

Polynomials g, u, and v such that g = u*self + v*other

Warning

The computations are performed using the standard Euclidean algorithm which might produce mathematically incorrect results in some cases. See trac ticket #13439.

EXAMPLES:

sage: R.<x> = Qp(3,3)[]
sage: f = x + 1
sage: f.xgcd(f^2)
((1 + O(3^3))*x + (1 + O(3^3)), (1 + O(3^3)), 0)

In these examples the results are incorrect, see trac ticket #13439:

sage: R.<x> = Qp(3,3)[]
sage: f = 3*x + 7
sage: g = 5*x + 9
sage: f.xgcd(f*g)  # known bug
((3 + O(3^4))*x + (1 + 2*3 + O(3^3)), (1 + O(3^3)), 0)

sage: R.<x> = Qp(3)[]
sage: f = 490473657*x + 257392844/729
sage: g = 225227399/59049*x - 8669753175
sage: f.xgcd(f*g)  # known bug
((3^3 + 3^5 + 2*3^6 + 2*3^7 + 3^8 + 2*3^10 + 2*3^11 + 3^12 + 3^13 + 3^15 + 2*3^16 + 3^18 + O(3^23))*x + (2*3^-6 + 2*3^-5 + 3^-3 + 2*3^-2 + 3^-1 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + 3^6 + 2*3^7 + 2*3^8 + 2*3^9 + 2*3^10 + 3^11 + O(3^14)), (1 + O(3^20)), 0)
sage.rings.polynomial.padics.polynomial_padic_capped_relative_dense.make_padic_poly(parent, x, version)