Opened 7 years ago

Closed 6 years ago

#12403 closed defect (invalid)

calculating elliptic curve order gives pari error

Reported by: mariah Owned by: cremona
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: elliptic curves Keywords:
Cc: Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:


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
sage: print a
sage: print b
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
-> 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/ in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:49380)()

PariError:  (5)

Change History (7)

comment:1 Changed 7 years ago by cremona

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')
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.

comment:2 Changed 7 years ago by jdemeyer

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/ in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:48677)()

PariError:  (5)

comment:3 Changed 6 years ago by cremona

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/ 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?

comment:4 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:5 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.13 to sage-duplicate/invalid/wontfix
  • Reviewers set to Jeroen Demeyer
  • Status changed from new to needs_review

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...

comment:6 Changed 6 years ago by jdemeyer

  • Status changed from needs_review to positive_review

comment:7 Changed 6 years ago by jdemeyer

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.