Cardinality of 512-bit curve

127 views
Skip to first unread message

sea21

unread,
May 15, 2013, 4:05:36 AM5/15/13
to sage-s...@googlegroups.com
I would like to compute the cardinality of a 512-bit curve in Sage. For example, for y^2 = x^3 + a4.x + a6 mod p where

p=10566623376041669505825220895462627801380145726624712771836144280024219722297939525451022774579043146020265329009462778097121538072213487555318041328039599
a4=6557325753041215216697541661243177462316789827714644669153173743634615853451990973713919498189870050066222585898470391225455349541996119434962754618249308
a6=3887529832007272230349363633177495741990999092935596186265775681498612008751646149414901742385996951003068331698140100902826619262789957720578797201032523

When I tried to do so using the E.cardinality() function,

E = EllipticCurve(GF(p),[a4,a6])
#n = E.order()

I got the error similar to what was mentioned here: http://trac.sagemath.org/sage_trac/ticket/12403

When I tried to compute the order directly using GP with:

E = gp.ellinit([a4,a6],p)
ap = E.ellap(E,p)
n = p+1-ap

I got the following error:

*** at top-level..e[9] = ellinit(sage[7],sage[8])
***
*** overflow in t_INT-->long assignment

May I know how to work around this problem? Any help is greatly appreciated!





Jeroen Demeyer

unread,
May 15, 2013, 4:22:47 AM5/15/13
to sage-s...@googlegroups.com
On 05/15/2013 10:05 AM, sea21 wrote:
> E = gp.ellinit([a4,a6],p)
> ap = E.ellap(E,p)

You have the syntax wrong, it should be

sage: E = gp.ellinit([0,0,0,a4,a6])
sage: ap = E.ellap(p)

sea21

unread,
May 15, 2013, 4:57:29 AM5/15/13
to sage-s...@googlegroups.com
I see. Thanks for the correction! But when I typed in the right syntax, I then encountered the error:

