m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
624 B

6 months ago
  1. from sympy.ntheory.elliptic_curve import EllipticCurve
  2. def test_elliptic_curve():
  3. # Point addition and multiplication
  4. e3 = EllipticCurve(-1, 9)
  5. p = e3(0, 3)
  6. q = e3(-1, 3)
  7. r = p + q
  8. assert r.x == 1 and r.y == -3
  9. r = 2*p + q
  10. assert r.x == 35 and r.y == 207
  11. r = -p + q
  12. assert r.x == 37 and r.y == 225
  13. # Verify result in http://www.lmfdb.org/EllipticCurve/Q
  14. # Discriminant
  15. assert EllipticCurve(-1, 9).discriminant == -34928
  16. assert EllipticCurve(-2731, -55146, 1, 0, 1).discriminant == 25088
  17. # Torsion points
  18. assert len(EllipticCurve(0, 1).torsion_points()) == 6