# # To start a pari-gp session in linux you type "gp" in a termial # If you use window/mac you probably (?) have to click an icon. # desktop 101: gp # # start-up dialog # GP/PARI CALCULATOR Version 2.3.4 (released) amd64 running linux (x86-64 kernel) 64-bit version compiled: Dec 18 2009, gcc-4.4.1 (Ubuntu 4.4.1-4ubuntu8) (readline not compiled in, extended help available) Copyright (C) 2000-2006 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?12 for how to get moral (and possibly technical) support. parisize = 8000000, primelimit = 500000 # # parisize = "stack size" -- how much memory has been allocated to pari; # for simple calculation it doesn't matter, but for complicated # jobs you need to increase this (long story for another day) # primelimit = upper bounds of pre-computed primes in pari. In this case # the largest prime stored is prime(41581)=500509. You can # get more pre-computed primes at the cost of slower start-up # and more memory. # ? # # "?" is the pari-prompt. At this point you can start doing calculation. # If you want to know more about pari functions, just type "?" # ? ? Help topics: for a list of relevant subtopics, type ?n for n in 0: user-defined identifiers (variable, alias, function) 1: Standard monadic or dyadic OPERATORS 2: CONVERSIONS and similar elementary functions 3: TRANSCENDENTAL functions 4: NUMBER THEORETICAL functions 5: Functions related to ELLIPTIC CURVES 6: Functions related to general NUMBER FIELDS 7: POLYNOMIALS and power series 8: Vectors, matrices, LINEAR ALGEBRA and sets 9: SUMS, products, integrals and similar functions 10: GRAPHIC functions 11: PROGRAMMING under GP 12: The PARI community Also: ? functionname (short on-line help) ?\ (keyboard shortcuts) ?. (member functions) Extended help looks available: ?? (opens the full user's manual in a dvi previewer) ?? tutorial / refcard / libpari (tutorial/reference card/libpari manual) ?? keyword (long help text about "keyword" from the user's manual) ??? keyword (a propos: list of related functions). # # As you can see, elliptic curves functions are grouped under "topic 5". # To see all elliptic curves functions available, you can try: # ? ?5 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 # # Before you can do any computations you need to initize an elliptic curve; # here is the command: # ? ?ellinit ellinit(x,{flag=0}): x being the vector [a1,a2,a3,a4,a6] defining the curve Y^2 + a1.XY + a3.Y = X^3 + a2.X^2 + a4.X + a6, gives the vector: [a1,a2,a3,a4,a6,b2,b4,b6,b8,c4,c6,disc,j,[e1,e2,e3],w1,w2,eta1,eta2,area]. If the curve is defined over a p-adic field, the last six components are replaced by root,u^2,u,q,w,0. If optional flag is 1, omit them altogether. x can also be a string, in this case the coefficients of the curve with matching name are looked in the elldata database if available. # # As an example, take the curve y^2 = x^3 - x # ? e = ellinit([0,0,0,-1,0]) %1 = [0, 0, 0, -1, 0, 0, -2, 0, -1, 48, 0, 64, 1728, [1.0000000000000000000000000000000000000, 0.E-57, -1.0000000000000000000000000000000000000]~, 2.6220575542921198104648395898911194137, 2.6220575542921198104648395898911194137*I, -0.59907011736779610371996124614016193911, -1.7972103521033883111598837384204858173*I, 6.8751858180203728274900957798105571979] # # It's a long output! To surpress the output you put ";" at the end of the # command: # ? e = ellinit([0,0,0,-1,0]); # # As you can see from the help manual for "ellinit", this command output a # vector whose components are the basic invariants of a curve. Here is how # to extract a component of this output: # ? e[12] %3 = 64 # # The 12-th component is delta, the discriminant of the Weierstrass equation # (see the help manual above) # Note that the output says "%3" -- this is the 3rd computation of this # session: the first one is "ellinit", the second one is "ellinit" with ";". # This allows you to recall and reuse results in previous steps without having # to redo each calculation. # ? e[13] %4 = 1728 # # The 13-th component is the j-invariant. # # # Let's try other commands: # ? ?ellorder ellorder(e,p): order of the point p on the elliptic curve e over Q, 0 if non-torsion. ? ellorder(e,[0,0]) %5 = 2 # # This is in compatible with our observation that in a Weierstrass equation # with a_1 = a_3 = 0, a point has order 2 if and only if its y-coordinate # is zero # ? ellorder(e,[1,0]) %6 = 2 # # Let's try another command: # ? ?elladd elladd(e,z1,z2): sum of the points z1 and z2 on elliptic curve e. ? elladd(e, [0,0], e[1,0]) *** expected character: ']' instead of: elladd(e,[0,0],e[1,0]) ^---- ? elladd(e, [0,0], [1,0]) %7 = [-1, 0] ? # # The sum of two points of order 2 is another point of order 2! # Actually this is just basic group theory and has nothing to do with # elliptic curves; see? # # # After we proved Hasse's theorem in class, we introduced the very notation # of "a_p" of an elliptic curve. Pari has a build-in command to compute that. # ? ?ellap ellap(e,p,{flag=0}): computes a_p for the elliptic curve e using Shanks-Mestre's method. flag is optional and can be set to 0 (default) or 1 (use Jacobi symbols) ? ellap(e, 13) %8 = 6 ? # # Since E above is defined over Q and delta(E)=64, we can reduce E (mod p) # for any prime p>2 and still get an elliptic curve, so a_p(E) makes sense # for p>2. We can write a simple loop to compute these a_p(E) over a range # of p # ? for(j=1,20, p=prime(j); print([p, ellap(e, p)])) [2, 0] [3, 0] [5, -2] [7, 0] [11, 0] [13, 6] [17, 2] [19, 0] [23, 0] [29, -10] [31, 0] [37, -2] [41, 10] [43, 0] [47, 0] [53, 14] [59, 0] [61, -10] [67, 0] [71, 0] # # Note that I included p=2! There is a way to define a_p(E) even for 'bad' # primes; story for another day... # # # Finally, to get out of pari, type "\q" # ? \q Goodbye!