*** at top-level: sage[9] = ellap(sage[7],sage[8]
***                                   ^----------------------
*** ellap: not enough modular polynomials

Jeroen Demeyer

unread,
May 15, 2013, 5:25:25 AM5/15/13
to sage-s...@googlegroups.com
On 05/15/2013 10:57 AM, sea21 wrote:
> I see. Thanks for the correction! But when I typed in the right syntax,
> I then encountered the error:
>
> *** at top-level: sage[9] = ellap(sage[7],sage[8]
> *** ^----------------------
> *** ellap: not enough modular polynomials

The PARI package in Sage only has the "small" database of modular
polynomials, suitable for primes up to about 350 bits. You would need
the full seadata database.

John Cremona

unread,
May 15, 2013, 5:47:31 AM5/15/13
to SAGE support
See http://pari.math.u-bordeaux.fr/packages.html. It should be easy
to download that and put it in the right place in the Sage
installation, which is SAGE_ROOT/local/shar/pari. There is already
the seadata in there but as Jeroen says, it is the small version.

John

>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

John Cremona

unread,
May 15, 2013, 8:07:48 AM5/15/13
to SAGE support
On 15 May 2013 10:47, John Cremona <john.c...@gmail.com> wrote:
> On 15 May 2013 10:25, Jeroen Demeyer <jdem...@cage.ugent.be> wrote:
>> On 05/15/2013 10:57 AM, sea21 wrote:
>>>
>>> I see. Thanks for the correction! But when I typed in the right syntax,
>>> I then encountered the error:
>>>
>>> *** at top-level: sage[9] = ellap(sage[7],sage[8]
>>> *** ^----------------------
>>> *** ellap: not enough modular polynomials
>>
>>
>> The PARI package in Sage only has the "small" database of modular
>> polynomials, suitable for primes up to about 350 bits. You would need the
>> full seadata database.
>
> See http://pari.math.u-bordeaux.fr/packages.html. It should be easy
> to download that and put it in the right place in the Sage
> installation, which is SAGE_ROOT/local/shar/pari. There is already
> the seadata in there but as Jeroen says, it is the small version.

I tested this. AFter putting the large seadata files into that place the code

sage: p
10566623376041669505825220895462627801380145726624712771836144280024219722297939525451022774579043146020265329009462778097121538072213487555318041328039599
sage: a4
6557325753041215216697541661243177462316789827714644669153173743634615853451990973713919498189870050066222585898470391225455349541996119434962754618249308
sage: a6
3887529832007272230349363633177495741990999092935596186265775681498612008751646149414901742385996951003068331698140100902826619262789957720578797201032523
sage: E = gp.ellinit([0,0,0,a4,a6])
sage: sage: ap = E.ellap(p)

runs fine.

John

sea21

unread,
May 15, 2013, 9:27:23 AM5/15/13
to sage-s...@googlegroups.com
Thanks for all the helpful replies! I understand the problem now. How do I install the full seadata package if I am using the Windows version of Sage on Virtual Box?

leif

unread,
May 15, 2013, 1:45:07 PM5/15/13
to sage-s...@googlegroups.com
sea21 wrote:
> Thanks for all the helpful replies! I understand the problem now. How do
> I install the full seadata package if I am using the Windows version of
> Sage on Virtual Box?

I don't know what the (Linux distribution of the) ova ships with, and
depends on whether you at all have internet access from the virtual machine.

Just download
http://pari.math.u-bordeaux.fr/pub/pari/packages/seadata.tgz (probably
from Windows), copy the file into some temporary directory in your
virtual machine, start a shell and change to that directory, and there do

$ tar xzf seadata.tgz # extract the GNU-zip-compressed tar
$ cp data/seadata/* "$SAGE_ROOT"/local/share/pari/seadata/
$ rm -rf data/

where $SAGE_ROOT is what

sage: print SAGE_ROOT

gives, the "root" of your Sage installation.

(You can of course delete seadata.tgz afterwards as well.)


Would it be worth providing an optional Sage package for this, for
convenience? (It would also be slightly smaller than PARI's .tgz ...)


-leif


> On Wednesday, May 15, 2013 8:07:48 PM UTC+8, John Cremona wrote:
>
> On 15 May 2013 10:47, John Cremona <john.c...@gmail.com
> >> The PARI package in Sage only has the "small" database of modular
> >> polynomials, suitable for primes up to about 350 bits. You would
> need the
> >> full seadata database.
> >
> > See http://pari.math.u-bordeaux.fr/packages.html
> <http://pari.math.u-bordeaux.fr/packages.html>. It should be easy
> > to download that and put it in the right place in the Sage
> > installation, which is SAGE_ROOT/local/shar/pari. There is already
> > the seadata in there but as Jeroen says, it is the small version.
>
> I tested this. AFter putting the large seadata files into that
> place the code
>
> sage: p
> 10566623376041669505825220895462627801380145726624712771836144280024219722297939525451022774579043146020265329009462778097121538072213487555318041328039599
>
> sage: a4
> 6557325753041215216697541661243177462316789827714644669153173743634615853451990973713919498189870050066222585898470391225455349541996119434962754618249308
>
> sage: a6
> 3887529832007272230349363633177495741990999092935596186265775681498612008751646149414901742385996951003068331698140100902826619262789957720578797201032523
>
> sage: E = gp.ellinit([0,0,0,a4,a6])
> sage: sage: ap = E.ellap(p)
>
> runs fine.

--
() The ASCII Ribbon Campaign
/\ Help Cure HTML E-Mail

John Cremona

unread,
May 15, 2013, 3:34:36 PM5/15/13
to SAGE support
On 15 May 2013 18:45, leif <not.r...@online.de> wrote:
> sea21 wrote:
>>
>> Thanks for all the helpful replies! I understand the problem now. How do
>> I install the full seadata package if I am using the Windows version of
>> Sage on Virtual Box?
>
>
> I don't know what the (Linux distribution of the) ova ships with, and
> depends on whether you at all have internet access from the virtual machine.
>
> Just download http://pari.math.u-bordeaux.fr/pub/pari/packages/seadata.tgz
> (probably from Windows), copy the file into some temporary directory in your
> virtual machine, start a shell and change to that directory, and there do
>
> $ tar xzf seadata.tgz # extract the GNU-zip-compressed tar
> $ cp data/seadata/* "$SAGE_ROOT"/local/share/pari/seadata/
> $ rm -rf data/
>
> where $SAGE_ROOT is what
>
> sage: print SAGE_ROOT
>
> gives, the "root" of your Sage installation.
>
> (You can of course delete seadata.tgz afterwards as well.)
>
>
> Would it be worth providing an optional Sage package for this, for
> convenience? (It would also be slightly smaller than PARI's .tgz ...)

I think it would. It would be a very simple spkg, but preferably we
should also try to catch situations when installing it would help the
user and prompt them to install it.

John

sea21

unread,
May 15, 2013, 8:56:59 PM5/15/13
to sage-s...@googlegroups.com
Thank you all for your prompt responses! It works fine for me now! =) It would definitely be useful to have an optional Sage package for this.

John Cremona

unread,
May 16, 2013, 4:23:54 AM5/16/13
to SAGE support
See http://trac.sagemath.org/sage_trac/ticket/14596 where all that is
needed is for someone to do the work!

John

John Cremona

unread,
May 20, 2013, 6:01:30 AM5/20/13
to SAGE support
Thanks to Jeroen for making this -- the spkg now exists and is
currently being spread around Sage's mirror sites. When that is done,
this will work:

sage: install_package("database_pari")


(assuming that you have write permission in the Sage directory where
files will be installed).

John
Reply all
Reply to author
Forward
0 new messages