A common superclass implementing features shared by all elements that use NTL’s ZZ_pX as the fundamental data type.
AUTHORS:
Given a list L, finds the minimum valuation, minimum absolute precision and minimum common type of the elements.
INPUTS:
OUTPUTS:
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)
Returns valuation, absolute precision and type of an input element.
INPUTS:
OUTPUTS:
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)
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:
OUTPUTS:
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)
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]
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
Return the absolute or relative norm of this element.
NOTE! This is not the -adic absolute value. This is a
field theoretic norm down to a ground ring. If you want the
-adic absolute value, use the abs() function instead.
If base is given then base must be a subfield of the
parent 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
or
.
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)
Return the absolute or relative trace of this element.
If base is given then base must be a subfield of the
parent of self, in which case the norm is the relative
norm from
to base.
In all other cases, the norm is the absolute norm down to
or
.
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)