Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
282 views
ubuntu2004
# Tutorial for plotting complex numbers, roots of nuity, Gauss and Jacobi sums # # Defines a graph, axes etc. a = plot([],figsize=(4,4),title='Here is a Graph',frame=True,axes_labels=['$x$-axis, units','$y$-axis, units']) A=[(i,i^2 % 10) for i in range(11)] # defines a list of 2D-points a+=sage.plot.line.line2d(A) # adds the corresponding polygonal line a+=point((3,0), color='red', size=30) # adds a single point x=3; y=-1 a+=text("p="+str(x), (x,y), rgbcolor=(1,0,0)) # adds text show(a)
# From complex numbers to 2D-points list_plot([1, I, pi + I/2, CC(.25, .25)], color='red', size=30)
# Plotting roots of unity p=3; A=[exp(2*pi*I*k/p) for k in range(p)] a = plot([],xmin=-1, xmax=1, ymin=-1, ymax=1, figsize=(3,3),title='Cubic Roots of Unity',frame=True,axes_labels=['$x$-axis','$y$-axis'], ) a+=list_plot(A, color='red', size=30, xmin=-1,xmax=1) a+=circle((0.0,0.0),1,color='blue') show(a)
# Primitive Roots of unity in Fp p=7; Zp=Integers(p) for k in factor(p-1): print k root_list = Zp.zeta(k[0],all=True); root_list
(2, 1) [6] (3, 1) [4, 2]
# Plotting the above roots in Zp via exponentiation a = plot([],figsize=(3,3),title='Roots of Unity of order 7',frame=True,axes_labels=['$x$-axis','$y$-axis']) # Use exp:Zp -> C to map the Z/pZ cycle onto the unit circle p=7; n=3 # divisor of p-1 root_list = Integers(p).zeta(n,all=True); root_list A=[exp(2*pi*I*ZZ(k)/p) for k in root_list] # must convert Z/pZ elements into integers ZZ(k) a+=list_plot(A, color='red', size=30, xmin=-1,xmax=1) a+=circle((0.0,0.0),1,color='blue') for k in range(p): # plotting all Z/pZ via exp a+=list_plot([exp(2*pi*I*k/p) for k in range(p)], size=10) show(a)
[4, 2]
# Plottinq Jacobi sums ... a challenge! G=DirichletGroup(7); c=G[1]; c J=c.jacobi_sum(c); J # Jacobi sum J(c,c) belomgs to Q(zeta_(p-1))
Dirichlet character modulo 7 of conductor 7 mapping 3 |--> zeta6 -zeta6 + 3
# It plots the terms of the Jacobi sums list_plot(J) # joins two lists of points
# Plotting Jacobi and Gauss sums c.gauss_sum() list_plot(c.gauss_sum()) list_plot(zip(J,c.gauss_sum()))
zeta42^10 + zeta42^8 + zeta42^6 - zeta42^5 - zeta42^4 - zeta42^2 - zeta42
# ... with different colors ... a = plot([],figsize=(3,3),title='Gauss and Jacobi Sums',frame=True,axes_labels=['$x$-axis','$y$-axis']) a+=list_plot(J,color='red', size=30) a+=list_plot(c.gauss_sum(),color='blue', size=10) show(a)