Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculating elliptic curve order gives pari error #12403

Closed
sagetrac-mariah mannequin opened this issue Jan 31, 2012 · 5 comments
Closed

calculating elliptic curve order gives pari error #12403

sagetrac-mariah mannequin opened this issue Jan 31, 2012 · 5 comments

Comments

@sagetrac-mariah
Copy link
Mannequin

sagetrac-mariah mannequin commented Jan 31, 2012

eno% ./sage
----------------------------------------------------------------------
| Sage Version 4.8, Release Date: 2012-01-20                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: set_random_seed(27)
sage: p = random_prime(2^384)
sage: a = GF(p).random_element()
sage: b = GF(p).random_element()
sage: E = EllipticCurve(GF(p),[a,b])
sage: print p
7343037149100436320512287012186591372977812978999548800316656253586994474002392166664300268966498269593727414610897
sage: print a
6852114550047868513932176398247037756580119337424745363947727539575304412574447632263081819043246195900572610992345
sage: print b
5492632671151644324496491982874400186385432104409801615330646612989431109035309500901243860934881512248435502820545
sage: print E
Elliptic Curve defined by y^2 = x^3 + 6852114550047868513932176398247037756580119337424745363947727539575304412574447632263081819043246195900572610992345*x + 5492632671151644324496491982874400186385432104409801615330646612989431109035309500901243860934881512248435502820545 over Finite Field of size 7343037149100436320512287012186591372977812978999548800316656253586994474002392166664300268966498269593727414610897
sage: q = E.order()
---------------------------------------------------------------------------
PariError                                 Traceback (most recent call last)

/home/mariah/sage/sage-4.8-x86_64-Linux-core2-fc/<ipython console> in <module>()

/home/mariah/sage/sage-4.8-x86_64-Linux-core2-fc/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_finite_field.pyc in cardinality(self, algorithm, extension_degree)
    871                 algorithm = 'pari'
    872             if algorithm == 'pari':
--> 873                 N = self.cardinality_pari()
    874             elif algorithm == 'sea':
    875                 N = self.cardinality_pari()  # purely for backwards compatibility

/home/mariah/sage/sage-4.8-x86_64-Linux-core2-fc/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_finite_field.pyc in cardinality_pari(self)
   1061         p = k.characteristic()
   1062         if k.degree()==1:
-> 1063             return ZZ(p + 1 - int(self._pari_().ellap(p)))
   1064         else:
   1065             raise ValueError, "cardinality_pari() only works over prime fields."

/home/mariah/sage/sage-4.8-x86_64-Linux-core2-fc/local/lib/python2.6/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:49380)()

PariError:  (5)
sage: 

Component: elliptic curves

Reviewer: Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/12403

@sagetrac-mariah sagetrac-mariah mannequin added this to the sage-5.11 milestone Jan 31, 2012
@JohnCremona
Copy link
Member

comment:1

The documentation for pari's ellap function says that it can handle primes up to 200 digits with the seadata package installed, which Sage does; and this prime has 115 digits. I can compute the cardinality of this curve in gp directly, but only after increasing the stacksize to 32000000. Sage starts with it at 16000000, which seems to be the problem -- though of course this should be caught, say within a try/except block.

However, using Sage-4.8:

sage: pari.default('parisize')
16000000
sage: pari.default('parisize',32000000)
  ***   Warning: new stack size = 32000000 (30.518 Mbytes).
  ***   Error in the PARI system. End of program.

which is a rather serious bug. I will report that separately.

@jdemeyer
Copy link

jdemeyer commented Feb 1, 2012

comment:2

Just an observation: I get the same error with

sage: set_random_seed(27)
sage: p = random_prime(2^384)
sage: a = GF(p).random_element()
sage: b = GF(p).random_element()
sage: E = EllipticCurve(GF(p),[a,b])
sage: pari("ellap(%s,%s)"%(E._pari_init_(),p))
---------------------------------------------------------------------------
PariError                                 Traceback (most recent call last)

/usr/local/src/sage-5.0.beta1/<ipython console> in <module>()

/usr/local/src/sage-5.0.beta1/local/lib/python2.7/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:48677)()

PariError:  (5)

@JohnCremona
Copy link
Member

comment:3

With Sage 5.9 I get

----------------------------------------------------------------------
| Sage Version 5.9, Release Date: 2013-04-30                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
sage: set_random_seed(27)
sage: sage: p = random_prime(2^384)                                                                     
sage: sage: a = GF(p).random_element()                                                                  
sage: sage: b = GF(p).random_element()                                                                  
sage: sage: E = EllipticCurve(GF(p),[a,b])                                                              
sage: sage: pari("ellap(%s,%s)"%(E._pari_init_(),p))                                                    
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-6-1b990fd69ca7> in <module>()
----> 1 pari("ellap(%s,%s)"%(E._pari_init_(),p))

/home/jec/sage-5.9/local/lib/python2.7/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:56037)()

RuntimeError: _pari_trap recursion too deep

and I wonder if this still happens with the new pari version currently being tested?

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@jdemeyer
Copy link

jdemeyer commented Nov 2, 2013

comment:5

I guess the original problem is due to the fact that the optional database_pari package isn't installed. The _pari_trap recursion too deep error seems to be a different problem which I cannot reproduce. In any case, there is #9640 which vastly improves the PARI error handling.

Closing as invalid unless somebody convinces me that there is still a bug here...

@jdemeyer
Copy link

jdemeyer commented Nov 2, 2013

Reviewer: Jeroen Demeyer

@jdemeyer jdemeyer removed this from the sage-5.13 milestone Nov 2, 2013
@jdemeyer jdemeyer closed this as completed Nov 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants