Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Some plots to observe the Law of Quadratic Reciprocity at work

Project: KOB1
Views: 116

Investigating the Legendre symbols (pq)(p|q), for primes pp and qq

and discovering the Law of Quadratic Reciprocity

The legendre symbols (pq)(p|q), blue for +1+1, red for 1-1

N=200 G=Graphics() points =[(p,q) for p in primes(3,N) for q in primes(3,N) if not p==q] for x in points: if legendre_symbol(x[0],x[1])==1: G+=point(x, color='blue', size=3) else: G+=point(x, color='red', size=3)
G.show(aspect_ratio=1)

Comparing (pq)(p|q) with (qp)(q|p), unfilled circle for equal, filled circle for unequal

N=200 radius=1 G=Graphics() points =[(p,q) for p in primes(3,N) for q in primes(3,N) if not p==q] for x in points: l1 = legendre_symbol(x[0],x[1]) # (p|q) l2 = legendre_symbol(x[1],x[0]) # (q|p) if l1==l2: G+=circle(x, radius, edgecolor='black', facecolor='black', thickness=0.5, fill=False) # an unfilled circle elif l1==-l2: G+=circle(x, radius, edgecolor='black', facecolor='black', thickness=0.5, fill=True) # a filled circle
G.show(aspect_ratio=1)

This plot reveals the Law of Quadratic Reciprocity (pq)={(qp), if pq3(mod4)(qp), otherwise (p|q) = \left \{ \begin{array}{rl} -(q|p), & \text{ if } p \equiv q \equiv 3 \pmod{4}\\ (q|p), &\text{ otherwise} \end{array}\right.