Sideway from Sideway


Knowledge Base

Draft for Information Only


PARI/GP 2.5.0 Command Information
  Command Samples
PARI-GP 2.5.0 Command Reference
UnderConstruction not clean up yet
     remark: {} optional argumentss
  Starting & Stopping GP
  Input/Output & Defaults
  GP Within Emacs
  Reserved Variable Names
  PARI Types & Input Formats
  Standard Operators
     Change Objects
    Select Pieces of an Object
    Conjugates and Lifts
  Random Numbers
  Lists, Sets & Sorting
    Sets (= row vector of strings with strictly increasing entries)
  Programming & User Functions
     Control Statements (X: formal parameter in expression seq)
    Interface with User and System
    User Defined Functions
  Iterations, Sums & Products
  Vectors & Matrices
    Constructors & Special Matrices
    Gaussian elimination
  Lattices & Quadratic Forms
  Formal & p-adic Series
    Dirichlet and Power Series
    p-adic Functions
  Polynomials & Rational Functions
    Roots and Factorization
    Special Polynomials
  Transcendental Functions
  Elementary Arithmetic Functions
    Primes and Factorization
    Special Functions and Numbers
  True-False Tests
  Elliptic Curves
    Curves over nite elds, Pairings
    Curves over Q and the L-function
    Elldata package, Cremona's database:
  Elliptic & Modular Functions
  Graphic Functions
    High-resolution plot (immediate plot)
    Rectwindow functions
    Low-level Rectwindow Functions
    Postscript Functions
  Binary Quadratic Forms
  Quadratic Fields
  General Number Fields: Initializations
  Basic Number Field Arithmetic (nf)
    Dedekind Zeta Function K
  Class Groups & Units (bnf, bnr)
  Class Field Theory
    Ideal Operations
    Primes and Multiplicative Structure
  Galois theory over Q
  Relative Number Fields (rnf)
    Lifts and Push-downs
    Projective ZK-modules, maximal order

PARI/GP 2.5.0 Command Information

A Tutorial for PARI/GP  from Pari/gp: (last updated on 10/06/2012)  

Functions Reference from Pari/gp: 

Reference from Pari/gp Reference Card:

Reference from Pari/gp User's Guide:

Reference from Pari/gp Library User's Guide:

Command Samples

  1. General (last updated on 04/22/2012)
    •  quit or \q  —  to exit GP
    • allocatemem({s})  —  to allocate a new stacke of s bytes
    • read({file})  —  read file into GP
    • readvec({file})  —  read a vector into GP
      • a=readvec("filename")
      • a=readvec(filenamevar)
  2. Meta-Commands (last updated on 04/29/2012)
    • #  —  to toggle timer on/off
    • ##  —  to print time for last result
    • \a n  —  to print %n in raw format
    • \d  —  to print values of system defaults
    • \q  —  to quit GP
    • \t  —  to print the list of GP type
    • \u  —  to print the list of user-defined functions
    • \r filename —  to read file in the same directory of GPinto GP
    • \w n filename  —  to write %n to file
  3. Input/Output & Default (last updated on 04/29/2012)
    • %, %', %''  —  to output previous line, the lines before
    • %n  —  to output from the n line
    • ;  —  to seperate multiple statments on the same line
    • \  —  to extend statment on an additional line
    • {seq1; seq2;}  —  to extend statments on an serveral lines
    • /* ... */  —  to comment the program
    • \\ ...  —  to comment one-line, rest of line ignored
    • default({d},{val},{flag})  —  to set the system default d to val
    • \\   —  the \ character in string
    • \"   —  the " character in string
  4. Operators (last updated on 04/23/2012)
    • +, -, *, /, ^  —  basic arithematic operations
      • x=8+4; x=12; addition : 8 plus 4
      • x=8-4; x=4; subtraction : 8 minus 4
      • x=8*4; x=32, multiplication : 8 multiplied by 4
      • x=8/4; x=2; division : 8 divided by 4
      • x=8^4; x=4096; exponentiation : 8 raised to power of 4
    • x\y, x\/y, x%y, divrem(x,y) —  special arithematic operations
      • x=8\3; x=2; the Euclidean quotient of 8 and 3
      • x=8\/3; x=3; the rounded Euclidean quotient of 8 and 3
      • x=8%3; x=2; the modulus or remainder of 8 divided by 3
      • divrem(8,3); return a column vector of two components, i.e. the Euclidean quotien (x\y) and the Euclidean remainder (x-(x\y)*y) of the division of x divided by y.
    • x++, x--, x*=y  —  overloaded arithematic operator
      • x++; assign x= i+1 and return x
      • x--; assign x= i-1 and return x
      • x*=y; assing x=x*y and return x
    • x<<n, x>>, shift(x,n)  —  shift operator
      • x<<n; shift x left n bits 
      • x>>n; shift x right n bits, x>>n = x<<(-n) 
      • shift(x,n); shift x componentwise by n bits to the left if n>=0 and to the right if n<0.
    • ||, &&, !  —  comparison operator
      • ||; or operator 
      • &&; and operator 
  5. Programming (last updated on 04/29/2012)
    • if(a,{seq1},{seq2})  —  if a is true (a≠0), evaluate seq1, else seq2.
    • for(X=a,b,seq)  —  for a≤X≤b, evaluates seq
    • forstep(X=a,b,s,seq)  —  for a≤X≤b with increment steps s, evaluates seq
    • forvec(X=v,seq)  —  for X in v, evaluates seq
    • fordiv(n,X,seq)  —  for X divides n, evaluates seq
    • forprime(X=a,b,seq)  —  for prime a≤X≤b, evaluates seq
  6. Vectors & Matrices (last updated on 04/23/2012)
    • matsize(x)  —  return dimensions of matrix x
      • a=matsize(varname)=[m,n]
      • a=matsize(varname)[2]=n
    • concat(x,{y})  —  concatenation of x and y
      • x=1; y=2; z=concat(x,y)=[1, 2]
      • x=[]; y=2; x=concat(x,y)=[2]
      • x=[1]; y=2; x[1]=concat(x,y)=[1, 2]; x=[[1, 2]]
    • vector(n,{i},{expr})  —  return row vector of size n with expr evaluated at 1≤i≤n
      • a=vector(n,i,1)=[1,..,1]
      • a=vector(n,i,[ ])=[[ ],..,[ ]]
      • a=vector(n,i,i)=[1,..,n]
  7. Reserved Variable Names (last updated on 04/22/2012) evaluated at 1≤i≤n
    • Pi  —  π= 3.14159...
    • Euler  —  Euler's constant = .57721...
    • I  —  square root of -1


