Last active
October 1, 2019 21:28
-
-
Save Gro-Tsen/9bfed99575c87d459ce948321bcecd97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## The base points for the ruler-only construction. | |
## (Each point represented using homogeneous coordinates normalized so that | |
## the first nonzero coordinate is 1.) | |
basepoints = [(QQ^3)((1,0,0)), (QQ^3)((0,1,0)), (QQ^3)((0,0,1)), (QQ^3)((1,1,1))] | |
[tmp.set_immutable() for tmp in basepoints] | |
## bag0 and bag alternate between points and lines: initially, bag0 contains | |
## no lines and bag contains the base points, and at each step we update | |
## by adding to bag0 everything that can be constructed by connecting two | |
## items of bag and we exchange the two (bag becomes the new bag0, and the | |
## updated bag0 becomes bag). | |
bag0 = set([]) | |
bag = set(basepoints) | |
def connect(u,v): | |
tmp = u.cross_product(v) | |
if tmp[0] != 0: | |
tmp = tmp/(tmp[0]) | |
elif tmp[1] != 0: | |
tmp = tmp/(tmp[1]) | |
elif tmp[2] != 0: | |
tmp = tmp/(tmp[2]) | |
tmp.set_immutable() | |
return tmp | |
def updatebags(): | |
global bag0, bag | |
newbag = bag0.copy() | |
for p in bag: | |
for q in bag: | |
l = connect(p,q) | |
if l != 0: | |
newbag.add(l) | |
bag0 = bag | |
bag = newbag | |
gens = [bag] | |
for cnt in range(7): | |
updatebags() | |
gens.append(bag) | |
[len(bag) for bag in gens] | |
## Result: <URL: https://oeis.org/A140468 > | |
## Here's one possible plot (third in <URL: https://twitter.com/gro_tsen/status/1179079185127616512 >): | |
var('x,y') | |
i=2 ; gp = point([(pt[1],pt[2]) for pt in gens[2*i+1] if pt[0]==1 and abs(pt[1])<=5 and abs(pt[2])<=5], rgbcolor="blue", size=20) ; gl = sum([implicit_plot(c[0]+c[1]*x+c[2]*y==0, (x,-5,5), (y,-5,5), color="red", linewidth=3) for c in gens[2*i]]) ; glnew = sum([implicit_plot(c[0]+c[1]*x+c[2]*y==0, (x,-5,5), (y,-5,5), color="green") for c in gens[2*i+2]]) ; [tmp.set_zorder(10) for tmp in gp] ; [tmp.set_zorder(5) for tmp in gl] ; gl + gp + glnew |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment