Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Created September 20, 2019 18:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gro-Tsen/35c2e3ed4ac8a3b04229f489f5b195df to your computer and use it in GitHub Desktop.
Save Gro-Tsen/35c2e3ed4ac8a3b04229f489f5b195df to your computer and use it in GitHub Desktop.
## See https://twitter.com/gro_tsen/status/1174651836952956930 and its thread.
## Point labeling:
## 0 is fixed at (0,0).
## 1 is fixed at (0,-2).
## 1,2,3 are collinear with distance 1 between 1,2 and 2,3, and 1 at midpoint of 1,3.
## 2,3,5,4 form a quadrilateral.
## 2,4,6 are collinear with distance 1 betewen 2,4 and 4,6, and 4 at midpoint of 2,6.
## Distance 1 between 0,6.
## 5 is the plotted point.
R.<x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6> = PolynomialRing(QQ,14)
## link(i,j) returns the polynomial equation (xi-xj)^2 + (yi-yj)^2 - 1 (imposing distance 1 between i,j).
def link(i,j):
return (R.gens()[2*i]-R.gens()[2*j])^2 + (R.gens()[2*i+1]-R.gens()[2*j+1])^2 - 1
## List of unit distance links:
linklist = [(1,2),(2,3),(4,5),(2,4),(3,5),(4,6),(0,6)]
## Ideal generated by the (redundant!) equations:
I = R.ideal([link(i,j) for (i,j) in linklist] + [x0,y0,x1,y1+2, 2*x2-(x1+x3), 2*y2-(y1+y3), 2*x4-(x2+x6), 2*y4-(y2+y6), (x2+x5)-(x3+x4), (y2+y5)-(y3+y4)])
## Equation satisfied by x5,y5:
eqn5 = I.elimination_ideal([x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,x6,y6]).gens()[0]
## Extract irreducible components:
factor(eqn5)
## Result: x5^4 + 2*x5^2*y5^2 + y5^4 + 10*x5^2 - 6*y5^2 + 8*y5 - 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment