Pari/GP Reference Documentation  Contents - Index - Meta commands

Functions related to elliptic curves

elladd   ellak   ellan   ellap   ellbil   ellchangecurve   ellchangepoint   ellconvertname   elleisnum   elleta   ellgenerators   ellglobalred   ellheight   ellheightmatrix   ellidentify   ellinit   ellisoncurve   ellj   elllocalred   elllseries   ellminimalmodel   ellorder   ellordinate   ellpointtoz   ellpow   ellrootno   ellsearch   ellsigma   ellsub   elltaniyama   elltors   ellwp   ellzeta   ellztopoint  

sum of the points z1 and z2 on the elliptic curve corresponding to E.

The library syntax is addell(E,z1,z2).


computes the coefficient a_n of the L-function of the elliptic curve E, principle coefficients of a newform of weight 2 assuming Taniyama-Weil conjecture (which is now known to hold in full generality thanks to the work of Breuil, Conrad, Diamond, Taylor and Wiles). E must be an sell as output by ellinit. For this function to work for every n and not just those prime to the conductor, E must be a minimal Weierstrass equation. If this is not the case, use the function ellminimalmodel before using ellak.

The library syntax is akell(E,n).


computes the vector of the first n a_k corresponding to the elliptic curve E. All comments in ellak description remain valid.

The library syntax is anell(E,n), where n is a C integer.

ellap(E,p,{flag = 0})  

computes the a_p corresponding to the elliptic curve E and the prime number p. These are defined by the equation #E(F_p) = p+1 - a_p, where #E(F_p) stands for the number of points of the curve E over the finite field F_p. When flag is 0, this uses the baby-step giant-step method and a trick due to Mestre. This runs in time O(p^{1/4}) and requires O(p^{1/4}) storage, hence becomes unreasonable when p has about 30 digits.

If flag is 1, computes the a_p as a sum of Legendre symbols. This is slower than the previous method as soon as p is greater than 100, say.

No checking is done that p is indeed prime. E must be an sell as output by ellinit, defined over Q, F_p or Q_p. E must be given by a Weierstrass equation minimal at p.

The library syntax is ellap0(E,p,flag). Also available are apell(E,p), corresponding to flag = 0, and apell2(E,p) (flag = 1).


if z1 and z2 are points on the elliptic curve E, assumed to be integral given by a minimal model, this function computes the value of the canonical bilinear form on z1, z2: ( h(E,z1 +z2) - h(E,z1) - h(E,z2) ) / 2 where + denotes of course addition on E. In addition, z1 or z2 (but not both) can be vectors or matrices.

The library syntax is bilhell(E,z1,z2,prec).


changes the data for the elliptic curve E by changing the coordinates using the vector v = [u,r,s,t], i.e.if x' and y' are the new coordinates, then x = u^2x'+r, y = u^3y'+su^2x'+t. E must be an sell as output by ellinit.

The library syntax is coordch(E,v).


changes the coordinates of the point or vector of points x using the vector v = [u,r,s,t], i.e.if x' and y' are the new coordinates, then x = u^2x'+r, y = u^3y'+su^2x'+t (see also ellchangecurve).

The library syntax is pointch(x,v).


converts an elliptic curve name, as found in the elldata database, from a string to a triplet [conductor, isogeny class, index]. It will also convert a triplet back to a curve name. Examples:

? ellconvertname("123b1")
 %1 = [123, 1, 1]
 ? ellconvertname(%)
 %2 = "123b1"

The library syntax is ellconvertname(name).

elleisnum(E,k,{flag = 0})  

E being an elliptic curve as output by ellinit (or, alternatively, given by a 2-component vector [omega_1,omega_2] representing its periods), and k being an even positive integer, computes the numerical value of the Eisenstein series of weight k at E, namely

(2i Pi/omega_2)^k (1 + 2/zeta(1-k) sum_{n >= 0} n^{k-1}q^n / (1-q^n)),

where q = e(omega_1/omega_2).

When flag is non-zero and k = 4 or 6, returns the elliptic invariants g_2 or g_3, such that y^2 = 4x^3 - g_2 x - g_3 is a Weierstrass equation for E.

The library syntax is elleisnum(E,k,flag).


returns the two-component row vector [eta_1,eta_2] of quasi-periods associated to om = [omega_1, omega_2]

The library syntax is elleta(om, prec)


returns a Z-basis of the free part of the Mordell-Weil group associated to E. This function depends on the elldata database being installed and referencing the curve, and so is only available for curves over Z of small conductors.

The library syntax is ellgenerators(E).


calculates the arithmetic conductor, the global minimal model of E and the global Tamagawa number c. E must be an sell as output by ellinit, and is supposed to have all its coefficients a_i in Q. The result is a 3 component vector [N,v,c]. N is the arithmetic conductor of the curve. v gives the coordinate change for E over Q to the minimal integral model (see ellminimalmodel). Finally c is the product of the local Tamagawa numbers c_p, a quantity which enters in the \idx{Birch and Swinnerton-Dyer conjecture}.

The library syntax is ellglobalred(E).

ellheight(E,z,{flag = 2})  

global Néron-Tate height of the point z on the elliptic curve E (defined over Q), given by a standard minimal integral model. E must be an ell as output by ellinit. flag selects the algorithm used to compute the archimedean local height. If flag = 0, this computation is done using sigma and theta-functions and a trick due to J. Silverman. If flag = 1, use Tate's 4^n algorithm. If flag = 2, use Mestre's AGM algorithm. The latter is much faster than the other two, both in theory (converges quadratically) and in practice.

The library syntax is ellheight0(E,z,flag,prec). Also available are ghell(E,z,prec) (flag = 0) and ghell2(E,z,prec) (flag = 1).


x being a vector of points, this function outputs the Gram matrix of x with respect to the Néron-Tate height, in other words, the (i,j) component of the matrix is equal to ellbil(E,x[i],x[j]). The rank of this matrix, at least in some approximate sense, gives the rank of the set of points, and if x is a basis of the Mordell-Weil group of E, its determinant is equal to the regulator of E. Note that this matrix should be divided by 2 to be in accordance with certain normalizations. E is assumed to be integral, given by a minimal model.

The library syntax is mathell(E,x,prec).


look up the elliptic curve E (over Z) in the elldata database and return [[N, M, G], C] where N is the name of the curve in J. E. Cremona database, M the minimal model, G a Z-basis of the free part of the Mordell-Weil group of E and C the coordinates change (see ellchangecurve).

The library syntax is ellidentify(E).

ellinit(E,{flag = 0})  

initialize an ell structure, associated to the elliptic curve E. E is a 5-component vector [a_1,a_2,a_3,a_4,a_6] defining the elliptic curve with Weierstrass equation Y^2 + a_1 XY + a_3 Y = X^3 + a_2 X^2 + a_4 X + a_6 or a string, in this case the coefficients of the curve with matching name are looked in the elldata database if available. For the time being, only curves over a prime field F_p and over the p-adic or real numbers (including rational numbers) are fully supported. Other domains are only supported for very basic operations such as point addition.

The result of ellinit is a an ell structure by default, and a shorted sell if flag = 1. Both contain the following information in their components:


All are accessible via member functions. In particular, the discriminant is E.disc, and the j-invariant is E.j.

The other six components are only present if flag is 0 or omitted. Their content depends on whether the curve is defined over R or not:

* When E is defined over R, E.roots is a vector whose three components contain the roots of the right hand side of the associated Weierstrass equation. (y + a_1x/2 + a_3/2)^2 = g(x) If the roots are all real, then they are ordered by decreasing value. If only one is real, it is the first component.

Then omega_1 =[1] is the real period of E (integral of dx/(2y+a_1x+a_3) over the connected component of the identity element of the real points of the curve), and omega_2 =[2] is a complex period. In other words, forms a basis of the complex lattice defining E, with tau = (omega_2)/(omega_1) having positive imaginary part.

E.eta is a row vector containing the corresponding values eta_1 and eta_2 such that eta_1omega_2-eta_2omega_1 = iPi.

Finally, E.area is the volume of the complex lattice defining E.

* When E is defined over Q_p, the p-adic valuation of j must be negative. Then E.roots is the vector with a single component equal to the p-adic root of the associated Weierstrass equation corresponding to -1 under the Tate parametrization.

E.tate yields the three-component vector [u^2,u,q], in the notations of Tate. If the u-component does not belong to Q_p, it is set to zero.

