SharedAlgebraic number theory Spring 2018 / lecture1.sagewsOpen in CoCalc
Euclidean domains
# lecture 1
# euclidean domains

# plots z such that |z|<1

var('x')

def amoeba(d, x0,y0, R=10, fillcolor="blue", fillalpha=0.2):
# draws (x,y) such that |(x-x0)^2-d*(y-y0)^2|<1
# in the case d>0 this region is capped inside the
if d<0:
# when d<0 the region is an ellipse
return parametric_plot((x0+cos(x), y0+sin(x)/sqrt(d)), fill=True, fillcolor=fillcolor, fillalpha=fillalpha)
else:
# when d>0 the region is not bounded
xM = sqrt((1+d*R^2)/(1+d))
#yM = sqrt((R^2-1)/(1+d))
return plot(y0+sqrt(((x-x0)^2+1)/d), (x, x0-xM, x0+xM), fill=y0+abs(x-x0)/sqrt(d), fillcolor=fillcolor, fillalpha=fillalpha, thickness=0) + plot(y0-sqrt(((x-x0)^2+1)/d), (x, x0-xM, x0+xM), fill=y0-abs(x-x0)/sqrt(d), fillcolor=fillcolor, fillalpha=fillalpha, thickness=0) + plot(y0+(x-x0)/sqrt(d), (x, x0-1,x0+1), fill=y0-(x-x0)/sqrt(d), fillcolor=fillcolor, fillalpha=fillalpha, thickness=0) + plot(y0+sqrt(((x-x0)^2-1)/d), (x, x0+1, x0+xM), fill=y0+(x-x0)/sqrt(d), fillcolor=fillcolor, fillalpha=fillalpha, thickness=0)+ plot(y0-sqrt(((x-x0)^2-1)/d), (x, x0+1, x0+xM), fill=y0-(x-x0)/sqrt(d), fillcolor=fillcolor, fillalpha=fillalpha, thickness=0)+ plot(y0+sqrt(((x-x0)^2-1)/d), (x, x0-xM, x0-1), fill=y0-(x-x0)/sqrt(d), fillcolor=fillcolor, fillalpha=fillalpha, thickness=0)+ plot(y0-sqrt(((x-x0)^2-1)/d), (x, x0-xM,x0-1), fill=y0+(x-x0)/sqrt(d), fillcolor=fillcolor, fillalpha=fillalpha, thickness=0)

#amoeba(7, 5,5)

def tile(d, zList, Mplus=3, Mminus=1, fillcolor="blue", fillalpha=0.2, R=10):
theTile = polygon([(0,0), (1,0), (1,1), (0,1), (0,0)], fill=True, color="red", xmin=-Mminus, xmax=Mplus, ymin=-Mminus, ymax=Mplus)
for z in zList:
theTile = theTile + amoeba(d, z[0], z[1], fillcolor=fillcolor, fillalpha=fillalpha, R=R)
return theTile + points(zList, size=50, hue=0.3)

x

tile(2, [(0,0)], fillalpha=1)
tile(2, [(0,0), (0, 1)], fillalpha=1)

tile(7, [(0,0)], fillalpha=1)
tile(7, [(0,0),(0,1)], fillalpha=1)
tile(7, [(0,0),(0,1),(1,0),(1,1)], fillalpha=1)
tile(7, [(0,0),(0,1),(1,0),(1,1),(2,0)], fillalpha=1)
tile(7, [(0,0),(0,1),(1,0),(1,1),(2,0),(-1,0)], fillalpha=1)

tile(7, [(0,0),(0,1),(1,0),(1,1),(2,0),(-1,0)], fillalpha=1,Mminus=0.1, Mplus=1.1,fillcolor='black')
tile(7, [(0,0),(0,1),(1,0),(1,1),(2,0),(-1,0),(2,1)], fillalpha=1,Mminus=0.1, Mplus=1.1,fillcolor='black')
tile(7, [(0,0),(0,1),(1,0),(1,1),(2,0),(-1,0),(2,1),(-1,1)], fillalpha=1,Mminus=0.1, Mplus=1.1,fillcolor='black')


tile(23, [(i,j) for i in range(-5,5) for j in range(-5,5)], Mplus=1.5, Mminus=0.5, fillalpha=1, R=10)