Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
110 views
ubuntu2004
# ***************************************************************************** # Gauss Sums # 1. Computing quadratic Gauss sums; checking Gauss Theorem # 2. Plotting Gauss Sums and their argument g(c)/p^.5 ................ # # 3. Is Gauss Sum a class function ord(c)=ord(d) => g(c)=g(d)? .... # 4. Cubic Gauss Sums: g(c) for ord(c)=3; special case: SG-primes .. # # ***************************************************************************** # **************************************************************** # Computing Quadratic Gauss Sums # **************************************************************** p=7 # Pick a prime (for now) G=DirichletGroup(p) # Group of Dirichlet characters c=G[1] # select a generator for characters L=c^ZZ((p-1)/2) # This is the only quadratic character: Legendre symbol print("Legendre symbol:", L) print( "L^2=", L^2) print( (" ")) GS=L.gauss_sum()/p^(1/2); GS P=(real_part(GS), imag_part(GS)); P a = plot([],figsize=(3,3),title='Gauss Sums for p='+str(p),frame=True,axes_labels=['$x$-axis','$y$-axis']) a+=circle((0.0,0.0),1,color='blue') a+=point(P,color='red', size=20) show(a) print("Numeric values") z=CC(GS); ord=2; print("order=",ord, " Arg(g(c))=", z) print( "z^4=", z^4) k=2*pi.n()/z.argument(); print("2 Pi/Arg = ", k, " ", floor(k))
Legendre symbol: Dirichlet character modulo 7 of conductor 7 mapping 3 |--> -1 L^2= Dirichlet character modulo 7 of conductor 1 mapping 3 |--> 1 -1/7*sqrt(7)*(2*e^(11/21*I*pi) - 2*e^(3/7*I*pi) - 2*e^(8/21*I*pi) - 2*e^(4/21*I*pi) + 2*e^(1/21*I*pi) + 1) (2/7*sqrt(7)*cos(10/21*pi) + 2/7*sqrt(7)*cos(3/7*pi) + 2/7*sqrt(7)*cos(8/21*pi) + 2/7*sqrt(7)*cos(4/21*pi) - 2/7*sqrt(7)*cos(1/21*pi) - 1/7*sqrt(7), -2/7*sqrt(7)*sin(10/21*pi) + 2/7*sqrt(7)*sin(3/7*pi) + 2/7*sqrt(7)*sin(8/21*pi) + 2/7*sqrt(7)*sin(4/21*pi) - 2/7*sqrt(7)*sin(1/21*pi))
Numeric values order= 2 Arg(g(c))= 1.67849944170063e-16 + 1.00000000000000*I z^4= 0.999999999999999 - 6.71399776680251e-16*I 2 Pi/Arg = 4.00000000000000 4
# ********************************************************************************************* # Plotting the argument of Gauss Sums (unit complex numbers): g(c)/p^(1/2) # ********************************************************************************************* P=Primes() for k in range(1,30): p=P.unrank(k); # print "\nPrime p=", p G=DirichletGroup(p) # Group of Dirichlet characters c=G[1] # select a generator dv=divisors(p-1); ndv=len(dv) # possible orders m|p-1 print( "\n**************************************************************") print( "Prime p=", p, " p-1=", factor(p-1), " has ", ndv, " divisors:"), dv gs=[c.gauss_sum() for j in range(ndv)] # initialize the list of Gauss Sums arggs=[CC(0) for j in range(ndv)] # initialize the list of arguments of Gauss sums ("normalizing" to modulus 1) a = plot([],figsize=(3,3),title='Gauss Sums for p='+str(p),frame=True,axes_labels=['$x$-axis','$y$-axis']) for j in range(ndv): # print "j=",j m=dv[j] # selecting a divisor m of p-1 # print ("Order of character:",m) c1=c^ZZ((p-1)/m) # constructing the character of order m gs[j]=c1.gauss_sum() # print ("Ord(c)=",m, " Gauss sum g(c):", gs[j]) # the Gauss Sum g(c) - too ugly to show :) if m==1: arggs[j]=gs[j] else: arggs[j]=gs[j]/p^(1/2) # argument of Gauss sum (unit complex number) # print("Normalized:", arggs[j]) # print ("gs:", gs) a+=list_plot(gs,color='blue', size=20) for j in range(ndv): # plotting the orders of characters as labels for the respective Gauss Sums z=CC(gs[j])+0.1 a+=text(str(dv[j]), z, color='red') # show(a) # For each prime - SKIP for now ... a = plot([],figsize=(4,4),title='Argument of Gauss Sums for p='+str(p),frame=True,axes_labels=['Red label = order of character',' ']) # print "arg:", arggs a+=list_plot(arggs,color='red', size=20, xmin=-1.1,xmax=1.1,ymin=-1.1,ymax=1.1) a+=circle((0.0,0.0),1,color='blue') for j in range(ndv): # adding the orders of characters as labels for the respective Gauss Sums z=CC(arggs[j]) a+=text(str(dv[j]), z*CC(1.1), color='red') # shifting the label radially show(a) # For each prime
************************************************************** Prime p= 3 p-1= 2 has 2 divisors: (None, [1, 2])
************************************************************** Prime p= 5 p-1= 2^2 has 3 divisors: (None, [1, 2, 4])
************************************************************** Prime p= 7 p-1= 2 * 3 has 4 divisors: (None, [1, 2, 3, 6])
************************************************************** Prime p= 11 p-1= 2 * 5 has 4 divisors: (None, [1, 2, 5, 10])
************************************************************** Prime p= 13 p-1= 2^2 * 3 has 6 divisors: (None, [1, 2, 3, 4, 6, 12])
************************************************************** Prime p= 17 p-1= 2^4 has 5 divisors: (None, [1, 2, 4, 8, 16])
************************************************************** Prime p= 19 p-1= 2 * 3^2 has 6 divisors: (None, [1, 2, 3, 6, 9, 18])
************************************************************** Prime p= 23 p-1= 2 * 11 has 4 divisors: (None, [1, 2, 11, 22])
************************************************************** Prime p= 29 p-1= 2^2 * 7 has 6 divisors: (None, [1, 2, 4, 7, 14, 28])
************************************************************** Prime p= 31 p-1= 2 * 3 * 5 has 8 divisors: (None, [1, 2, 3, 5, 6, 10, 15, 30])
************************************************************** Prime p= 37 p-1= 2^2 * 3^2 has 9 divisors: (None, [1, 2, 3, 4, 6, 9, 12, 18, 36])
************************************************************** Prime p= 41 p-1= 2^3 * 5 has 8 divisors: (None, [1, 2, 4, 5, 8, 10, 20, 40])
************************************************************** Prime p= 43 p-1= 2 * 3 * 7 has 8 divisors: (None, [1, 2, 3, 6, 7, 14, 21, 42])
************************************************************** Prime p= 47 p-1= 2 * 23 has 4 divisors: (None, [1, 2, 23, 46])
************************************************************** Prime p= 53 p-1= 2^2 * 13 has 6 divisors: (None, [1, 2, 4, 13, 26, 52])
************************************************************** Prime p= 59 p-1= 2 * 29 has 4 divisors: (None, [1, 2, 29, 58])
************************************************************** Prime p= 61 p-1= 2^2 * 3 * 5 has 12 divisors: (None, [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60])
************************************************************** Prime p= 67 p-1= 2 * 3 * 11 has 8 divisors: (None, [1, 2, 3, 6, 11, 22, 33, 66])
************************************************************** Prime p= 71 p-1= 2 * 5 * 7 has 8 divisors: (None, [1, 2, 5, 7, 10, 14, 35, 70])
************************************************************** Prime p= 73 p-1= 2^3 * 3^2 has 12 divisors: (None, [1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 36, 72])
************************************************************** Prime p= 79 p-1= 2 * 3 * 13 has 8 divisors: (None, [1, 2, 3, 6, 13, 26, 39, 78])
************************************************************** Prime p= 83 p-1= 2 * 41 has 4 divisors: (None, [1, 2, 41, 82])
**************************************************************
# Questions / variations # 1. Test quadratic GS - formula # 2. Test cubic GS # 3. Test SG-primes # 4. Test divisibility of GSs