E.w is Mestre's w (this is technical).

For all other base fields or rings, the last six components are arbitrarily set equal to zero. See also the description of member functions related to elliptic curves at the beginning of this section.

The library syntax is ellinit0(E,flag,prec). Also available are initell(E,prec) (flag = 0) and smallinitell(E,prec) (flag = 1).


gives 1 (i.e.true) if the point z is on the elliptic curve E, 0 otherwise. If E or z have imprecise coefficients, an attempt is made to take this into account, imprecise equality is checked, not a precise one. It is allowed for z to be a vector of points in which case a vector (of the same type) is returned.

The library syntax is ellisoncurve(E,z). Also available is oncurve(E,z) which returns a long but does not accept vector of points.


elliptic j-invariant. x must be a complex number with positive imaginary part, or convertible into a power series or a p-adic number with positive valuation.

The library syntax is jell(x,prec).


calculates the Kodaira type of the local fiber of the elliptic curve E at the prime p. E must be an sell as output by ellinit, and is assumed to have all its coefficients a_i in Z. The result is a 4-component vector [f,kod,v,c]. Here f is the exponent of p in the arithmetic conductor of E, and kod is the Kodaira type which is coded as follows:

1 means good reduction (type I_0), 2, 3 and 4 mean types II, III and IV respectively, 4+nu with nu > 0 means type I_nu; finally the opposite values -1, -2, etc.refer to the starred types I_0^*, II^*, etc. The third component v is itself a vector [u,r,s,t] giving the coordinate changes done during the local reduction. Normally, this has no use if u is 1, that is, if the given equation was already minimal. Finally, the last component c is the local Tamagawa number c_p.

The library syntax is elllocalred(E,p).

elllseries(E,s,{A = 1})  

E being an sell as output by ellinit, this computes the value of the L-series of E at s. It is assumed that E is defined over Q, not necessarily minimal. The optional parameter A is a cutoff point for the integral, which must be chosen close to 1 for best speed. The result must be independent of A, so this allows some internal checking of the function.

Note that if the conductor of the curve is large, say greater than 10^{12}, this function will take an unreasonable amount of time since it uses an O(N^{1/2}) algorithm.

The library syntax is elllseries(E,s,A,prec) where prec is a long and an omitted A is coded as NULL.


return the standard minimal integral model of the rational elliptic curve E. If present, sets v to the corresponding change of variables, which is a vector [u,r,s,t] with rational components. The return value is identical to that of ellchangecurve(E, v).

The resulting model has integral coefficients, is everywhere minimal, a_1 is 0 or 1, a_2 is 0, 1 or -1 and a_3 is 0 or 1. Such a model is unique, and the vector v is unique if we specify that u is positive, which we do.

The library syntax is ellminimalmodel(E,&v), where an omitted v is coded as NULL.


gives the order of the point z on the elliptic curve E if it is a torsion point, zero otherwise. In the present version 2.3.1, this is implemented only for elliptic curves defined over Q.

The library syntax is orderell(E,z).


gives a 0, 1 or 2-component vector containing the y-coordinates of the points of the curve E having x as x-coordinate.

The library syntax is ordell(E,x).


if E is an elliptic curve with coefficients in R, this computes a complex number t (modulo the lattice defining E) corresponding to the point z, i.e.such that, in the standard Weierstrass model, wp(t) = z[1],wp'(t) = z[2]. In other words, this is the inverse function of ellztopoint. More precisely, if (w1,w2) are the real and complex periods of E, t is such that 0 <= Re(t) < w1 and 0 <= Im(t) < Im(w2).

If E has coefficients in Q_p, then either Tate's u is in Q_p, in which case the output is a p-adic number t corresponding to the point z under the Tate parametrization, or only its square is, in which case the output is t+1/t. E must be an ell as output by ellinit.

The library syntax is zell(E,z,prec).


computes n times the point z for the group law on the elliptic curve E. Here, n can be in Z, or n can be a complex quadratic integer if the curve E has complex multiplication by n (if not, an error message is issued).

The library syntax is powell(E,z,n).

ellrootno(E,{p = 1})  

E being an sell as output by ellinit, this computes the local (if p != 1) or global (if p = 1) root number of the L-series of the elliptic curve E. Note that the global root number is the sign of the functional equation and conjecturally is the parity of the rank of the Mordell-Weil group. The equation for E must have coefficients in Q but need not be minimal.

