Miscellaneous Functions¶
This file contains several miscellaneous functions used by p-adics.
gauss_sum
– compute Gauss sums using the Gross-Koblitz formula.min
– a version ofmin
that returns ∞ on empty input.max
– a version ofmax
that returns −∞ on empty input.
AUTHORS:
- David Roe
- Adriana Salerno
- Ander Steele
- Kiran Kedlaya (modified gauss_sum 2017/09)
-
sage.rings.padics.misc.
gauss_sum
(a, p, f, prec=20, factored=False, algorithm='pari', parent=None)¶ Return the Gauss sum gq(a) as a p-adic number.
The Gauss sum gq(a) is defined by
gq(a)=∑u∈F∗qω(u)−aζuq,where q=pf, ω is the Teichmüller character and ζq is some arbitrary choice of primitive q-th root of unity. The computation is adapted from the main theorem in Alain Robert’s paper The Gross-Koblitz formula revisited, Rend. Sem. Mat. Univ. Padova 105 (2001), 157–170.
Let p be a prime, f a positive integer, q=pf, and π be the unique root of f(x)=xp−1+p congruent to ζp−1 modulo (ζp−1)2. Let 0≤a<q−1. Then the Gross-Koblitz formula gives us the value of the Gauss sum gq(a) as a product of p-adic Gamma functions as follows:
gq(a)=−πs∏0≤i<fΓp(a(i)/(q−1)),where s is the sum of the digits of a in base p and the a(i) have p-adic expansions obtained from cyclic permutations of that of a.
INPUT:
a
– integerp
– primef
– positive integerprec
– positive integer (optional, 20 by default)factored
- boolean (optional, False by default)algorithm
- flag passed to p-adic Gamma function (optional, “pari” by default)
OUTPUT:
If
factored
isFalse
, returns a p-adic number in an Eisenstein extension of Qp. This number has the form pie∗z where pi is as above, e is some nonnegative integer, and z is an element of Zp; iffactored
isTrue
, the pair (e,z) is returned instead, and the Eisenstein extension is not formed.Note
This is based on GP code written by Adriana Salerno.
EXAMPLES:
In this example, we verify that g3(0)=−1:
sage: from sage.rings.padics.misc import gauss_sum sage: -gauss_sum(0,3,1) 1 + O(pi^40)
Next, we verify that g5(a)g5(−a)=5(−1)a:
sage: from sage.rings.padics.misc import gauss_sum sage: gauss_sum(2,5,1)^2-5 O(pi^84) sage: gauss_sum(1,5,1)*gauss_sum(3,5,1)+5 O(pi^84)
Finally, we compute a non-trivial value:
sage: from sage.rings.padics.misc import gauss_sum sage: gauss_sum(2,13,2) 6*pi^2 + 7*pi^14 + 11*pi^26 + 3*pi^62 + 6*pi^74 + 3*pi^86 + 5*pi^98 + pi^110 + 7*pi^134 + 9*pi^146 + 4*pi^158 + 6*pi^170 + 4*pi^194 + pi^206 + 6*pi^218 + 9*pi^230 + O(pi^242) sage: gauss_sum(2,13,2,prec=5,factored=True) (2, 6 + 6*13 + 10*13^2 + O(13^5))
See also
sage.arith.misc.gauss_sum()
for general finite fieldssage.modular.dirichlet.DirichletCharacter.gauss_sum()
for prime finite fieldssage.modular.dirichlet.DirichletCharacter.gauss_sum_numerical()
for prime finite fields
-
sage.rings.padics.misc.
max
(*L)¶ Return the maximum of the inputs, where the maximum of the empty list is −∞.
EXAMPLES:
sage: from sage.rings.padics.misc import max sage: max() -Infinity sage: max(2,3) 3
-
sage.rings.padics.misc.
min
(*L)¶ Return the minimum of the inputs, where the minimum of the empty list is ∞.
EXAMPLES:
sage: from sage.rings.padics.misc import min sage: min() +Infinity sage: min(2,3) 2
-
sage.rings.padics.misc.
precprint
(prec_type, prec_cap, p)¶ String describing the precision mode on a p-adic ring or field.
EXAMPLES:
sage: from sage.rings.padics.misc import precprint sage: precprint('capped-rel', 12, 2) 'with capped relative precision 12' sage: precprint('capped-abs', 11, 3) 'with capped absolute precision 11' sage: precprint('floating-point', 1234, 5) 'with floating precision 1234' sage: precprint('fixed-mod', 1, 17) 'of fixed modulus 17^1'
-
sage.rings.padics.misc.
trim_zeros
(L)¶ Strips trailing zeros/empty lists from a list.
EXAMPLES:
sage: from sage.rings.padics.misc import trim_zeros sage: trim_zeros([1,0,1,0]) [1, 0, 1] sage: trim_zeros([[1],[],[2],[],[]]) [[1], [], [2]] sage: trim_zeros([[],[]]) [] sage: trim_zeros([]) []
Zeros are also trimmed from nested lists (one deep):
sage: trim_zeros([[1,0]]) [[1]] sage: trim_zeros([[0],[1]]) [[], [1]]