PARI-GP 2.5.0 Command Reference

UnderConstruction not clean up yet

© 2011 Karim Belabas.
Based on an earlier version by Joseph H. Silverman
May 2011 v2.26. Copyright © 2011 K. Belabas
GP copyright by The PARI Group
Permission is granted to make and distribute copies of this card provided the copyright and this permission notice are preserved on all copies.
Send comments and corrections to (Karim.Belabas at

remark: {} optional argumentss

Starting & Stopping GP

  • to enter GP, just type its name: gp

  • \q or quit  —  to exit GP


  • describe function ?function

  • extended description ??keyword

  • list of relevant help topics ???pattern

Input/Output & Defaults

  • output previous line, the lines before %, %`, %``, etc.

  • output from line n %n

  • separate multiple statements on line ;

  • extend statement on additional lines \

  • extend statements on several lines {seq1; seq2;}

  • comment /* : : : */

  • one-line comment, rest of line ignored \\ : : :

  • set default d to val default(fdg; fvalg; fflagg)

  • mimic behavior of GP 1.39 default(compatible,3)


  • toggle timer on/o #

  • print time for last result ##

  • print %n in raw format \a n

  • print defaults \d

  • set debug level to n \g n

  • set memory debug level to n \gm n

  • enable/disable log le \l {filename}

  • print %n in pretty matrix format \m

  • set output mode (raw=0, default=1) \o n

  • set n signi cant digits \p n

  • set n terms in series \ps n

  • quit GP \q

  • print the list of PARI types \t

  • print the list of user-de ned functions \u

  • read le into GP \r lename

  • write %n to le \w n lename

GP Within Emacs

  •  to enter GP from within Emacs: M-x gp, C-u M-x gp

  • word completion hTABi

  • help menu window M-\c

  • describe function M-?

  • display TEX'd PARI manual M-x gpman

  • set prompt string M-\p

  • break line at column 100, insert \ M-\\

  • PARI metacommand \letter M-\letter

Reserved Variable Names

  • Pi  —  π= 3.14159...

  • Euler  —  Euler's constant = .57721...

  • I  —  square root of -1

  • big-oh notation O

PARI Types & Input Formats

  •  t INT/t REAL. Integers, Reals n, n:ddd

  • t INTMOD. Integers modulo m Mod(n;m)

  • t FRAC. Rational Numbers n=m

  • t FFELT. Elt in a Finite Field ffgen(T)

  • t COMPLEX. Complex Numbers x + y  I

  • t PADIC. p-adic Numbers x + O(p^k)

  • t QUAD. Quadratic Numbers x + y  quadgen(D)

  • t POLMOD. Polynomials modulo g Mod(f; g)

  • t POL. Polynomials a  x^n +    + b

  • t SER. Power Series f + O(x^k)

  • t QFI/t QFR. Imag/Real bin. quad. forms Qfb(a; b; c; fdg)

  • t RFRAC. Rational Functions f=g

  • t VEC/t COL. Row/Column Vectors [x; y; z], [x; y; z]~

  • t MAT. Matrices [x; y;z; t;u; v]

  • t LIST. Lists List([x; y; z])

  • t STR. Strings "aaa"

Standard Operators

  •  basic operations +, - , *, /, ^

  • i=i+1, i=i-1, i=i*j, : : : i++, i--, i*=j,: : :

  • euclidean quotient, remainder x\/y, x\y, x%y, divrem(x; y)

  • shift x left or right n bits x>n or shift(x;n)

  • comparison operators <=, <, >=, >, ==, !=

  • boolean operators (or, and, not) ||, &&, !

  • sign of x = ??1; 0; 1 sign(x)

  • maximum/minimum of x and y max, min(x; y)

  • integer or real factorial of x x! or factorial(x)

  • derivative of f w.r.t. x f'


 Change Objects

  • to vector, matrix, set, list, string Col/Vec,Mat,Set,List,Str

  • create PARI object (x mod y) Mod(x; y)

  • make x a polynomial of v Pol(x; fvg)

  • as above, starting with constant term Polrev(x; fvg)

  • make x a power series of v Ser(x; fvg)

  • PARI type of object x type(x)

  • object x with precision n prec(x; fng)

  • evaluate f replacing vars by their value eval(f)

Select Pieces of an Object

  •  length of x #x or length(x)

  • n-th component of x component(x; n)

  • n-th component of vector/list x x[n]

  • (m; n)-th component of matrix x x[m; n]

  • row m or column n of matrix x x[m;], x[; n]

  • numerator of x numerator(x)

  • lowest denominator of x denominator(x)

Conjugates and Lifts

  •  conjugate of a number x conj(x)

  • conjugate vector of algebraic number x conjvec(x)

  • norm of x, product with conjugate norm(x)

  • square of L2 norm of vector x norml2(x)

  • lift of x from Mods lift, centerlift(x)

Random Numbers

  •  random integer between 0 and N ?? 1 random(fNg)

  • get random seed getrand()

  • set random seed to s setrand(s)

Lists, Sets & Sorting

  •  sort x by kth component vecsort(x; fkg; ffl = 0g)

Sets (= row vector of strings with strictly increasing entries)

  • intersection of sets x and y setintersect(x; y)

  • set of elements in x not belonging to y setminus(x; y)

  • union of sets x and y setunion(x; y)

  • look if y belongs to the set x setsearch(x; y; fflagg)


  •  create empty list L L = List()

  • append x to list L listput(L; x; fig)

  • remove i-th component from list L listpop(L; fig)

  • insert x in list L at position i listinsert(L; x; i)

  • sort the list L in place listsort(L; fflagg)

Programming & User Functions

 Control Statements (X: formal parameter in expression seq)

  •  eval. seq for a  X  b for(X = a; b; seq)

  • eval. seq for X dividing n fordiv(n;X; seq)

  • eval. seq for primes a  X  b forprime(X = a; b; seq)

  • eval. seq for a  X  b stepping s forstep(X = a; b; s; seq)

  • multivariable for forvec(X = v; seq)

  • if a 6= 0, evaluate seq1, else seq2 if(a; fseq1g; fseq2g)

  • evaluate seq until a 6= 0 until(a; seq)

  • while a 6= 0, evaluate seq while(a; seq)

  • exit n innermost enclosing loops break(fng)

  • start new iteration of nth enclosing loop next(fng)

  • return x from current subroutine return(fxg)

  • error recovery (try seq1) trap(ferrg; fseq2g; fseq1g)


  •  print args with/without newline print(); print1()

  • formatted printing printf()

  • read a string from keyboard input()

  • output args in TEX format printtex(args)

  • write args to le write, write1, writetex( le; args)

  • read({file})  —  read file into GP

Interface with User and System

  • allocatemem({s})  —  to allocate a new stacke of s bytes
  • execute system command a system(a)

  • as above, feed result to GP extern(a)

  • install function from library install(f; code; fgpf g; flibg)

  • alias old to new alias(new; old)

  • new name of function f in GP 2.0 whatnow(f)

User Defined Functions

  •  name(formal vars) = my(local vars); seq

  • struct.member = seq

  • kill value of variable or function x kill(x)

Iterations, Sums & Products

  •  numerical integration intnum(X = a; b; expr; fflagg)

  • sum expr over divisors of n sumdiv(n;X; expr)

  • sum X = a to X = b, initialized at x sum(X = a; b; expr; fxg)

  • sum of series expr suminf(X = a; expr)

  • sum of alternating/positive series sumalt, sumpos

  • product a  X  b, initialized at x prod(X = a; b; expr; fxg)

  • product over primes a  X  b prodeuler(X = a; b; expr)

  • in nite product a  X  1 prodinf(X = a; expr)

  • real root of expr between a and b solve(X = a; b; expr)

Vectors & Matrices

  • matsize(x)  —  dimensions of matrix x
  • concat(x,{y})  —  concatenation of x and y
  • extract components of x vecextract(x; y; fzg)

  • transpose of vector or matrix x mattranspose(x) or x~

  • adjoint of the matrix x matadjoint(x)

  • eigenvectors of matrix x mateigen(x)

  • characteristic polynomial of x charpoly(x; fvg; fflagg)

  • minimal polynomial of x minpoly(x; fvg)

  • trace of matrix x trace(x)

Constructors & Special Matrices

  • vector(n,{i},{expr})  —  return row vector of size n with expr evaluated at 1≤i≤n
  • vectorv(n,{i},{expr})  —  return column vector of size n with expr evaluated at 1≤i≤n
  • matrix 1  i  m, 1  j  n matrix(m; n; fig; fjg; fexprg)

  • diagonal matrix with diagonal x matdiagonal(x)

  • n  n identity matrix matid(n)

  • Hessenberg form of square matrix x mathess(x)

  • n  n Hilbert matrix Hij = (i + j ?? 1)??1 mathilbert(n)

  • n  n Pascal triangle Pij = ??i j  matpascal(n ?? 1)

  • companion matrix to polynomial x matcompanion(x)

Gaussian elimination

  •  determinant of matrix x matdet(x; fflagg)

  • kernel of matrix x matker(x; fflagg)

  • intersection of column spaces of x and y matintersect(x; y)

  • solve M  X = B (M invertible) matsolve(M;B)

  • as solve, modulo D (col. vector) matsolvemod(M;D;B)

  • one sol of M  X = B matinverseimage(M;B)

  • basis for image of matrix x matimage(x)

  • supplement columns of x to get basis matsupplement(x)

  • rows, cols to extract invertible matrix matindexrank(x)

  • rank of the matrix x matrank(x)

Lattices & Quadratic Forms

  •  upper triangular Hermite Normal Form mathnf(x)

  • HNF of x where d is a multiple of det(x) mathnfmod(x; d)

  • elementary divisors of x matsnf(x)

  • LLL-algorithm applied to columns of x qflll(x; fflagg)

  • like qflll, x is Gram matrix of lattice qflllgram(x; fflagg)

  • LLL-reduced basis for kernel of x matkerint(x)

  • Z-lattice ! Q-vector space matrixqz(x; p)

  • signature of quad form ty  x  y qfsign(x)

  • decomp into squares of ty  x  y qfgaussred(x)

  • find up to m sols of ty  x  y  b qfminim(x; b;m)

  • v, v[i] :=number of sols of ty  x  y = i qfrep(x;B; fflagg)

  • eigenvals/eigenvecs for real symmetric x qfjacobi(x)

Formal & p-adic Series

  •  truncate power series or p-adic number truncate(x)

  • valuation of x at p valuation(x; p)

Dirichlet and Power Series

  •  Taylor expansion around 0 of f w.r.t. x taylor(f; x)

  • Pakbktk from Paktk and Pbktk serconvol(x; y)

  • f = Paktk from P(ak=k!)tk serlaplace(f)

  • reverse power series F so F(f(x)) = x serreverse(f)

  • Dirichlet series multiplication / division dirmul, dirdiv(x; y)

  • Dirichlet Euler product (b terms) direuler(p = a; b; expr)

p-adic Functions

  •  Teichmuller character of x teichmuller(x)

  • Newton polygon of f for prime p newtonpoly(f; p)

Polynomials & Rational Functions

  •  degree of f poldegree(f)

  • coecient of degree n of f polcoeff(f; n)

  • round coe s of f to nearest integer round(f; f&eg)

  • gcd of coecients of f content(f)

  • replace x by y in f subst(f; x; y)

  • discriminant of polynomial f poldisc(f)

  • resultant of f and g polresultant(f; g; fvg; fflagg)

  • as above, give [u; v; d], xu + yv = d bezoutres(x; y)

  • derivative of f w.r.t. x deriv(f; x)

  • formal integral of f w.r.t. x intformal(f; x)

  • reciprocal poly xdeg f f(1=x) polrecip(f)

  • interpol. pol. eval. at a polinterpolate(X; fY g; fag; f&eg)

  • initialize t for Thue equation solver thueinit(f)

  • solve Thue equation f(x; y) = a thue(t; a; fsolg)

Roots and Factorization

  •  number of real roots of f, a < x  b polsturm(f; fag; fbg)

  • complex roots of f polroots(f)

  • symmetric powers of roots of f up to n polsym(f; n)

  • roots of f mod p polrootsmod(f; p; fflagg)

  • factor f factor(f; flimg)

  • factorization of f mod p factormod(f; p; fflagg)

  • factorization of f over Fpa factorff(f; p; a)

  • p-adic fact. of f to prec. r factorpadic(f; p; r; fflagg)

  • p-adic roots of f to prec. r polrootspadic(f; p; r)

  • p-adic root of f cong. to a mod p padicappr(f; a)

  • Newton polygon of f for prime p newtonpoly(f; p)

Special Polynomials

  •  nth cyclotomic polynomial in var. v polcyclo(n; fvg)

  • d-th degree sub eld of Q(n) polsubcyclo(n; d; fvg)

  • n-th Legendre polynomial pollegendre(n; fv = xg)

  • n-th Tchebiche polynomial polchebyshev(n; fflagg; fv = xg)

  • Zagier's polynomial of index n,m polzagier(n;m)

Transcendental Functions

  •  real, imaginary part of x real(x), imag(x)

  • absolute value, argument of x abs(x), arg(x)

  • square/nth root of x sqrt(x), sqrtn(x; n; f&zg)

  • trig functions sin, cos, tan, cotan inverse trig functions asin, acos, atan

  • hyperbolic functions sinh, cosh, tanh

  • inverse hyperbolic functions asinh, acosh, atanh

  • exponential of x exp(x)

  • natural log of x ln(x) or log(x)

  • gamma function ??(x) = R10 e??ttx??1dt gamma(x)

  • logarithm of gamma function lngamma(x)

  • (x) = ??0(x)=??(x) psi(x)

  • incomplete gamma function (y = ??(s)) incgam(s; x; fyg)

  • exponential integral R1x e??t=t dt eint1(x)

  • error function 2=p R1x e??t2 dt erfc(x)

  • dilogarithm of x dilog(x)

  • mth polylogarithm of x polylog(m; x; fflagg)

  • U-con uent hypergeometric function hyperu(a; b; u)

  • J-Bessel function, Jn+1=2(x) besselj(n; x), besseljh(n; x)

  • K-Bessel function of index nu besselk(nu; x)

Elementary Arithmetic Functions

  •  vector of binary digits of jxj binary(x)

  • give bit number n of integer x bittest(x; n)

  • ceiling of x ceil(x) oor of x

  • floor(x) fractional part of x frac(x)

  • round x to nearest integer round(x; f&eg)

  • truncate x truncate(x; f&eg)

  • gcd/LCM of x and y gcd(x; y), lcm(x; y)

  • gcd of entries of a vector/matrix content(x)

Primes and Factorization

  •  add primes in v to the prime table addprimes(v)

  • the nth prime prime(n)

  • vector of rst n primes primes(n)

  • smallest prime  x nextprime(x)

  • largest prime  x precprime(x)

  • factorization of x factor(x; flimg)

  • reconstruct x from its factorization factorback(f; feg)


  •  number of distinct prime divisors omega(x)

  • number of prime divisors with mult bigomega(x)

  • number of divisors of x numdiv(x)

  • row vector of divisors of x divisors(x)

  • sum of (k-th powers of) divisors of x sigma(x; fkg)

Special Functions and Numbers

  •  binomial coecient ??x y  binomial(x; y)

  • Bernoulli number Bn as real bernreal(n)

  • Bernoulli vector B0;B2; : : : ;B2n bernvec(n)

  • nth Fibonacci number fibonacci(n)

  • number of partitions of n numbpart(n)

  • Euler -function eulerphi(x)

  • Mobius -function moebius(x)

  • Hilbert symbol of x and y (at p) hilbert(x; y; fpg)

  • Kronecker-Legendre symbol (x y ) kronecker(x; y)


  •  integer or real factorial of x x! or fact(x)

  • integer square root of x sqrtint(x)

  • solve z  x and z  y chinese(x; y)

  • minimal u; v so xu + yv = gcd(x; y) bezout(x; y)

  • multiplicative order of x (intmod) (<=o) znorder(x; fog)

  • primitive root mod prime power q znprimroot(q)

  • structure of (Z=nZ) znstar(n)

  • continued fraction of x contfrac(x; fbg; flmaxg)

  • last convergent of continued fraction x contfracpnqn(x)

  • best rational approximation to x bestappr(x; k)

True-False Tests

  •  is x the disc. of a quadratic eld? isfundamental(x)

  • is x a prime? isprime(x)

  • is x a strong pseudo-prime? ispseudoprime(x)

  • is x square-free? issquarefree(x)

  • is x a square? issquare(x; f&ng)

  • is pol irreducible? polisirreducible(pol)

Elliptic Curves

  • Elliptic curve initially given by 5-tuple E =[a1; a2; a3; a4; a6]. Points are [x,y], the origin is [0].
    Initialize elliptic struct. ell , i.e create ellinit(E; fflagg)
    a1; a2; a3; a4; a6; b2; b4; b6; b8; c4; c6; disc; j. This data can be recovered by typing ell.a1,: : :,ell.j. If flag omitted, also

    •  E de ned over R

      • x-coords. of points of order 2 ell.roots r
      • eal and complex periods
      • associated quasi-periods ell.eta
      • volume of complex lattice ell.area
    • E de ned over Qp, jjjp > 1

      • x-coord. of unit 2 torsion point ell.roots
      • Tate's [u2; u; q] ell.tate
      • Mestre's w ell.w
  • change curve E using v =[u; r; s; t] ellchangecurve(ell; v)

  • change point z using v =[u; r; s; t] ellchangepoint(z; v)

  • add points z1 + z2 elladd(ell; z1; z2)

  • subtract points z1 ?? z2 ellsub(ell; z1; z2)

  • compute n  z ellpow(ell; z; n)

  • check if z is on E ellisoncurve(ell; z)

  • order of torsion point z ellorder(ell; z)

  • y-coordinates of point(s) for x ellordinate(ell; x)

  • point [}(z); }0(z)] corresp. to z ellztopoint(ell; z)

  • complex z such that p = [}(z); }0(z)] ellpointtoz(ell; p)

Curves over nite elds, Pairings

  •  random point on E random(ell)

  • structure Z=d1Z  Z=d2Z of E(Fp) ellgroup(ell; p)

  • Weil pairing of m-torsion pts x; y ellweilpairing(ell; x; y;m)

  • Tate pairing of x; y; x m-torsion elltatepairing(ell; x; y;m)

Curves over Q and the L-function

  •  canonical bilinear form taken at z1, z2 ellbil(ell; z1; z2)

  • canonical height of z ellheight(ell; z; fflagg)

  • height regulator matrix for pts in x ellheightmatrix(ell; x)

  • cond, min mod, Tamagawa num [N; v; c] ellglobalred(ell)

  • Kodaira type of p- ber of E elllocalred(ell; p)

  • minimal model of E=Q ellminimalmodel(ell; f&vg)

  • pth coe ap of L-function, p prime ellap(ell; p)

  • kth coe ak of L-function ellak(ell; k)

  • vector of rst n ak's in L-function ellan(ell; n)

  • L(E; s), set A  1 elllseries(ell; s; fAg)

  • order of vanishing at 1 ellanalyticrank(ell; fepsg)

  • L(r)(E; 1) ellL1(ell; r)

  • root number for L(E; :) at p ellrootno(ell; fpg)

  • torsion subgroup with generators elltors(ell)

  • modular parametrization of E elltaniyama(ell)

Elldata package, Cremona's database:

  •  db code $ [conductor; class; index] ellconvertname(s)

  • generators of Mordell-Weil group ellgenerators(E)

  • look up E in database ellidentify(E)

  • all curves matching criterion ellsearch(N)

  • loop over curves with cond. from a to b forell(E; a; b; seq)

Elliptic & Modular Functions

  •  arithmetic-geometric mean agm(x; y)

  • elliptic j-function 1=q + 744 +    ellj(x)

  • Weierstrass  function ellsigma(ell; z; fflagg)

  • Weierstrass } function ellwp(ell; fzg; fflagg)

  • Weierstrass  function ellzeta(ell; z)

  • modi ed Dedekind  func. Q(1 ?? qn) eta(x; fflagg)

  • Jacobi sine theta function theta(q; z)

  • k-th derivative at z=0 of theta(q; z) thetanullk(q; k)

  • Weber's f functions weber(x; fflagg)

  • Riemann's zeta (s) = Pn??s zeta(s)

Graphic Functions

  •  crude graph of expr between a and b plot(X = a; b; expr)

High-resolution plot (immediate plot)

  •  plot expr between a and b ploth(X = a; b; expr; fflagg; fng)

  • plot points given by lists lx, ly plothraw(lx; ly; fflagg)

  • terminal dimensions plothsizes()

Rectwindow functions

  •  init window w, with size x,y plotinit(w; x; y)

  • erase window w plotkill(w)

  • copy w to w2 with o set (dx; dy) plotcopy(w;w2; dx; dy)

  • scale coordinates in w plotscale(w; x1; x2; y1; y2)

  • ploth in w plotrecth(w;X = a; b; expr; fflagg; fng)

  • plothraw in w plotrecthraw(w; data; fflagg)

  • draw window w1 at (x1; y1), : : : plotdraw([[w1; x1; y1]; : : :])

Low-level Rectwindow Functions

  •  set current drawing color in w to c plotcolor(w; c)

  • current position of cursor in w plotcursor(w)

  • write s at cursor's position plotstring(w; s)

  • move cursor to (x; y) plotmove(w; x; y)

  • move cursor to (x + dx; y + dy) plotrmove(w; dx; dy)

  • draw a box to (x2; y2) plotbox(w; x2; y2)

  • draw a box to (x + dx; y + dy) plotrbox(w; dx; dy)

  • draw polygon plotlines(w; lx; ly; fflagg)

  • draw points plotpoints(w; lx; ly)

  • draw line to (x + dx; y + dy) plotrline(w; dx; dy)

  • draw point (x + dx; y + dy) plotrpoint(w; dx; dy)

Postscript Functions

  •  as ploth psploth(X = a; b; expr; fflagg; fng)

  • as plothraw psplothraw(lx; ly; fflagg)

  • as plotdraw psdraw([[w1; x1; y1]; : : :])

Binary Quadratic Forms

  •  create ax2 + bxy + cy2 (distance d) Qfb(a; b; c; fdg)

  • reduce x (s = pD, l = bsc) qfbred(x; fflagg; fDg; flg; fsg)

  • composition of forms x*y or qfbnucomp(x; y; l)

  • n-th power of form x^n or qfbnupow(x; n)

  • composition without reduction qfbcompraw(x; y)

  • n-th power without reduction qfbpowraw(x; n)

  • prime form of disc. x above prime p qfbprimeform(x; p)

  • class number of disc. x qfbclassno(x)

  • Hurwitz class number of disc. x qfbhclassno(x)

Quadratic Fields

  •  quadratic number ! = px or (1 + px)=2 quadgen(x)

  • minimal polynomial of ! quadpoly(x)

  • discriminant of Q(pD) quaddisc(x)

  • regulator of real quadratic eld quadregulator(x)

  • fundamental unit in real Q(x) quadunit(x)

  • class group of Q(pD) quadclassunit(D; fflagg; ftg)

  • Hilbert class eld of Q(pD) quadhilbert(D; fflagg)

  • ray class eld modulo f of Q(pD) quadray(D; f; fflagg)

General Number Fields: Initializations

  •  A number eld K is given by a monic irreducible f 2 Z[X].
    init number eld structure nf nfinit(f; fflagg)

  • nf members:

    • polynomial de ning nf , f() = 0 nf .pol
    • number of real/complex places nf .r1/r2/sign
    • discriminant of nf nf .disc
    • T2 matrix nf .t2
    • vector of roots of f nf .roots
    • integral basis of ZK as powers of  nf .zk
    • di erent nf .diff
    • codi erent nf .codiff
    • index nf .index
  • recompute nf using current precision nfnewprec(nf)

  • init relative rnf given by g = 0 over K rnfinit(nf ; g)

  • initbnf structure bnfinit(f; fflagg)

  • bnf members: same as nf , plus

    •  underlying nf bnf .nf
    • classgroup bnf .clgp
    • regulator bnf .reg
    • fundamental units bnf .fu
    • torsion units bnf .tu
  • compute a bnf from small bnf bnfinit(sbnf )

  • add S-class group and units, yield bnf s bnfsunit(nf ; S)

  • init class eld structure bnr bnrinit(bnf ; m; fflagg)

  • bnr members: same as bnf , plus

    • underlying bnf bnr.bnf
    • big ideal structure
    • modulus bnr.mod
    • structure of (ZK=m) bnr.zkst

Basic Number Field Arithmetic (nf)

 Elements are t INT, t FRAC, t POL, t POLMOD, or t COL (on integral basis nf .zk). Basic operations (pre x nfelt): (nfelt)add, mul, pow, div, diveuc, mod, divrem, val, trace, norm

  •  express x on integer basis nfalgtobasis(nf ; x)

  • express element x as a polmod nfbasistoalg(nf ; x)

  • reverse polmod a = A(X) mod T(X) modreverse(a)

  • integral basis of eld def. by f = 0 nfbasis(f)

  • field discriminant of eld f = 0 nfdisc(f)

  • Galois group of eld f = 0, deg f  11 polgalois(f)

  • smallest poly de ning f = 0 polredabs(f; fflagg)

  • small polys de ning sub elds of f = 0 polred(f; fflagg; fpg)

  • poly of degree  k with root x 2 C algdep(x; k)

  • small linear rel. on coords of vector x lindep(x)

  • are elds f = 0 and g = 0 isomorphic? nfisisom(f; g)

  • is eld f = 0 a sub eld of g = 0? nfisincl(f; g)

  • compositum of f = 0, g = 0 polcompositum(f; g; fflagg)

  • ub elds (of degree d) of nf nfsubfields(nf ; fdg)

  • roots of unity in nf nfrootsof1(nf )

  • roots of g belonging to nf nfroots(fnf g; g)

  • factor g in nf nffactor(nf ; g)

  • factor g mod prime pr in nf nffactormod(nf ; g; pr)

  • conjugates of a root  of nf nfgaloisconj(nf ; fflagg)

  • apply Galois automorphism s to x nfgaloisapply(nf ; s; x)

  • quadratic Hilbert symbol (at p) nfhilbert(nf ; a; b; fpg)

Dedekind Zeta Function K

  •  K as Dirichlet series, N(I) < b dirzetak(nf ; b)

  • init nfz for eld f = 0 zetakinit(f)

  • compute K(s) zetak(nfz ; s; fflagg)

  • Artin root number of K bnrrootnumber(bnr; chi; fflagg)

Class Groups & Units (bnf, bnr)

  •  a1; fa2g; fa3g usually bnr; subgp or bnf ; module; fsubgpg r

  • emove GRH assumption from bnf bnfcertify(bnf )

  • expo. of ideal x on class gp bnfisprincipal(bnf ; x; fflagg)

  • expo. of ideal x on ray class gp bnrisprincipal(bnr; x; fflagg)

  • expo. of x on fund. units bnfisunit(bnf ; x)

  • as above for S-units bnfissunit(bnfs; x)

  • signs of real embeddings of bnf .fu bnfsignunit(bnf )

Class Field Theory

  •  ray class number for mod. m bnrclassno(bnf ;m)

  • discriminant of class eld ext bnrdisc(a1; fa2g; fa3g)

  • ray class numbers, l list of mods bnrclassnolist(bnf ; l)

  • discriminants of class elds bnrdisclist(bnf ; l; farchg; fflagg)

  • decode output from bnrdisclist bnfdecodemodule(nf ; fa)

  • is modulus the conductor? bnrisconductor(a1; fa2g; fa3g)

  • conductor of character chi bnrconductorofchar(bnr; chi)

  • conductor of extension bnrconductor(a1; fa2g; fa3g; fflagg)

  • conductor of extension def. by g rnfconductor(bnf ; g)

  • Artin group of ext. def'd by g rnfnormgroup(bnr; g)

  • subgroups of bnr, index <= b subgrouplist(bnr; b; fflagg)

  • rel. eq. for class eld def'd by sub rnfkummer(bnr; sub; fdg)

  • same, using Stark units (real eld) bnrstark(bnr; sub; fflagg)


 Ideals are elements, primes, or matrix of generators in HNF.

  •  is id an ideal in nf ? nfisideal(nf ; id)

  • is x principal in bnf ? bnfisprincipal(bnf ; x)

  • principal ideal generated by x idealprincipal(nf ; x)

  • principal idele generated by x ideleprincipal(nf ; x)

  • give [a; b], s.t. aZK + bZK = x idealtwoelt(nf ; x; fag)

  • put ideal a (aZK + bZK) in HNF form idealhnf(nf ; a; fbg)

  • norm of ideal x idealnorm(nf ; x)

  • minimum of ideal x (direction v) idealmin(nf ; x; v)

  • LLL-reduce the ideal x (direction v) idealred(nf ; x; fvg)

Ideal Operations

  •  add ideals x and y idealadd(nf ; x; y)

  • multiply ideals x and y idealmul(nf ; x; y; fflagg)

  • intersection of ideals x and y idealintersect(nf ; x; y; fflagg)

  • n-th power of ideal x idealpow(nf ; x; n; fflagg)

  • inverse of ideal x idealinv(nf ; x)

  • divide ideal x by y idealdiv(nf ; x; y; fflagg)

  • Find (a; b) 2 x  y, a + b = 1 idealaddtoone(nf ; x; fyg)

Primes and Multiplicative Structure

  •  factor ideal x in nf idealfactor(nf ; x)

  • expand ideal factorization in nf idealfactorback(nf; f; e)

  • decomposition of prime p in nf idealprimedec(nf ; p)

  • valuation of x at prime ideal pr idealval(nf ; x; pr)

  • weak approximation theorem in nf idealchinese(nf ; x; y)

  • give bid =structure of (ZK=id) idealstar(nf ; id; fflagg)

  • discrete log of x in (ZK=bid) ideallog(nf ; x; bid)

  • idealstar of all ideals of norm  b ideallist(nf ; b; fflagg)

  • add Archimedean places ideallistarch(nf ; b; farg; fflagg)

  • init prmod structure nfmodprinit(nf ; pr)

  • kernel of matrix M in (ZK=pr) nfkermodpr(nf ;M; prmod)

  • solve Mx = B in (ZK=pr) nfsolvemodpr(nf ;M;B; prmod)

Galois theory over Q

  •  initializes a Galois group structure galoisinit(pol; fdeng)

  • action of p in nfgaloisconj form galoispermtopol(G; fpg)

  • identi es as abstract group galoisidentify(G)

  • exports a group for GAP or MAGMAgaloisexport(G; fflagg)

  • subgroups of the Galois group G galoissubgroups(G)

  • sub elds from subgroups of Ggaloissubfields(G; fflagg; fvg)

  • fixed eld galoisfixedfield(G; perm; fflagg; fvg)

  • is G abelian? galoisisabelian(G; fflagg)

  • abelian number elds galoissubcyclo(N,H,{flag},{v})

Relative Number Fields (rnf)

 Extension L=K is de ned by g 2 K[x]. We have order  L.

  •  absolute equation of L rnfequation(nf ; g; fflagg)

  • relative nfalgtobasis rnfalgtobasis(rnf ; x)

  • relative nfbasistoalg rnfbasistoalg(rnf ; x)

  • relative idealhnf rnfidealhnf(rnf ; x)

  • relative idealmul rnfidealmul(rnf ; x; y)

  • relative idealtwoelt rnfidealtwoelt(rnf ; x)

Lifts and Push-downs

  •  absolute ! relative repres. for x rnfeltabstorel(rnf ; x)

  • relative ! absolute repres. for x rnfeltreltoabs(rnf ; x)

  • lift x to the relative eld rnfeltup(rnf ; x)

  • push x down to the base eld rnfeltdown(rnf ; x)

  • idem for x ideal: (rnfideal)reltoabs, abstorel, up, down

Projective ZK-modules, maximal order

  •  relative polred rnfpolred(nf ; g)

  • relative polredabs rnfpolredabs(nf ; g)

  • characteristic poly. of a mod g rnfcharpoly(nf ; g; a; fvg)

  • relative Dedekind criterion, prime pr rnfdedekind(nf ; g; pr)

  • discriminant of relative extension rnfdisc(nf ; g)

  • pseudo-basis of ZL rnfpseudobasis(nf ; g)

  • relative HNF basis of order rnfhnfbasis(bnf ; order)

  • reduced basis for order rnflllgram(nf ; g; order)

  • determinant of pseudo-matrix A rnfdet(nf ;A)

  • Steinitz class of order rnfsteinitz(nf ; order)

  • is order a free ZK-module? rnfisfree(bnf ; order)

  • true basis of order, if it is free rnfbasis(bnf ; order)


  • absolute norm of ideal x rnfidealnormabs(rnf ; x)

  • relative norm of ideal x rnfidealnormrel(rnf ; x)

  • solutions of NK=Q(y) = x 2 Z bnfisintnorm(bnf ; x)

  • is x 2 Q a norm from K? bnfisnorm(bnf ; x; fflagg)

  • initialize T for norm eq. solver rnfisnorminit(K; pol; fflagg)

  • is a 2 K a norm from L? rnfisnorm(T; a; fflagg)



ID: 120400013 Last Updated: 2012/4/22 Revision: 0


Home (5)



HBR (3)



Hobbies (7)


Chinese (1097)

English (336)

Reference (66)


Hardware (149)


Application (187)

Digitization (24)

Numeric (19)


Web (648)new



Regular Expression (SC)


Knowledge Base

Common Color (SC)

Html Entity (Unicode) (SC)

Html 401 Special (SC)

OS (389)

MS Windows

Windows10 (SC)

.NET Framework (SC)

DeskTop (7)



Formulas (8)

Number Theory (206)

Algebra (20)

Trigonometry (18)

Geometry (18)

Calculus (67)

Complex Analysis (21)


Tables (8)


Mechanics (1)

Rigid Bodies

Statics (92)

Dynamics (37)

Fluid (5)

Fluid Kinematics (5)


Process Control (1)

Acoustics (19)

FiniteElement (2)

Biology (1)

Geography (1)

Copyright © 2000-2019 Sideway . All rights reserved Disclaimers last modified on 10 Feb 2019