From Rosetta Code
This programming language may be used to instruct a computer to perform a task.
Official website
Execution method: Interpreted or compiled
Garbage collected: Yes
Parameter passing methods: By reference, By value
Type strength: Weak
Type checking: Dynamic
Lang tag(s): parigp, c
See Also:
Listed below are all of the tasks on Rosetta Code which have been solved using PARI/GP.
Your Help Needed
If you know PARI/GP, please write code for some of the tasks not implemented in PARI/GP.

PARI/GP is a widely used computer algebra system designed for fast computations in number theory (factorizations, algebraic number theory, elliptic curves...), but also contains a large number of other useful functions to compute with mathematical entities such as matrices, polynomials, power series, algebraic numbers etc., and a lot of transcendental functions.

PARI/GP is composed of two parts: a C library called PARI and an interface, gp, to this library. GP scripts are concise, easy to write, and resemble mathematical language. (Terminology: the scripting language of gp is called GP.)

PARI was written by Henri Cohen and others at Université de Bordeaux and is now maintained by Karim Belabas. gp was originally written by Dominique Bernardi, then maintained and enhanced by Karim Belabas and Ilya Zakharevich, and finally rewritten by Bill Allombert.

Using PARI/GP[edit]

PARI/GP can be downloaded at its official website's download page.

Windows precompiled binaries are available: an installer, stand-alone stable and development versions, plus a nightly build with the very latest changes. Mac snapshots are also available. Linux users can install PARI/GP with their favorite package manager (RPM, dpkg, apt, etc.) or build it from source. Instructions are available for compiling.

Android phones and tablets can use paridroid (also on github).

While an iPhone/iPad version has not been developed, sage-math includes gp. Click the "+" in the top-right to start a new program, then click and hold on "Sage" at the top until the "Select Language" dropdown appears, then choose GP. (You can also use the wrapper function pari in a Sage snippet.)

Finally, gp can be used online through the PARI/GP site (via Emscripten), compile online or the SageMath cloud (see How to use PARI/GP in the SageMathCloud).

Coding with PARI[edit]

The most common way to use PARI is through the gp calculator, using its own scripting language, GP. But there are other interfaces to PARI beside gp:

If you want to program with PARI, many languages are supported:

  • C: PARI is written in C, so it's very easy to either write your own programs or extend gp using C. The gp2c utility converts GP scripts into executable C code.
    • For use with the Gnu Mpc library, there is also Pari-Gnump.
  • C++: PARI can be used directly in C++. The code is intentionally written in a C++-compatible style. -fpermissive is sometimes useful when compiling with g++.
  • Python:
    • SageMath (or SAGE) is a Python-based system that includes GP among others
    • pari-python
    • cypari is a fork of the GP component of SageMath
  • Perl:
  • Common Lisp: Use Pari (CLISP).
  • Mathematica: A quick tutorial using MathLink is available.

See also[edit]




Papers on PARI/GP[edit]


This category has the following 3 subcategories, out of 3 total.

Pages in category "PARI/GP"

The following 527 pages are in this category, out of 527 total.