Department of Mathematics - University of Utah

HomeComputingCourse SchedulesCSMECurrent PositionsFAQ (Computing)FormsGraduateHigh SchoolLecture VideosMailbox AccessMath BiologyMath EducationNewsletterPeopleResearchRTG GrantsSeminars

PARI/GP FAQ

Last update(s): Thu Oct 13 15:29:24 2005     Fri Oct 14 11:27:50 2005     Tue Oct 18 10:48:42 2005     Wed Feb 24 14:44:52 2010                Valid HTML 4.0!

Table of contents

  1. What is PARI/GP?
  2. What books are available for PARI/GP?
  3. What documentation is available online for PARI/GP?
  4. What version of PARI/GP do we have?
  5. How do I use high-precision arithmetic?
  6. How do I make a simple 2-D function plot?
  7. How do I make a 3-D surface plot?
  8. I'm working on machine X. Why does it not have PARI/GP?
  9. Is there a local mailing list for questions about PARI/GP?

Questions and answers

  1.   What is PARI/GP?

    PARI is a run-time library for high-precision decimal integer and floating-point arithmetic. GP is a programming language for symbolic algebra and high-precision computation.

    PARI/GP was originally developed by Professor Henri Cohen at l'Université de Bordeaux, France, about 1997. It is now supported by a collaborative effort under the GNU General Public License and has its own Web site.

  2.   What books are available for PARI/GP?

    None. [Is this still the case?]

  3.   What documentation is available online for PARI/GP?

    The doc subdirectory of the PARI/GP distributions has a reference card, a tutorial, and a users manual. They are available as the local files /usr/local/src/pari/refcard.pdf , /usr/local/src/pari/tutorial.pdf , and /usr/local/src/pari/users.pdf .

    There is also a help system inside PARI/GP. In a PARI/GP session, type a question mark followed by a function name or topic:

    % gp
    ...
    ? ?sqrt
    sqrt(x): square root of x.
    
  4.   What version of PARI/GP do we have?

    Most of our systems have just a single version of PARI/GP. You can see what they are like this:

    % which gp
    /usr/local/bin/gp
    
    % ls /usr/local/bin/gp-*
    /usr/local/bin/gp-2.2
    
    % gp --version
            GP/PARI CALCULATOR Version 2.2.5 (alpha)
    ...
    

    Although that output refers to GP/PARI, the system's Web site uniformly calls it PARI/GP.

  5.   How do I use high-precision arithmetic?

    Set the desired decimal precision with the \p command, and then enter numerical expressions for evaluation. Here is an example:

    % gp
    ...
    ? \p 50
       realprecision = 57 significant digits (50 digits displayed)
    ? erfc(-7.5)
    %1 = 1.9999999999999999999999999722335061396943089933603
    
    ? sin(1/256) / (1/256)
    %2 = 0.99999745687042983799221222193087945750276128903456
    
    ? 40!
    %3 = 815915283247897734345611269596115894272000000000
    

    Notice that gp gives you a few more digits than you asked. Normally, this is helpful, in that it makes it more likely that reported results are correctly rounded. However, it also removes some control that you might want to have.

  6.   How do I make a simple 2-D function plot?

    PARI/GP does not have a fancy GUI allowing creation of nice-looking plots. Instead, it makes plots on the terminal, like this:

    ? plot(x=-5,5,sin(x)/x, -1, 1);
    
            1 |'''''''''''''''''''''''''''_x""""x_'''''''''''''''''''''''''''|
              |                        _x"        "x_                        |
              |                       x              x                       |
              |                     _"                "_                     |
              |                    x                    x                    |
              |                  _"                      "_                  |
              |                 _                          _                 |
              |                x                            x                |
              |              _"                              "_              |
              |             x                                  x             |
              |           _"                                    "_           |
              ``````````_x````````````````````````````````````````x_``````````
              |      _x"                                            "x_      |
              """xx""                                                  ""xx"""
              |                                                              |
              |                                                              |
              |                                                              |
              |                                                              |
              |                                                              |
              |                                                              |
              |                                                              |
           -1 |..............................................................|
              -5                                                             5
    
  7.   How do I make a 3-D surface plot?

    You cannot with this system: PARI/GP has no facilities for 3-D surface plotting.

  8.   I'm working on machine X. Why does it not have PARI/GP?

    PARI/GP is a large and complex system, with about 138,000 lines of C code. We attempt to build each new release on all of our platforms, and most now have at least one version. However, no build of PARI/GP has yet been successful for GNU/Linux on Alpha, MIPS, PowerPC, and SPARC, and OpenBSD on IA-32.

  9.   Is there a local mailing list for questions about PARI/GP?

    No, there is not, but one can easily be created if there is sufficient user demand. In the meantime, students who use PARI/GP in courses should direct their questions to their instructors.


Dept Info Outreach College of Science Newsletter

Department of Mathematics
University of Utah
155 South 1400 East, JWB 233
Salt Lake City, Utah 84112-0090
Tel: 801 581 6851, Fax: 801 581 4148
Webmaster


Entire Web                     Only http://www.math.utah.edu/