GP(1)

πŸ“¦
version 2.17.4 Β· 3 versions
, in alpine 3.24, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– GP(1) β€” the PARI calculator, bestie edition πŸ’–

okay so real talk, this is the manual page for gp, a general commands manual situation, and it's about to be your new obsession. buckle up πŸŽ€


✨ NAME ✨

gp β€” The PARI calculator. that's it, that's the name, and honestly? iconic. πŸ‘‘


✨ SYNOPSIS ✨

gp [-s stacksize] [-p primelimit] [--emacs] [-f|--fast] [-q|--quiet]
[-D|--default key=val] [--help] [--test] [--texmacs] [--version]
[--version-short] [ file1 file2 ...]

✨ DESCRIPTION ✨

so when you run this, you're invoking the PARI-GP calculator gp πŸ’… and gp is not playing around β€” it's an advanced programmable calculator, specializing in number theory, which computes symbolically for as long as it possibly can, switches to numerically when it needs to, and is absolutely packed with arithmetic functions: factorizations, elliptic curves, Galois theory, class field theory, modular forms, etc. the range is giving main character energy fr fr 🌈

Commands are written in the GP scripting language, and you can either type them in interactively or load them from files. choose your own adventure bestie ✨

If they're there at the end of the command line, the files file1, file2, ... get loaded on startup β€” and lowkey they must be written in the GP language, no cap.


✨ OPTIONS ✨

