Ask Your Question

Revision history [back]

The reference manual describes cardinality as

cardinality(algorithm=None, extension_degree=1)

which means that the default value for the argument is None. The code says

    if algorithm is None:
        # Check for j in subfield
        jpol = self.j_invariant().minimal_polynomial()
        if jpol.degree() < self.base_field().degree():
            algorithm = "subfield"
        else:
            algorithm = "pari"

So if you are working over a prime field, for example, the algorithm is "pari": "use the PARI C-library function ellcard", according to the reference manual. This pari function is documented here.

By the way, to see the source code, you can do

sage: E = EllipticCurve(GF(10007), [1,2,3,4,5])
sage: E.cardinality??

The reference manual describes cardinality as

cardinality(algorithm=None, extension_degree=1)

which means that the default value for the argument is None. The code says

    if algorithm is None:
        # Check for j in subfield
        jpol = self.j_invariant().minimal_polynomial()
        if jpol.degree() < self.base_field().degree():
            algorithm = "subfield"
        else:
            algorithm = "pari"

So if you are working over a prime field, for example, the algorithm is "pari": "use the PARI C-library function ellcard", according to the reference manual. This pari function is documented here.. (Click on "Elliptic curves" in the menu on the left, then "ellcard" at the top. I don't see how to give a precise link to the page.)

By the way, to see the source code, you can do

sage: E = EllipticCurve(GF(10007), [1,2,3,4,5])
sage: E.cardinality??