p-Adic ZZ_pX Element.

A common superclass implementing features shared by all elements that use NTL’s ZZ_pX as the fundamental data type.

AUTHORS:

  • David Roe
sage.rings.padics.padic_ZZ_pX_element._find_val_aprec_test()

Given a list L, finds the minimum valuation, minimum absolute precision and minimum common type of the elements.

INPUTS:

  • R – a p-adic extension
  • L – a list of integers, rationals, IntegerMods, etc.

OUTPUTS:

  • min_val – the minimum valuation of any element in the list.
  • min_aprec – the minimum absolute precision of any element in the list. If infinite, a predefined constant big is returned instead.
  • total_type
    • If all elements are integers or ints, 2.
    • If all elements are rationals or integers, 1.
    • If some elements have finite precision, 0.

EXAMPLES:

sage: from sage.rings.padics.padic_ZZ_pX_element import _find_val_aprec_test
sage: from sage.libs.ntl.all import ZZ as ntl_ZZ, ZZ_p as ntl_ZZ_p
sage: _find_val_aprec_test(Zq(25,names='a'), [15, int(75), ntl_ZZ(625)])
(1, 340282366920938463463374607431768211457, 2)
sage: _find_val_aprec_test(Zq(25,names='a'), [5, int(25), 7/25])
(-2, 340282366920938463463374607431768211457, 1)
sage: _find_val_aprec_test(Zq(25,names='a'), [mod(4,125), Zp(5)(5,5), ntl_ZZ_p(16,625), 4/125])
(-3, 3, 0)
sage: _find_val_aprec_test(Zq(25,names='a'), [mod(25,125), Zp(5)(5,5), ntl_ZZ_p(15,625)])
(0, 3, 0)
sage.rings.padics.padic_ZZ_pX_element._test_get_val_prec()

Returns valuation, absolute precision and type of an input element.

INPUTS:

  • R – A p-adic extension ring to provide a PowComputer_ext
  • a – A rational, integer, int, long, ntl_ZZ_p, ntl_ZZ, IntegerMod or p-adic base element.

OUTPUTS:

  • val – if a is exact, a.valuation(p), otherwise min(0, a.valuation())
  • aprec – the absolute precision of a. If a is exact, a large predefined constant.
  • type –
    • 2 if a is an integer, int or long;
    • 1 if a is a rational.
    • 0 if a has finite precision.

EXAMPLES:

sage: from sage.rings.padics.padic_ZZ_pX_element import _test_get_val_prec
sage: from sage.libs.ntl.all import ZZ as ntl_ZZ, ZZ_p as ntl_ZZ_p
sage: _test_get_val_prec(Zq(25,names='a'), 15) 
(1, 340282366920938463463374607431768211457, 2)
sage: _test_get_val_prec(Zq(25,names='a'), ntl_ZZ(15))
(1, 340282366920938463463374607431768211457, 2)
sage: _test_get_val_prec(Zq(25,names='a'), int(15))
(1, 340282366920938463463374607431768211457, 2)
sage: _test_get_val_prec(Zq(25,names='a'), 1/15)
(-1, 340282366920938463463374607431768211457, 1)
sage: _test_get_val_prec(Zq(25,names='a'), Zp(5)(15,4))
(0, 4, 0)
sage: _test_get_val_prec(Zq(25,names='a'), Qp(5)(1/15,4))
(-1, 4, 0)
sage: _test_get_val_prec(Zq(25,names='a'), mod(15,625))
(0, 4, 0)
sage: _test_get_val_prec(Zq(25,names='a'), ntl_ZZ_p(15,625))
(0, 4, 0)

TESTS:

sage: _test_get_val_prec(Zq(25,names='a'), 0) #indirect doctest
(340282366920938463463374607431768211457, 340282366920938463463374607431768211457, 2)
sage: _test_get_val_prec(Zq(25,names='a'), ntl_ZZ(0))
(340282366920938463463374607431768211457, 340282366920938463463374607431768211457, 2)
sage: _test_get_val_prec(Zq(25,names='a'), int(0))
(340282366920938463463374607431768211457, 340282366920938463463374607431768211457, 2)
sage: _test_get_val_prec(Zq(25,names='a'), 0/1)
(340282366920938463463374607431768211457, 340282366920938463463374607431768211457, 1)
sage: _test_get_val_prec(Zq(25,names='a'), Zp(5)(25,4))
(0, 4, 0)
sage: _test_get_val_prec(Zq(25,names='a'), Qp(5)(1/25,4))
(-2, 4, 0)
sage: _test_get_val_prec(Zq(25,names='a'), Zp(5)(0))
(340282366920938463463374607431768211457, 340282366920938463463374607431768211457, 1)
sage: _test_get_val_prec(Zq(25,names='a'), mod(0,625))
(0, 4, 0)
sage: _test_get_val_prec(Zq(25,names='a'), ntl_ZZ_p(0,625))
(0, 4, 0)
sage.rings.padics.padic_ZZ_pX_element._test_preprocess_list()

Given a list of elements convertible to ntl_ZZ_p``s, finds the appropriate absolute precision and returns a list of either ``ntl_ZZs or ntl_ZZ_ps.

INPUTS:

  • R – a p-adic extension ring
  • L – a list of rationals, integers, ints, longs, ntl_ZZ_ps, ntl_ZZs, IntegerMods or p-adic base elements

