extratest_zeta.py 1003 B

123456789101112131415161718192021222324252627282930
  1. from mpmath import zetazero
  2. from timeit import default_timer as clock
  3. def test_zetazero():
  4. cases = [\
  5. (399999999, 156762524.6750591511),
  6. (241389216, 97490234.2276711795),
  7. (526196239, 202950727.691229534),
  8. (542964976, 209039046.578535272),
  9. (1048449112, 388858885.231056486),
  10. (1048449113, 388858885.384337406),
  11. (1048449114, 388858886.002285122),
  12. (1048449115, 388858886.00239369),
  13. (1048449116, 388858886.690745053)
  14. ]
  15. for n, v in cases:
  16. print(n, v)
  17. t1 = clock()
  18. ok = zetazero(n).ae(complex(0.5,v))
  19. t2 = clock()
  20. print("ok =", ok, ("(time = %s)" % round(t2-t1,3)))
  21. print("Now computing two huge zeros (this may take hours)")
  22. print("Computing zetazero(8637740722917)")
  23. ok = zetazero(8637740722917).ae(complex(0.5,2124447368584.39296466152))
  24. print("ok =", ok)
  25. ok = zetazero(8637740722918).ae(complex(0.5,2124447368584.39298170604))
  26. print("ok =", ok)
  27. if __name__ == "__main__":
  28. test_zetazero()