This directory contains:

* Inputrc: an example of .inputrc file for the readline library.

* A generic Makefile for PARI programs, adapted to your system by Configure.

* the C program extgcd.c using the Pari library described in Chapter 4 of
the users' manual.  To build it, run:
make TARGET=extgcd

* the C program minigp.c using low-level functions in the Pari library to
implement a basic GP interpretor using libreadline. This shows in particular
how to add a new function 'quit' to the interpretor. To build it, run
make TARGET=minigp EXTRALIBS=-lreadline

* the C program gp_embedded.c using the gp_embedded() function to
simplify minigp. To build it, run
make TARGET=gp_embedded EXTRALIBS=-lreadline

* the C program pari-mt.c using the Pari library interface for parallel
computation. To build it, run
make TARGET=pari-mt

* the C program thread.c using the Pari library in a multi-threaded context,
POSIX threads version, as described in Appendix D of the users' manual.
This requires that PARI is Configured with --enable-tls. To build it, run
make TARGET=thread EXTRALIBS=-lpthread

* the C program openmp.c using the Pari library in a multi-threaded context,
OpenMP version, as described in Appendix D of the users' manual.
This requires that PARI is Configured with --enable-tls. To build it, run
make TARGET=openmp EXTRACFLAGS=-fopenmp

* the FORTRAN90 program pari.f90 that shows how to write PARI bindings to
use libpari in a FORTRAN program.

* Several examples of complete GP programs. The rest of this file gives a
brief description of these programs. They should be read into GP
by the command \r file.

-- bench.gp: This program computes the first 1000 terms of the Fibonacci
sequence, the product p of successive terms, and the lowest common multiple q.
It outputs the ratio log(p)/log(q) every 50 terms, which tends to Pi^2/6
as k tends to infinity. The name bench.gp comes from the fact that this
program is one (among many) examples where GP/PARI performs orders of
magnitude faster than systems such as Maple or Mathematica. (Try it!)

-- cl.gp: Written entirely in the GP language without using bnfinit, the
programs included in this file computes the class number, the structure of
the class group and a system of fundamental units of a general number field.
It sometimes fail to give an answer and works only if nfinit finds a power
basis. Evidently it is less powerful, less reliable and much slower than
bnfinit, but it is given as an example of a sophisticated use of GP.  The
first thing to do is to call

   clareg(pol, {limp=19},{lima=50},{extra=5})

where pol is the monic irreducible polynomial defining the number field, limp
is the prime factor base limit (try values between 19 and 113), lima is
another search limit (try 50 or 100) and extra is the number of desired extra
relations (try 2 to 10). Default values are provided, so that you need only
supply pol.

  The program prints the number of relations that it needs, and tries to find
them. If you see that it slows down too much before succeeding, abort and try
other values. If it succeeds, it will print the class number, class group and
regulator. These are tentative values. Then use

   check({lim = 100})

to check if the value is consistent with the value of the L-series (the value
returned should be close to 1). Finally, 

   fu() (no parameters)

returns a family of units which generates the unit group (you must extract a
system of fundamental units yourself).

-- classno.gp: a simple function to compute analytically the class number of
imaginary quadratic fields (written by Fernando Rodriguez Villegas)

-- contfrac.gp: period(D) computes period of continued fraction for sqrt(D)
[slower than quadregulator, which does a bit more work, but is written in C!]
(written by Igor Schein)

-- lucas.gp: The function lucas(p) defined in this file performs the
Lucas-Lehmer primality test on the Mersenne number 2^p-1. If the result is 1,
the Mersenne number is prime, otherwise not.

-- rho.gp: a simple implementation of Pollard's rho method. The function
rho(n) outputs the complete factorization of n in the same format as factor.

-- squfof.gp: This defines a function squfof of a positive integer variable
n, which may allow you to factor the number n. SQUFOF is a nice factoring
method invented in the 70's by Dan Shanks for factoring integers, and is
reasonably fast for numbers having up to 15 or 16 digits. The squfof program
given here is a crude implementation, which prints out some intermediate
information as it goes along. The final result is some factor of the number
to be factored.

-- taylor.gp: the function

   plot_taylor(f,xmin,xmax, ordlim, first,step)

plots the Taylor polynomials T_i (truncated series expansion of order i)
of the function f in the interval [xmin,xmax]; i goes from first to ordlim in
increments of steps. Sensible default values are provided for all arguments
(adapted from an original idea by Ilya Zakharevich). A few examples are
provided, together with a simple colormap generator