OUTPUTS:

  • LL – if all inputs are integral, a list of ntl_ZZs. Otherwise, a list of ntl_ZZ_ps, modulo p^n which is determined by the precision cap of R and the precisions of the elements in L.
  • min_val – A valuation by which to multiply the elements of LL in order to recover the input elements of L.
  • ctx – An ntl_ZZ_p_Context giving the power of p modulo which the elements in LL are defined. If None, then the elements of LL are ntl_ZZs.

EXAMPLES:

sage: from sage.rings.padics.padic_ZZ_pX_element import _test_preprocess_list
sage: from sage.libs.ntl.all import ZZ as ntl_ZZ, ZZ_p as ntl_ZZ_p
sage: _test_preprocess_list(Zq(25,names='a'), [1,2,3])
([1, 2, 3], 0, None)
sage: _test_preprocess_list(Zq(25,names='a'), [10,20,30])
([10, 20, 30], 0, None)
sage: _test_preprocess_list(Zq(25,names='a'), [1/5,2/5,3])
([1, 2, 15], -1, NTL modulus 95367431640625)
sage: _test_preprocess_list(Zq(25,names='a'), [1/5,mod(2,625),3])
([1, 10, 15], -1, NTL modulus 3125)
sage: _test_preprocess_list(Zq(25,names='a'), [1/5,mod(2,625),ntl_ZZ_p(3,25)])
([1, 10, 15], -1, NTL modulus 125)
sage: _test_preprocess_list(Zq(25,names='a'), [1/5,mod(2,625),Zp(5)(5,3)])
([1, 10, 1], -1, NTL modulus 625)
sage: _test_preprocess_list(Zq(25,names='a'), [1/5,mod(2,625),Zp(5)(5,3),0])
([1, 10, 1, 0], -1, NTL modulus 625)
sage: _test_preprocess_list(Zq(25,names='a'), [1/5,mod(2,625),Zp(5)(5,3),mod(0,3125)])
([1, 10, 1, 0], -1, NTL modulus 625)
class sage.rings.padics.padic_ZZ_pX_element.pAdicZZpXElement
__init__()
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
static __new__()
T.__new__(S, ...) -> a new object with type S, a subtype of T
_prime_pow()

Provides access to self's prime_pow.

EXAMPLES:

sage: R = ZpCR(5,5)
sage: S.<x> = R[]
sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
sage: W.<w> = R.ext(f)
sage: w._prime_pow()
PowComputer_ext for 5, with polynomial [3120 125 3110 75 0 1]
_rational_()

Returns a rational approximation of self.

This does not try to optimize which rational is picked: see algdep for another option.

EXAMPLES:

sage: QQ(Qq(125,names='a')(-1/5)) #indirect doctest
95367431640624/5
norm()

Return the absolute or relative norm of this element.

NOTE! This is not the p-adic absolute value. This is a field theoretic norm down to a ground ring. If you want the p-adic absolute value, use the abs() function instead.

If base is given then base must be a subfield of the parent L of self, in which case the norm is the relative norm from L to base.

In all other cases, the norm is the absolute norm down to \mathbb{Q}_p or \mathbb{Z}_p.

EXAMPLES:

sage: R = ZpCR(5,5)
sage: S.<x> = R[]
sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
sage: W.<w> = R.ext(f)
sage: ((1+2*w)^5).norm()
1 + 5^2 + O(5^5)
sage: ((1+2*w)).norm()^5
1 + 5^2 + O(5^5)

TESTS:

sage: R = ZpCA(5,5)
sage: S.<x> = ZZ[]
sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
sage: W.<w> = R.ext(f)
sage: ((1+2*w)^5).norm()
1 + 5^2 + O(5^5)
sage: ((1+2*w)).norm()^5
1 + 5^2 + O(5^5)
sage: R = ZpFM(5,5)
sage: S.<x> = ZZ[]
sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
sage: W.<w> = R.ext(f)
sage: ((1+2*w)^5).norm()
1 + 5^2 + O(5^5)
sage: ((1+2*w)).norm()^5
1 + 5^2 + O(5^5)
trace()

Return the absolute or relative trace of this element.

If base is given then base must be a subfield of the parent L of self, in which case the norm is the relative norm from L to base.

In all other cases, the norm is the absolute norm down to \mathbb{Q}_p or \mathbb{Z}_p.

EXAMPLES:

sage: R = ZpCR(5,5)
sage: S.<x> = R[]
sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
sage: W.<w> = R.ext(f)
sage: a = (2+3*w)^7
sage: b = (6+w^3)^5
sage: a.trace()
3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5)
sage: a.trace() + b.trace()
4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)
sage: (a+b).trace()
4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)

TESTS:

sage: R = ZpCA(5,5)
sage: S.<x> = ZZ[]
sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
sage: W.<w> = R.ext(f)
sage: a = (2+3*w)^7
sage: b = (6+w^3)^5
sage: a.trace()
3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5)
sage: a.trace() + b.trace()
4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)
sage: (a+b).trace()
4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)        
sage: R = ZpFM(5,5)
sage: S.<x> = R[]
sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
sage: W.<w> = R.ext(f)
sage: a = (2+3*w)^7
sage: b = (6+w^3)^5
sage: a.trace()
3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5)
sage: a.trace() + b.trace()
4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)
sage: (a+b).trace()
4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5)        

Previous topic

p-Adic Extension Element.

Next topic

p-Adic ZZ_pX CR Element.

This Page