The library syntax is ellrootno(E,p) and the result (equal to ±1) is a long.

ellsigma(E,z,{flag = 0})  

value of the Weierstrass sigma function of the lattice associated to E as given by ellinit (alternatively, E can be given as a lattice [omega_1,omega_2]).

If flag = 1, computes an (arbitrary) determination of log(sigma(z)).

If flag = 2,3, same using the product expansion instead of theta series. The library syntax is ellsigma(E,z,flag)


if N is an integer, it is taken as a conductor else if N is a string, it can be a curve name ("11a1"), a isogeny class ("11a") or a conductor "11". This function finds all curves in the elldata database with the given property.

If N is a full curve name, the output format is [N, [a_1,a_2,a_3,a_4,a_6], G] where [a_1,a_2,a_3,a_4,a_6] are the coefficients of the Weierstrass equation of the curve and G is a Z-basis of the free part of the Mordell-Weil group associated to the curve.

If N is not a full-curve name, the output is the list (as a vector) of all matching curves in the above format.

The library syntax is ellsearch(N). Also available is ellsearchcurve(N) that only accept complete curve names.


difference of the points z1 and z2 on the elliptic curve corresponding to E.

The library syntax is subell(E,z1,z2).


computes the modular parametrization of the elliptic curve E, where E is an sell as output by ellinit, in the form of a two-component vector [u,v] of power series, given to the current default series precision. This vector is characterized by the following two properties. First the point (x,y) = (u,v) satisfies the equation of the elliptic curve. Second, the differential du/(2v+a_1u+a_3) is equal to f(z)dz, a differential form on H/Gamma_0(N) where N is the conductor of the curve. The variable used in the power series for u and v is x, which is implicitly understood to be equal to exp(2iPi z). It is assumed that the curve is a strong Weil curve, and that the Manin constant is equal to 1. The equation of the curve E must be minimal (use ellminimalmodel to get a minimal equation).

The library syntax is elltaniyama(E, prec), and the precision of the result is determined by prec.

elltors(E,{flag = 0})  

if E is an elliptic curve defined over Q, outputs the torsion subgroup of E as a 3-component vector [t,v1,v2], where t is the order of the torsion group, v1 gives the structure of the torsion group as a product of cyclic groups (sorted by decreasing order), and v2 gives generators for these cyclic groups. E must be an ell as output by ellinit.

?  E = ellinit([0,0,0,-1,0]);
 ?  elltors(E)
 %1 = [4, [2, 2], [[0, 0], [1, 0]]]

Here, the torsion subgroup is isomorphic to Z/2Z x Z/2Z, with generators [0,0] and [1,0].

If flag = 0, use Doud's algorithm: bound torsion by computing #E(F_p) for small primes of good reduction, then look for torsion points using Weierstrass parametrization (and Mazur's classification).

If flag = 1, use Lutz-Nagell (much slower), E is allowed to be an sell.

The library syntax is elltors0(E,flag).

ellwp(E,{z = x},{flag = 0})  

Computes the value at z of the Weierstrass wp function attached to the elliptic curve E as given by ellinit (alternatively, E can be given as a lattice [omega_1,omega_2]).

If z is omitted or is a simple variable, computes the power series expansion in z (starting z^{-2}+O(z^2)). The number of terms to an even power in the expansion is the default serieslength in gp, and the second argument (C long integer) in library mode.

Optional flag is (for now) only taken into account when z is numeric, and means 0: compute only wp(z), 1: compute [wp(z),wp'(z)].

The library syntax is ellwp0(E,z,flag,prec,precdl). Also available is weipell(E,precdl) for the power series.


value of the Weierstrass zeta function of the lattice associated to E as given by ellinit (alternatively, E can be given as a lattice [omega_1,omega_2]).

The library syntax is ellzeta(E,z).


E being an ell as output by ellinit, computes the coordinates [x,y] on the curve E corresponding to the complex number z. Hence this is the inverse function of ellpointtoz. In other words, if the curve is put in Weierstrass form, [x,y] represents the Weierstrass wp-function and its derivative. If z is in the lattice defining E over C, the result is the point at infinity [0].

The library syntax is pointell(E,z,prec).