PARI/GP calculator, or gp for short, is an arbitrary-precision calculator (among other things) that I use frequently in my study of binary numbers. Here are instructions for installing and running it on Windows.
- Download the PARI/GP self-installing binary distribution for Windows.
As of this writing, the current stable version is Pari-2-3-4.exe. (There’s no need to download or install the optional packages — at least I don’t need them).
- Double click on the installer file to install (install all components).
You can set gp default settings by editing the gp customization file, “\PARI\.gprc”. For example, I have edited mine as follows:
- Changed the command prompt from the default timestamp format (prompt = "(%H:%M) gp > ") to ‘?’ (prompt = "? ").
- Added a line (format = "f") that makes all decimals print without scientific notation.
Here are some basic things you should know about running gp:
- Starting gp. Launch gp from the PARI folder under the Windows start menu.
- Setting variables. You can assign constants or results of calculations to variables; for example, n=8.
- Reusing prior calculations. The results of calculations are stored in a history array: %1 is the result of the first calculation, %2 is the result of the second calculation, etc. You can use these as variables in subsequent expressions.
- Changing the default precision. The default precision of printed decimal values is 28 significant digits; this can be changed with the ‘\p’ command. For example, ‘\p 50’ changes the print precision to 50 digits (PARI may set its internal precision higher than what you ask for; it must respect boundaries dictated by its implementation).
- Printing decimals instead of fractions. To force gp to print decimals instead of fractions, make sure a decimal point appears in the expression; for example, 2.^-2
- Executing previous commands. Previous commands can be accessed with the up arrow and down arrow keys.
- Copying and pasting. This is cumbersome, but can be done by right-clicking on the top of the command window and selecting ‘edit’. For copy, select ‘mark’, highlight the desired text in the command window and then hit enter. For paste, select ‘paste’.
- Logging your session. Type ‘\l’ to record your session — all commands and output — to the default PARI log file (\PARI\examples\pari.log). Type ‘\l’ again to stop recording.
- Exiting gp. Type ‘quit’ to exit gp.
See my article “Exploring Binary Numbers With PARI/GP Calculator” for example gp calculations.
Hi Binary Man/Woman/Person,
Pari-GP sure looks good. Factorizes “small” numbers very easily. Still can’t get preloaded aliases to work. It’s supposed to just use lines like “alias(p,prime)” in the .gprc file. Here’s the response:
*** missing ‘=’: alias(p,prime)
…skipping line 7.
*** missing ‘=’: alias(F,fibonacci)
…skipping line 8.
WHAT missing “=”? The ONLY alias syntax I can find is given by the help:
07:58:27 gp > ?alias
alias(“new”,”old”): new is now an alias for old.
07:59:38 gp >
What have I forgotten?
I’ve never used ‘alias’, but I just tried it — I get the same error as you. You might want to try the PARI mailing list for help.
Binary Man (or “Doctor Binary” to you 🙂 ).
Thanks for that, Rick. I now try re-reading the .gprc file manually when running gp (\r .gprc) and then it understands aliases and user functions OK. Whew.
NOW on Windows the delete key doesn’t work. I have to cursor to the right and then backspace to erase chars. Grrr, I fall for it EVERY time, getting a ~ with a beep. Everyone looks over and says “What are you doing?”.
I saw somewhere that using a later version of cygwin1.dll may help. I have cygwin on my WIN7, but switching dlls didn’t help.
On Fedora, needless to say, the backspace AND delete keys work perfectly.
Comments are closed.