The Pari Package On Linux
The pari package (named after the French capital Paris, where the idea for this package originated) is a computer algebra system designed to work under several Unix derivatives, and of course Linux is one of them. It is well-known to a small group of mathematicians, and most probably useful for anyone who wants to perform symbolic or numerical computations or who just likes to have a powerful calculator. Its features include arbitrary-precision numerical computation, symbolic calculations, matrix/vector operations, plotting facilities (text mode or X11), and tons of number theoretic functions. Pari provides an interactive interface (the GP calculator) as well as its own programming facilities and a library for using the kernel within its own C/C++ programs. An emacs lisp file (pari.el) for using the GP calculator within an emacs buffer is included in the package. Pari is not so extensive as the commercial packages Maple, Mathematica, or Axiom are, but its major advantage is its speed. Pari claims to be 5 to 100 times faster than the commercial counterparts. I personally like its very economical use of memory. It performs really well on my “low end” 386/40 with 8 meg RAM.
Pari is available by anonymous ftp from megrez.math.u-bordeaux.fr as pari-1.39a.tar.gz, together with examples, benchmarks, and a manual (160 pgs.) which includes a function reference and a tutorial. The authors are C. Batut, D. Bernardi, H. Cohen, and M. Olivier, who are well-known number-theorists. You can contact them at email@example.com.
On megrez.math.u-bordeaux.fr, you will find precompiled Linux binaries (gplinux.tar.gz) as well as the source package pari-1.39a.tar.gz. Because it contains the documentation and the examples, I recommend getting the source package even if you get the binaries. pari-1.39a.tar.gz unpacks into three subdirectories: doc, examples, and src. If you have gcc installed, recompiling is quite straightforward. After running configure i386 and performing a minor hack in the Makefile (read the src/INSTALL file), you are prepared to run make. You can optionally compile the gp calculator with readline support, meaning you have a command history, programmable keystrokes, and other features as within GNU bash. The source to bash also contains the necessary readline library.
It's easy to install the pari library and the gp calculator by issuing make install as root. Installing emacs support is a little bit tricky and requires you to edit some pathnames and constants defined in pari.el to match your configuration. Once pari.el is installed, you can start gp by issuing M-x gp and get an overview via M-x describe-mode, like most emacs modes.
After compiling and installing it successfully, let's start gp and try a few expressions at the “?” prompt:
? 2*3 %1 = 6 ? 4/3*5/14 %2 = 10/21 ? 4.0/3*5/14 %3 = 0.4761904761904761904761904761
As you can see, pari tries to use exact integer and rational numbers as long as possible. As soon as you introduce one real (floating point) number, the result will be real. You may request (almost) arbitrary precision:
? \precision=50 precision = 50 significant digits ? pi %4 = 3.1415926535897932384626433832795028841971693993751
You may enter expressions with indeterminates
? (x+2)*(x^2+1) %5 = x^3 + 2*x^2 + x + 2
? x=2 %6 = 2
and evaluate, e.g., our (x+2)*(x2+1)
? eval(%5) %7 = 20
or compute some factorial
? 1000! %8 = 4023872600770937735437024339230039857193748642107146 3254379991042993851239862902059204420848696940480047 998861019719605863166687299480855890132382966994459...
Of pari's basic types, until now you have seen integer, rational, and real numbers and rational expressions with indeterminates (polynomials/rational functions). Integers can store values with up to 315,623 decimal digits. The precision of reals is controlled by the
\precision=n setting, where n is restricted to be not greater than 315623. Further, you can work with complex numbers, power series, row or column vectors, matrices, and more. You can combine these types (i.e. vectors of matrices); pari handles these using a recursive technique.
|PostgreSQL, the NoSQL Database||Jan 29, 2015|
|HPC Cluster Grant Accepting Applications!||Jan 28, 2015|
|Sharing Admin Privileges for Many Hosts Securely||Jan 28, 2015|
|Red Hat Enterprise Linux 7.1 beta available on IBM Power Platform||Jan 23, 2015|
|Designing with Linux||Jan 22, 2015|
|Wondershaper—QOS in a Pinch||Jan 21, 2015|
- PostgreSQL, the NoSQL Database
- Sharing Admin Privileges for Many Hosts Securely
- HPC Cluster Grant Accepting Applications!
- Internet of Things Blows Away CES, and it May Be Hunting for YOU Next
- Ideal Backups with zbackup
- Wondershaper—QOS in a Pinch
- January 2015 Issue of Linux Journal: Security
- Slow System? iotop Is Your Friend
- Red Hat Enterprise Linux 7.1 beta available on IBM Power Platform
- Designing with Linux
Editorial Advisory Panel
Thank you to our 2014 Editorial Advisors!
- Jeff Parent
- Brad Baillio
- Nick Baronian
- Steve Case
- Chadalavada Kalyana
- Caleb Cullen
- Keir Davis
- Michael Eager
- Nick Faltys
- Dennis Frey
- Philip Jacob
- Jay Kruizenga
- Steve Marquez
- Dave McAllister
- Craig Oda
- Mike Roberts
- Chris Stark
- Patrick Swartz
- David Lynch
- Alicia Gibb
- Thomas Quinlan
- Carson McDonald
- Kristen Shoemaker
- Charnell Luchich
- James Walker
- Victor Gregorio
- Hari Boukis
- Brian Conner
- David Lane