unique-y-intersect.sage 581 B

1234567891011121314151617181920212223242526272829
  1. # Lets show that div(f) = [P] - [∞]
  2. # So any divisor with supp(D) = {P},
  3. # with an effective size of 1 can be represented
  4. # by the horizontal line f = y - P.y
  5. q = 47
  6. K = GF(q)
  7. E = EllipticCurve(K, (0, 5))
  8. C = E.defining_polynomial()
  9. R.<x, y> = PolynomialRing(K)
  10. for i in range(100):
  11. P = E.random_point()
  12. Px, Py = P[0], P[1]
  13. # Skip points at infinity
  14. if P[2] == 0:
  15. continue
  16. assert P[2] == 1
  17. f = y - Py
  18. I = Ideal([C(x, y, 1), f])
  19. V = I.variety()
  20. print(P, V)
  21. assert len(V) == 1
  22. assert V[0][x] == Px
  23. assert V[0][y] == Py