Function: ellinit
Section: elliptic_curves
C-Name: ellinit
Prototype: GDGp
Help: ellinit(x,{D=1}): let x be a vector [a1,a2,a3,a4,a6], or [a4,a6] if
 a1=a2=a3=0, defining the curve Y^2 + a1.XY + a3.Y = X^3 + a2.X^2 + a4.X +
 a6; x can also be a string, in which case the curve with matching name is
 retrieved from the elldata database, if available. This function initializes
 an elliptic curve over the domain D (inferred from coefficients if omitted).
Description:
 (gen, gen, small):ell:prec  ellinit($1, $2, $prec)
Doc:
 initialize an \tet{ell} structure, attached to the elliptic curve $E$.
 $E$ is either

 \item 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}, $$

 \item a $2$-component vector $[a_{4},a_{6}]$ defining the elliptic
 curve with short Weierstrass equation
 $$ Y^{2} = X^{3} + a_{4} X + a_{6}, $$

 \item a single-component vector $[j]$ giving the $j$-invariant for the curve,
 with the same coefficients as given by \kbd{ellfromj}.

 \item a character string in Cremona's notation, e.g. \kbd{"11a1"}, in which
 case the curve is retrieved from the \tet{elldata} database if available.

 The optional argument $D$ describes the domain over which the curve is
 defined:

 \item the \typ{INT} $1$ (default): the field of rational numbers $\Q$.

 \item a \typ{INT} $p$, where $p$ is a prime number: the prime finite field
 $\F_{p}$.

 \item an \typ{INTMOD} \kbd{Mod(a, p)}, where $p$ is a prime number: the
 prime finite field $\F_{p}$.

 \item a \typ{FFELT}, as returned by \tet{ffgen}: the corresponding finite
 field $\F_{q}$.

 \item a \typ{PADIC}, $O(p^{n})$: the field $\Q_{p}$, where $p$-adic quantities
 will be computed to a relative accuracy of $n$ digits. We advise to input a
 model defined over $\Q$ for such curves. In any case, if you input an
 approximate model with \typ{PADIC} coefficients, it will be replaced by a lift
 to $\Q$ (an exact model ``close'' to the one that was input) and all quantities
 will then be computed in terms of this lifted model, at the given accuracy.

 \item a \typ{REAL} $x$: the field $\C$ of complex numbers, where floating
 point quantities are by default computed to a relative accuracy of
 \kbd{precision}$(x)$. If no such argument is given, the value of
 \kbd{realprecision} at the time \kbd{ellinit} is called will be used.

 \item a number field $K$, given by a \kbd{nf} or \kbd{bnf} structure; a
 \kbd{bnf} is required for \kbd{ellminimalmodel}.

 \item a prime ideal $\goth{p}$, given by a \kbd{prid} structure; valid if
 $x$ is a curve defined over a number field $K$ and the equation is integral
 and minimal at $\goth{p}$.

 This argument $D$ is indicative: the curve coefficients are checked for
 compatibility, possibly changing $D$; for instance if $D = 1$ and
 an \typ{INTMOD} is found. If inconsistencies are detected, an error is
 raised:
 \bprog
 ? ellinit([1 + O(5), 1], O(7));
  ***   at top-level: ellinit([1+O(5),1],O
  ***                 ^--------------------
  *** ellinit: inconsistent moduli in ellinit: 7 != 5
 @eprog\noindent If the curve coefficients are too general to fit any of the
 above domain categories, only basic operations, such as point addition, will
 be supported later.

 If the curve (seen over the domain $D$) is singular, fail and return an
 empty vector $[]$.
 \bprog
 ? E = ellinit([0,0,0,0,1]); \\ y^2 = x^3 + 1, over Q
 ? E = ellinit([0,1]);       \\ the same curve, short form
 ? E = ellinit("36a1");      \\ sill the same curve, Cremona's notations
 ? E = ellinit([0]);         \\ a curve of j-invariant 0
 ? E = ellinit([0,1], 2)     \\ over F2: singular curve
 %4 = []
 ? E = ellinit(['a4,'a6] * Mod(1,5));  \\ over F_5[a4,a6], basic support !
 @eprog\noindent Note that the given curve of $j$-invariant $0$ happens
 to be \kbd{36a1} but a priori any model for an arbitrary twist could have
 been returned. See \kbd{ellfromj}.

 The result of \tet{ellinit} is an \tev{ell} structure. It contains at least
 the following information in its components:
 %
 $$ a_{1},a_{2},a_{3},a_{4},a_{6},b_{2},b_{4},b_{6},b_{8},c_{4},c_{6},
   \Delta,j.$$
 %
 All are accessible via member functions. In particular, the discriminant is
 \kbd{$E$.disc}, and the $j$-invariant is \kbd{$E$.j}.
 \bprog
 ? E = ellinit([a4, a6]);
 ? E.disc
 %2 = -64*a4^3 - 432*a6^2
 ? E.j
 %3 = -6912*a4^3/(-4*a4^3 - 27*a6^2)
 @eprog
 Further components contain domain-specific data, which are in general dynamic:
 only computed when needed, and then cached in the structure.
 \bprog
 ? E = ellinit([2,3], 10^60+7);  \\ E over F_p, p large
 ? ellap(E)
 time = 4,440 ms.
 %2 = -1376268269510579884904540406082
 ? ellcard(E);  \\ now instantaneous !
 time = 0 ms.
 ? ellgenerators(E);
 time = 5,965 ms.
 ? ellgenerators(E); \\ second time instantaneous
 time = 0 ms.
 @eprog
 See the description of member functions related to elliptic curves at the
 beginning of this section.
