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

asked 2017-12-24 19:13:11 +0100

DarkAgedBeer gravatar image

updated 2018-01-06 01:29:02 +0100

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])
plot(E)

produces the following error:

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

  File "/tmp/tmp1ZsAfB/___code___.py", 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/decorators.py", line 564, in wrapper
    return func(*args, **options)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1930, in plot
    G = funcs.plot(*args, **original_opts)
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_finite_field.py", 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/ell_finite_field.py", line 214, in points
    v = self._points_via_group_structure()
  File "/opt/SageMath/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_finite_field.py", 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

Comments

Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2017-12-26 20:17:39 +0100 )edit

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

Iguananaut gravatar imageIguananaut ( 2018-01-05 16:12:44 +0100 )edit

@Iguananaut -- traceback is now formatted properly.

slelievre gravatar imageslelievre ( 2018-01-06 01:29:42 +0100 )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 15:39:18 +0100 )edit