Command line options come in both short form (-f) and POSIX-like form (--fast). and here's a cute lil detail: numeric arguments can be followed by a modifier k, M or G at your convenience β€” in that case the argument gets multiplied by 10^3, 10^6, or 10^9 respectively. math but make it fashion 🧚

  • -f, --fast β€” Fast start (or factory settings). It does not read .gprc (see below) when starting up. no baggage, we love a clean slate πŸ¦‹
  • -p limit β€” [DEPRECATED] so when gp starts up, it computes a table of small primes used in number-theoretic applications. If primelimit is set, that table includes primes up to that bound instead of the default (= 1048576). ngl it's mostly useless to change this value now β€” it's giving legacy behavior 😭
  • -q, --quiet β€” Quiet mode. Do not print headers or history numbers, and do not say goodbye. πŸ₯Ί (yes it really just doesn't say bye)
  • -D, --default key=val β€” performs default(key, val) on startup, overriding values from the gprc preferences file. val must be a constant value and is not allowed to involve any computation (e.g. 1+1 is forbidden 🚫). Any number of such default-setting statements may appear on the command line. A key may be set multiple times, and the last setting takes precedence. last one wins, periodt πŸ’…
  • -s limit β€” Size of the gp internal stack allocated on startup. When gp runs out of space, it interrupts the current computation and raises a stack overflow exception. If this happens frequently, start with a bigger stack.

The stack size can also be increased from within gp, using default(parisize,limit); it's convenient to set parisize from your .gprc so that the setting is persistent across sessions β€” a value of 80MB is sensible.

We strongly advise also setting parisizemax to a positive, much larger value in your .gprc (about what you believe your machine can stand, usually half the available RAM or so): this strives to fit computation in the parisize range but allows it to temporarily go beyond it (up to parisizemax). 🫢

Note that computations with a smaller stack may be more efficient due to better data locality. ✨

Finally, threadsize and threadsizemax play analogous roles in the parallel version of gp.

  • --emacs β€” gp can be run in an Emacs shell (see GP User's manual for details). This flag is then required for smooth interaction with the PariEmacs package (pari.el). It is set automatically by the pari.el package, and will produce display oddities if you set it outside of an Emacs session. don't do that, bestie πŸ™ˆ
  • --help β€” print a summary of available command-line options. the classic.
  • --test β€” run gp in test mode: suppress printing of history numbers and wrap long output lines (to get readable diff output). For benches only. πŸ’€
  • --texmacs β€” gp can be run from a TeXmacs frontend. This flag is set by TeXmacs, to enable special purpose communication channels. Do not set it yourself. fr fr, hands off πŸ™…
  • --version β€” output version info (banner) then exit.
  • --version-short β€” output version number then exit.

✨ USE ✨

  • ? β€” to get online help.
  • ?? β€” to get extended online help (more precisely, to call the external help program, gphelp by default).
  • quit (or \q), or EOF (Ctrl-D) to quit gp.

The following works only when gp was linked with the GNU readline library:

  • arrow keys β€” for editing and viewing the input history.
  • TAB β€” for automatic completion. ✨

✨ MANUALS ✨

the following material is included in the standard distribution (originally in TeX format) and can also be downloaded at

https://pari.math.u-bordeaux.fr/doc.html

or viewed online at

https://pari.math.u-bordeaux.fr/dochtml/html/
  • The User's Guide to PARI/GP β€” (users.dvi)
  • The User's Guide to the PARI library β€” (library.dvi)
  • The Developer's Guide to the PARI library β€” (develop.dvi)
  • PARI/GP, a tutorial β€” (tutorial.dvi)
  • PARI/GP reference cards β€” (refcard*.dvi)

✨ FILES ✨

  • gp β€” main executable.
  • $HOME/.gprc β€” (or $GPRC if set) user preference file, read at the beginning of execution by each gp shell. A default gprc gprc.dft is provided with the distribution. If this file cannot be found, /etc/gprc is checked instead.
  • <logfile> β€” a file used to log in all commands and results; default: pari.log (you need to set the log default in your gprc or interactively).
  • <psfile> β€” a file used to dump PostScript drawings; default: pari.ps.
  • <histfile> β€” a file where gp will keep a history of all input commands (you need to set the histfile default in the gprc file).
  • gphelp β€” default external help program (as above).
  • *.gp β€” GP programs.

✨ ENVIRONMENT ✨

  • $GPRC β€” place to look for the user's preference file (gprc); if the file does not exist, we then check in $HOME/.gprc, /etc/gprc, and finally for a file named gprc in PARI's datadir.
  • $GP_DATA_DIR β€” directory containing data installed by optional PARI packages. For example, the Galois resolvents files in directory galdata/ needed by the polgalois function, in degrees 8 to 11; or the modular polynomials in seadata/ used by the ellap function for large base fields. This environment variable overrides PARI's datadir, defined at Configure time.
  • $GP_POSTSCRIPT_VIEWER β€” an application able to display PostScript files, used by the plotps graphic engine. This engine is a fallback used to output hi-res plots even when no compatible graphical library was available on your platform at Configure time. (Dumps the graph to a temporary file, then open the file.)
  • $GP_SVG_VIEWER β€” an application able to display SVG images files, used by the plotsvg graphic engine. This engine is a fallback used to output hi-res plots even when no compatible graphical library was available on your platform at Configure time. (Dumps the graph to a temporary file, then open the file.)
  • $GPHELP β€” name of the external help program invoked by ?? and ??? shortcuts.
  • $GPTMPDIR β€” name of the directory where temporary files will be generated.

✨ HOME PAGE ✨

PARI's home page resides at

https://pari.math.u-bordeaux.fr/

✨ MAILING LISTS ✨

There are a number of mailing lists devoted to the PARI/GP package, and most feedback should be directed to those. See

https://pari.math.u-bordeaux.fr/lists.html

for details. The most important ones are:

  • pari-announce (moderated): for us to announce major version changes. πŸ“£
  • pari-dev: for everything related to the development of PARI, including suggestions, technical questions, bug reports or patch submissions.
  • pari-users: for discuss about everything else, in particular ask for help.

To subscribe, send empty messages with a Subject: containing the word "subscribe" respectively to

pari-announce-request@pari.math.u-bordeaux.fr

pari-users-request@pari.math.u-bordeaux.fr

pari-dev-request@pari.math.u-bordeaux.fr

✨ BUG REPORTS ✨

Bugs should be submitted online to our Bug Tracking System, available from PARI's home page, or directly from the URL

https://pari.math.u-bordeaux.fr/Bugs/

Further instructions can be found on that page. πŸ› (be nice to the bugs, they're just little guys)


✨ TRIVIA ✨

Despite the leading G, GP has nothing to do with GNU. The first version was originally called GPC, for Great Programmable Calculator. When people started calling it "the GPC Calculator", the trailing C was dropped. history is so unserious 😭

PARI has nothing to do with the French capital. The name is a pun about the project's early stages when the authors started to implement a library for "Pascal ARIthmetic" in the PASCAL programming language. They quickly switched to C. glow-up fr πŸ’…

For the benefit of non-native French speakers, here's a slightly expanded explanation: Blaise Pascal (1623-1662) was a famous French mathematician and philosopher who was one of the founders of probability and devised one of the first "arithmetic machines". He once proposed the following "proof" of the existence of God for the unbelievers: whether He exists or not I lose nothing by believing in Him, whereas if He does and I misbehave... This is the so-called "pari de Pascal" (Pascal's Wager). πŸŽ€

Note that PARI also means "fairy" in Persian. 🧚✨


✨ AUTHORS ✨

PARI was originally written by Christian Batut, Dominique Bernardi, Henri Cohen, and Michel Olivier in Laboratoire A2X (Universite Bordeaux I, France), and was maintained by Henri Cohen up to version 1.39.15 (1995), and by Karim Belabas since then.

A great number of people have contributed to the successive improvements which eventually resulted in the present version. See the AUTHORS file in the distribution. 🫢


✨ SEE ALSO ✨

gap(1), gphelp(1), perl(1), readline(3), sage(1), tex(1), texmacs(1),


✨ COPYING ✨

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


πŸ’– okay that's the whole page bestie!! this version is from the GP(1) general commands manual, dated 12 September 2024. go forth and compute, you absolute icon πŸ’…βœ¨πŸ‘‘