(19:16) gp > 2+2 \\ basic (and \\ is the "comment to end of line" character sequence) %1 = 4 (19:16) gp > 100! \\ not as basic %2 = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 (19:17) gp > ? \\ type ? to get help Help topics: for a list of relevant subtopics, type ?n for n in 0: user-defined functions (aliases, installed and user functions) 1: PROGRAMMING under GP 2: Standard monadic or dyadic OPERATORS 3: CONVERSIONS and similar elementary functions 4: functions related to COMBINATORICS 5: NUMBER THEORETICAL functions 6: POLYNOMIALS and power series 7: Vectors, matrices, LINEAR ALGEBRA and sets 8: TRANSCENDENTAL functions 9: SUMS, products, integrals and similar functions 10: General NUMBER FIELDS 11: Associative and central simple ALGEBRAS 12: ELLIPTIC CURVES 13: L-FUNCTIONS 14: HYPERGEOMETRIC MOTIVES 15: MODULAR FORMS 16: MODULAR SYMBOLS 17: GRAPHIC functions 18: The PARI community Also: ? functionname (short on-line help) ?\ (keyboard shortcuts) ?. (member functions) Extended help (if available): ?? (opens the full user's manual in a dvi previewer) ?? tutorial / refcard / libpari (tutorial/reference card/libpari manual) ?? refcard-ell (or -lfun/-mf/-nf: specialized reference card) ?? keyword (long help text about "keyword" from the user's manual) ??? keyword (a propos: list of related functions). (19:17) gp > ?12 \\ lots of elliptic curve functions ell2cover ellL1 elladd ellak ellan ellanalyticrank ellap ellbil ellbsd ellcard ellchangecurve ellchangepoint ellchangepointinv ellconvertname elldivpol elleisnum elleta ellformaldifferential ellformalexp ellformallog ellformalpoint ellformalw ellfromeqn ellfromj ellgenerators ellglobalred ellgroup ellheegner ellheight ellheightmatrix ellidentify ellinit ellintegralmodel elliscm ellisdivisible ellisisom ellisogeny ellisogenyapply ellisomat ellisoncurve ellisotree ellissupersingular ellj elllocalred elllog elllseries ellmaninconstant ellminimaldisc ellminimalmodel ellminimaltwist ellmoddegree ellmodulareqn ellmul ellneg ellnonsingularmultiple ellorder ellordinate ellpadicL ellpadicbsd ellpadicfrobenius ellpadicheight ellpadicheightmatrix ellpadiclambdamu ellpadiclog ellpadicregulator ellpadics2 ellperiods ellpointtoz ellpow ellrank ellrankinit ellratpoints ellrootno ellsaturation ellsea ellsearch ellsigma ellsub ellsupersingularj elltamagawa elltaniyama elltatepairing elltors elltrace elltwist ellweilcurve ellweilpairing ellwp ellxn ellzeta ellztopoint genus2igusa genus2red hyperellchangecurve hyperellcharpoly hyperelldisc hyperellisoncurve hyperellminimaldisc hyperellminimalmodel hyperellordinate hyperellpadicfrobenius hyperellratpoints hyperellred (19:17) gp > ??ellinit \\ see long help description. this is the basic function to create an elliptic curve. ellinit(x,{D = 1}): Initialize an ell structure, attached to the elliptic curve E. E is either * 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, * 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, * a single-component vector [j] giving the j-invariant for the curve, with the same coefficients as given by ellfromj. * a character string in Cremona's notation, e.g. "11a1", in which case the curve is retrieved from the elldata database if available. The optional argument D describes the domain over which the curve is defined: * the t_INT 1 (default): the field of rational numbers Q. * a t_INT p, where p is a prime number: the prime finite field F_p. * an t_INTMOD Mod(a, p), where p is a prime number: the prime finite field F_p. * a t_FFELT, as returned by ffgen: the corresponding finite field F_q. * a t_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 t_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. * a t_REAL x: the field C of complex numbers, where floating point quantities are by default computed to a relative accuracy of precision(x). If no such argument is given, the value of realprecision at the time ellinit is called will be used. * a number field K, given by a nf or bnf structure; a bnf is required for ellminimalmodel. * a prime ideal p, given by a prid structure; valid if x is a curve defined over a number field K and the equation is integral and minimal at p. This argument D is indicative: the curve coefficients are checked for compatibility, possibly changing D; for instance if D = 1 and an t_INTMOD is found. If inconsistencies are detected, an error is raised: ? ellinit([1 + O(5), 1], O(7)); *** at top-level: ellinit([1+O(5),1],O *** ^-------------------- *** ellinit: inconsistent moduli in ellinit: 7 != 5 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 []. ? 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 ! Note that the given curve of j-invariant 0 happens to be 36a1 but a priori any model for an arbitrary twist could have been returned. See ellfromj. The result of ellinit is an 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 E.disc, and the j-invariant is E.j. ? 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) Further components contain domain-specific data, which are in general dynamic: only computed when needed, and then cached in the structure. ? 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. See the description of member functions related to elliptic curves at the beginning of this section. The library syntax is GEN ellinit(GEN x, GEN D = NULL, long prec). (19:19) gp > E=ellinit([0,0,1,-1,0]); \\ create a curve: y^2 + y = x^3 - x (19:19) gp > E.disc \\ compute the discriminant %11 = 37 (19:19) gp > ellmul(E,[1,0],2) \\ the point [1,0] is on the curve. we add it to itself %12 = [2, -3] \\ another integral point! (19:19) gp > ellmul(E,[1,0],3) \\ add it to itself again %13 = [6, 14] \\ another integral point! keep going ... (19:19) gp > ellmul(E,[1,0],4) %14 = [21/25, -69/125] \\ now we get a rational point. (19:19) gp > ellmul(E,[1,0],30) \\ a big power %15 = [66655479518893093532610447590226207125008330695731551720689810858664307580428417/64306155925826880652595949502924121830241952030421058718245264927903618004613696, 37099833646931979795412752491422144674264172085897667624782588245824685511999607108486631714856683592319113463437251647/515678261274970050690720243326795935102918476455278851661194453945419125879781902089109063686544638388734206391398176256] \\ huge rational point. (19:19) gp > ellmul(E,[1,0],-1) \\ negative powers work too, because E(Q) is an abelian group %16 = [1, -1] (19:19) gp > ellmul(E,[1,0],-2) %17 = [2, 2] (19:19) gp > elladd(E,%13,%14) \\ add two points together %18 = [18526/16641, -2616119/2146689] (19:20) gp > ellmul(E,[1,0],7) \\ should be 7th power of [1,0] %19 = [18526/16641, -2616119/2146689] \\ yes it works. (19:20) gp > \\ Ctrl-D exits Goodbye!