plot() Overflow error int to large to convert to C long

asked 2017-12-24 12:13:11 -0500

DarkAgedBeer gravatar image

updated 2018-01-05 18:29:02 -0500

slelievre gravatar image

The following code

p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
E = EllipticCurve(GF(p), [0,0,0,0,7])

produces the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 10, in <module>
    exec compile(u'open("","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cGxvdChFKQ=="),globals())+"\\n"); execfile(os.path.abspath(""))
  File "", line 1, in <module>

  File "/tmp/tmp1ZsAfB/", line 2, in <module>
    exec compile(u'plot(E)
  File "", line 1, in <module>

  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/misc/", line 564, in wrapper
    return func(*args, **options)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/plot/", line 1930, in plot
    G = funcs.plot(*args, **original_opts)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/", line 113, in plot
    G += plot.points([P[0:2] for P in self.points() if not P.is_zero()], *args, **kwds)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/", line 214, in points
    v = self._points_via_group_structure()
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/", line 156, in _points_via_group_structure
    for m in range(1,ni[0]):
OverflowError: Python int too large to convert to C long
edit retag flag offensive close merge delete


Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2017-12-26 13:17:39 -0500 )edit

Looks like a bug. Would be good to have a better-formatted traceback though.

Iguananaut gravatar imageIguananaut ( 2018-01-05 09:12:44 -0500 )edit

@Iguananaut -- traceback is now formatted properly.

slelievre gravatar imageslelievre ( 2018-01-05 18:29:42 -0500 )edit

As a curiosity i tried plot( EllipticCurve(GF(2017), [0,0,0,0,7]) ) and the picture was a "blur", where i could not even figure out the symmetry immediately. (Or if there are more then $2017$ points.) But the picture convinced me that all the points were computed, than shown somehow (by mapping GF(2017) on the axes).

Then i tried plot( EllipticCurve(GF((2^30).next_prime()), [0,0,0,0,7]) ) and i would have been glad to get the OverflowError, instead, the machine really started again seriously to compute all the points, and i lost control. There was no chance to start a terminal in the next minutes, to get the process, and kill it.

So which should be the reason / the sense for getting some "statistical picture" for such a big prime, as the posted one?

dan_fulea gravatar imagedan_fulea ( 2018-01-06 08:39:18 -0500 )edit