w = sqrt(-1)
#w = sqrt(-2)
#w = sqrt(-3)
#w = sqrt(-7)
#w = CC(0.5 * (1 + sqrt(-3)))
# parameters for the plotting
RANGELIM = 2 # what range of values should we cover (so this is unrelated to the maths, and just about drawing the little circles...)
MAXX = 6 # we specify what ranges we wanna look at for x and y (a more careful programming would estimate the required RANGELIM value from this data, but we're feeling lazy today...)
MINX = -6
MAXY = 6
MINY = -6
if (w.imag_part() == 0):
print("WARNING: Maybe you're using this in the wrong way. This script just works in the imaginary quadratic case, otherwise the norm function looks different...")
exit()
p = circle((0,0),0.01) # draw a circle at the original... this is just to start a 2d plot so that we can add new circles to our graphic by using "+"
for a in range(-RANGELIM,RANGELIM+1):
for b in range(-RANGELIM,RANGELIM+1):
# point under the complex embedding
z = CC(a + b * w) # as a and b range through the integers in the interval [-RANGELIM,+RANGELIM], set z to a + b*w
# the complex number z, when drawn as a point in the plane, has the real and imaginary part as its x- and y-coordinate
cx = z.real_part()
cy = z.imag_part()
# now draw a little circle around the point with coordinates (cx,cy)
p += circle( (cx,cy), 0.02, color='red')
# now we draw a big circle around the same point, but of radius 1. The parameter "alpha" controls how opaque/transparent we draw the circle
# ...so we draw it mostly transparently with the idea that we can see how various circles overlap. The more circles overlap, the darker
# the color gets. If a point stays white, no circle ever covered it.
p += circle( (cx,cy), 1, facecolor='blue', fill=True, alpha=0.18)
p.show(xmin=MINX, ymin=MINY, xmax=MAXX, ymax=MAXY, figsize=11)