## GP defaults

This section documents the GP defaults, that can be set either by the GP function `default` or in your GPRC. Be sure to check out `parisize` and `parisizemax` !

#### TeXstyle

The bits of this default allow `gp` to use less rigid TeX formatting commands in the logfile. This default is only taken into account when `log` = 3. The bits of `TeXstyle` have the following meaning

2: insert `\right` / `\left` pairs where appropriate.

4: insert discretionary breaks in polynomials, to enhance the probability of a good line break.

The default value is `0`.

#### breakloop

If true, enables the "break loop" debugging mode, see Section se:break_loop.

The default value is `1` if we are running an interactive `gp` session, and `0` otherwise.

#### colors

This default is only usable if `gp` is running within certain color-capable terminals. For instance `rxvt`, `color_xterm` and modern versions of `xterm` under X Windows, or standard Linux/DOS text consoles. It causes `gp` to use a small palette of colors for its output. With xterms, the colormap used corresponds to the resources `Xterm*colorn` where n ranges from 0 to 15 (see the file `misc/color.dft` for an example). Accepted values for this default are strings `"a1,...,ak"` where k ≤ 7 and each ai is either

* the keyword `no` (use the default color, usually black on transparent background)

* an integer between 0 and 15 corresponding to the aforementioned colormap

* a triple [c0,c1,c2] where c0 stands for foreground color, c1 for background color, and c2 for attributes (0 is default, 1 is bold, 4 is underline).

The output objects thus affected are respectively error messages, history numbers, prompt, input line, output, help messages, timer (that's seven of them). If k < 7, the remaining ai are assumed to be no. For instance

      default(colors, "9, 5, no, no, 4")

typesets error messages in color 9, history numbers in color 5, output in color 4, and does not affect the rest.

A set of default colors for dark (reverse video or PC console) and light backgrounds respectively is activated when `colors` is set to `darkbg`, resp. `lightbg` (or any proper prefix: `d` is recognized as an abbreviation for `darkbg`). A bold variant of `darkbg`, called `boldfg`, is provided if you find the former too pale.

In the present version, this default is incompatible with PariEmacs. Changing it will just fail silently (the alternative would be to display escape sequences as is, since Emacs will refuse to interpret them). You must customize color highlighting from the PariEmacs side, see its documentation.

The default value is `""` (no colors).

#### compatible

Obsolete. This default is now a no-op.

#### datadir

The name of directory containing the optional data files. For now, this includes the `elldata`, `galdata`, `galpol`, `seadata` packages.

The default value is `/usr/local/share/pari`, or the override specified via `Configure --datadir =` .

#### debug

Debugging level. If it is non-zero, some extra messages may be printed, according to what is going on (see `\g`).

The default value is `0` (no debugging messages).

#### debugfiles

File usage debugging level. If it is non-zero, `gp` will print information on file descriptors in use, from PARI's point of view (see `\gf`).

The default value is `0` (no debugging messages).

#### debugmem

Memory debugging level (see `\gm`). If this is non-zero, `gp` will print increasingly precise notifications about memory use:

* `debugmem` > 0, notify when `parisize` changes (within the boundaries set by `parisizemax`);

* `debugmem` > 1, indicate any important garbage collection and the function it is taking place in;

* `debugmem` > 2, indicate the creation/destruction of "blocks" (or clones); expect lots of messages.

Important Note: if you are running a version compiled for debugging (see Appendix A) and `debugmem` > 1, `gp` will further regularly print information on memory usage, notifying whenever stack usage goes up or down by 1 MByte. This functionality is disabled on non-debugging builds as it noticeably slows down the performance.

The default value is `1`.

#### echo

This default can be 0 (off), 1 (on) or 2 (on, raw). When `echo` mode is on, each command is reprinted before being executed. This can be useful when reading a file with the `\r` or `read` commands. For example, it is turned on at the beginning of the test files used to check whether `gp` has been built correctly (see `\e`). When `echo` is set to 1 the input is cleaned up, removing white space and comments and uniting multi-line input. When set to 2 (raw), the input is written as-is, without any pre-processing.

The default value is `0` (no echo).

#### factor_add_primes

This toggle is either 1 (on) or 0 (off). If on, the integer factorization machinery calls `addprimes` on prime factors that were difficult to find (larger than 224), so they are automatically tried first in other factorizations. If a routine is performing (or has performed) a factorization and is interrupted by an error or via Control-C, this lets you recover the prime factors already found. The downside is that a huge `addprimes` table unrelated to the current computations will slow down arithmetic functions relying on integer factorization; one should then empty the table using `removeprimes`.

The default value is `0`.

#### factor_proven

This toggle is either 1 (on) or 0 (off). By default, the factors output by the integer factorization machinery are only pseudo-primes, not proven primes. If this toggle is set, a primality proof is done for each factor and all results depending on integer factorization are fully proven. This flag does not affect partial factorization when it is explicitly requested. It also does not affect the private table managed by `addprimes`: its entries are included as is in factorizations, without being tested for primality.

The default value is `0`.

#### format

Of the form x.n, where x (conversion style) is a letter in {`e`,`f`,`g`}, and n (precision) is an integer; this affects the way real numbers are printed:

* If the conversion style is `e`, real numbers are printed in scientific format, always with an explicit exponent, e.g. `3.3 E-5`.

* In style `f`, real numbers are generally printed in fixed floating point format without exponent, e.g. `0.000033`. A large real number, whose integer part is not well defined (not enough significant digits), is printed in style `e`. For instance `10.^100` known to ten significant digits is always printed in style `e`.

* In style `g`, non-zero real numbers are printed in `f` format, except when their decimal exponent is < -4, in which case they are printed in `e` format. Real zeroes (of arbitrary exponent) are printed in `e` format.

The precision n is the number of significant digits printed for real numbers, except if n < 0 where all the significant digits will be printed (initial default 28, or 38 for 64-bit machines). For more powerful formatting possibilities, see `printf` and `Strprintf`.

The default value is `"g.28"` and `"g.38"` on 32-bit and 64-bit machines, respectively.

#### graphcolormap

A vector of colors, to be used by hi-res graphing routines. Its length is arbitrary, but it must contain at least 3 entries: the first 3 colors are used for background, frame/ticks and axes respectively. All colors in the colormap may be freely used in `plotcolor` calls.

A color is either given as in the default by character strings or by an RGB code. For valid color names, see the standard `rgb.txt` file in X11 distributions, where we restrict to lowercase letters and remove all whitespace from color names. An RGB code is a vector with 3 integer entries between 0 and 255 or a `#` followed by 6 hexadecimal digits. For instance `[250, 235, 215]`, `"#faebd7"` and `"antiquewhite"` all represent the same color.

The default value is [`"white"`, `"black"`, `"blue"`, `"violetred"`, `"red"`, `"green"`, `"grey"`, `"gainsboro"`].

#### graphcolors

Entries in the `graphcolormap` that will be used to plot multi-curves. The successive curves are drawn in colors

`graphcolormap[graphcolors[1]]`, `graphcolormap[graphcolors[2]]`, ...

cycling when the `graphcolors` list is exhausted.

The default value is `[4,5]`.

#### help

Name of the external help program to use from within `gp` when extended help is invoked, usually through a `??` or `???` request (see Section se:exthelp), or `M-H` under readline (see Section se:readline).

The default value is the path to the `gphelp` script we install.

#### histfile

Name of a file where `gp` will keep a history of all input commands (results are omitted). If this file exists when the value of `histfile` changes, it is read in and becomes part of the session history. Thus, setting this default in your gprc saves your readline history between sessions. Setting this default to the empty string `""` changes it to `< undefined >` . Note that, by default, the number of history entries saved is not limited: set `history-size` in readline's `.inputrc` to limit the file size.

The default value is `< undefined >` (no history file).

#### histsize

`gp` keeps a history of the last `histsize` results computed so far, which you can recover using the `%` notation (see Section se:history). When this number is exceeded, the oldest values are erased. Tampering with this default is the only way to get rid of the ones you do not need anymore.

The default value is `5000`.

#### lines

If set to a positive value, `gp` prints at most that many lines from each result, terminating the last line shown with `[+++]` if further material has been suppressed. The various `print` commands (see Section se:gp_program) are unaffected, so you can always type `print(%)` or `\a` to view the full result. If the actual screen width cannot be determined, a "line" is assumed to be 80 characters long.

The default value is `0`.

#### linewrap

If set to a positive value, `gp` wraps every single line after printing that many characters.

The default value is `0` (unset).

#### log

This can be either 0 (off) or 1, 2, 3 (on, see below for the various modes). When logging mode is turned on, `gp` opens a log file, whose exact name is determined by the `logfile` default. Subsequently, all the commands and results will be written to that file (see `\l`). In case a file with this precise name already existed, it will not be erased: your data will be appended at the end.

The specific positive values of `log` have the following meaning

1: plain logfile

2: emit color codes to the logfile (if `colors` is set).

3: write LaTeX output to the logfile (can be further customized using `TeXstyle`).

The default value is `0`.

#### logfile

Name of the log file to be used when the `log` toggle is on. Environment and time expansion are performed.

The default value is `"pari.log"`.

#### nbthreads

This default is specific to the parallel version of PARI and gp (built via `Configure --mt = prthread` or `mpi`) and is ignored otherwise. In parallel mode, it governs the number of threads to use for parallel computing. The exact meaning and default value depend on the `mt` engine used:

* `single`: not used (always a single thread).

* `pthread`: number of threads (unlimited, default: number of cores)

* `mpi`: number of MPI processes to use (limited to the number allocated by `mpirun`, default: use all allocated processes).

See also `threadsize` and `threadsizemax`.

#### new_galois_format

This toggle is either 1 (on) or 0 (off). If on, the `polgalois` command will use a different, more consistent, naming scheme for Galois groups. This default is provided to ensure that scripts can control this behavior and do not break unexpectedly.

The default value is `0`. This value will change to 1 (set) in the next major version.

#### output

There are three possible values: 0 ( = raw), 1 ( = prettymatrix), or 3 ( = external prettyprint). This means that, independently of the default `format` for reals which we explained above, you can print results in three ways:

* raw format, i.e. a format which is equivalent to what you input, including explicit multiplication signs, and everything typed on a line instead of two dimensional boxes. This can have several advantages, for instance it allows you to pick the result with a mouse or an editor, and to paste it somewhere else.

* prettymatrix format: this is identical to raw format, except that matrices are printed as boxes instead of horizontally. This is prettier, but takes more space and cannot be used for input. Column vectors are still printed horizontally.

* external prettyprint: pipes all `gp` output in TeX format to an external prettyprinter, according to the value of `prettyprinter`. The default script (`tex2mail`) converts its input to readable two-dimensional text.

Independently of the setting of this default, an object can be printed in any of the three formats at any time using the commands `\a` and `\m` and `\B` respectively.

The default value is `1` (prettymatrix).

#### parisize

`gp`, and in fact any program using the PARI library, needs a stack in which to do its computations; `parisize` is the stack size, in bytes. It is recommended to increase this default using a `gprc`, to the value you believe PARI should be happy with, given your typical computation. We strongly recommend to also set `parisizemax` to a much larger value in your `gprc`, about what you believe your machine can stand: PARI will then try to fit its computations within about `parisize` bytes, but will increase the stack size if needed (up to `parisizemax`). Once the memory intensive computation is over, PARI will restore the stack size to the originally requested `parisize`.

The default value is 4M, resp. 8M on a 32-bit, resp. 64-bit machine.

#### parisizemax

`gp`, and in fact any program using the PARI library, needs a stack in which to do its computations. If non-zero, `parisizemax` is the maximum size the stack can grow to, in bytes. If zero, the stack will not automatically grow, and will be limited to the value of `parisize`.

When `parisizemax` is set, PARI tries to fit its computations within about `parisize` bytes, but will increase the stack size if needed, roughly doubling it each time (up to `parisizemax` of course!) and printing a message such as `Warning: increasing stack size to` some value. Once the memory intensive computation is over, PARI will restore the stack size to the originally requested `parisize` without printing further messages.

We strongly recommend to set `parisizemax` permanently to a large non-zero value in your `gprc`, about what you believe your machine can stand. It is possible to increase or decrease `parisizemax` inside a running `gp` session, just use `default` as usual.

The default value is 0, for backward compatibility reasons.

#### path

This is a list of directories, separated by colons ':' (semicolons ';' in the DOS world, since colons are preempted for drive names). When asked to read a file whose name is not given by an absolute path (does not start with `/`, `./` or `../`), `gp` will look for it in these directories, in the order they were written in `path`. Here, as usual, `.` means the current directory, and `..` its immediate parent. Environment expansion is performed.

The default value is `".:~:~/gp"` on UNIX systems, `".;C:\;C:\GP"` on DOS, OS/2 and Windows, and `"."` otherwise.

#### plothsizes

If the graphic driver allows it, the array contains the size of the terminal, the size of the font, the size of the ticks.

#### prettyprinter

The name of an external prettyprinter to use when `output` is 3 (alternate prettyprinter). Note that the default `tex2mail` looks much nicer than the built-in "beautified format" (`output` = 2).

The default value is `"tex2mail -TeX -noindent -ragged -by_par"`.

#### primelimit

`gp` precomputes a list of all primes less than `primelimit` at initialization time, and can build fast sieves on demand to quickly iterate over primes up to the square of `primelimit`. These are used by many arithmetic functions, usually for trial division purposes. The maximal value is 232 - 2049 (resp 264 - 2049) on a 32-bit (resp. 64-bit) machine, but values beyond 10^8, allowing to iterate over primes up to 1016, do not seem useful.

Since almost all arithmetic functions eventually require some table of prime numbers, PARI guarantees that the first 6547 primes, up to and including 65557, are precomputed, even if `primelimit` is 1.

This default is only used on startup: changing it will not recompute a new table.

Deprecated feature. `primelimit` was used in some situations by algebraic number theory functions using the `nf_PARTIALFACT` flag (`nfbasis`, `nfdisc`, `nfinit`,...): this assumes that all primes p > `primelimit` have a certain property (the equation order is p-maximal). This is never done by default, and must be explicitly set by the user of such functions. Nevertheless, these functions now provide a more flexible interface, and their use of the global default `primelimit` is deprecated.

Deprecated feature. `factor(N, 0)` was used to partially factor integers by removing all prime factors ≤ `primelimit`. Don't use this, supply an explicit bound: `factor(N, bound)`, which avoids relying on an unpredictable global variable.

The default value is `500k`.

#### prompt

A string that will be printed as prompt. Note that most usual escape sequences are available there: `\e` for Esc, `\n` for Newline,..., `\\` for `\`. Time expansion is performed.

This string is sent through the library function `strftime` (on a Unix system, you can try `man strftime` at your shell prompt). This means that `%` constructs have a special meaning, usually related to the time and date. For instance, `%H` = hour (24-hour clock) and `%M` = minute [00,59] (use `%%` to get a real `%`).

If you use `readline`, escape sequences in your prompt will result in display bugs. If you have a relatively recent `readline` (see the comment at the end of Section se:def,colors), you can brace them with special sequences (`\[` and `\]`), and you will be safe. If these just result in extra spaces in your prompt, then you'll have to get a more recent `readline`. See the file `misc/gprc.dft` for an example.

S< >Caution: PariEmacs needs to know about the prompt pattern to separate your input from previous `gp` results, without ambiguity. It is not a trivial problem to adapt automatically this regular expression to an arbitrary prompt (which can be self-modifying!). See PariEmacs's documentation.

The default value is `"? "`.

#### prompt_cont

A string that will be printed to prompt for continuation lines (e.g. in between braces, or after a line-terminating backslash). Everything that applies to `prompt` applies to `prompt_cont` as well.

The default value is `""`.

#### psfile

This default is obsolete, use one of plotexport, plothexport or plothrawexport functions and write the result to file.

#### readline

Switches readline line-editing facilities on and off. This may be useful if you are running `gp` in a Sun `cmdtool`, which interacts badly with readline. Of course, until readline is switched on again, advanced editing features like automatic completion and editing history are not available.

The default value is `1`.

#### realbitprecision

The number of significant bits used to convert exact inputs given to transcendental functions (see Section se:trans), or to create absolute floating point constants (input as `1.0` or `Pi` for instance). Unless you tamper with the `format` default, this is also the number of significant bits used to print a `t_REAL` number; `format` will override this latter behavior, and allow you to have a large internal precision while outputting few digits for instance.

Note that most PARI's functions currently handle precision on a word basis (by increments of 32 or 64 bits), hence bit precision may be a little larger than the number of bits you expected. For instance to get 10 bits of precision, you need one word of precision which, on a 64-bit machine, correspond to 64 bits. To make things even more confusing, this internal bit accuracy is converted to decimal digits when printing floating point numbers: now 64 bits correspond to 19 printed decimal digits (19 < log10(264) < 20).

The value returned when typing `default(realbitprecision)` is the internal number of significant bits, not the number of printed decimal digits:

      ? default(realbitprecision, 10)
      ? \pb
            realbitprecision = 64 significant bits
      ? default(realbitprecision)
      %1 = 64
      ? \p
            realprecision = 3 significant digits
      ? default(realprecision)
      %2 = 19

Note that `realprecision` and `\p` allow to view and manipulate the internal precision in decimal digits.

The default value is `128`, resp. `96`, on a 64-bit, resp .32-bit, machine.

#### realprecision

The number of significant digits used to convert exact inputs given to transcendental functions (see Section se:trans), or to create absolute floating point constants (input as `1.0` or `Pi` for instance). Unless you tamper with the `format` default, this is also the number of significant digits used to print a `t_REAL` number; `format` will override this latter behavior, and allow you to have a large internal precision while outputting few digits for instance.

Note that PARI's internal precision works on a word basis (by increments of 32 or 64 bits), hence may be a little larger than the number of decimal digits you expected. For instance to get 2 decimal digits you need one word of precision which, on a 64-bit machine, actually gives you 19 digits (19 < log10(264) < 20). The value returned when typing `default(realprecision)` is the internal number of significant digits, not the number of printed digits:

      ? default(realprecision, 2)
            realprecision = 19 significant digits (2 digits displayed)
      ? default(realprecision)
      %1 = 19

The default value is `38`, resp. `28`, on a 64-bit, resp. 32-bit, machine.

#### recover

This toggle is either 1 (on) or 0 (off). If you change this to 0, any error becomes fatal and causes the gp interpreter to exit immediately. Can be useful in batch job scripts.

The default value is `1`.

#### secure

This toggle is either 1 (on) or 0 (off). If on, the `system` and `extern` command are disabled. These two commands are potentially dangerous when you execute foreign scripts since they let `gp` execute arbitrary UNIX commands. `gp` will ask for confirmation before letting you (or a script) unset this toggle.

The default value is `0`.

#### seriesprecision

Number of significant terms when converting a polynomial or rational function to a power series (see `\ps`).

The default value is `16`.

#### simplify

This toggle is either 1 (on) or 0 (off). When the PARI library computes something, the type of the result is not always the simplest possible. The only type conversions which the PARI library does automatically are rational numbers to integers (when they are of type `t_FRAC` and equal to integers), and similarly rational functions to polynomials (when they are of type `t_RFRAC` and equal to polynomials). This feature is useful in many cases, and saves time, but can be annoying at times. Hence you can disable this and, whenever you feel like it, use the function `simplify` (see Chapter 3) which allows you to simplify objects to the simplest possible types recursively (see `\y`).

The default value is `1`.

#### sopath

This is a list of directories, separated by colons ':' (semicolons ';' in the DOS world, since colons are preempted for drive names). When asked to `install` an external symbol from a shared library whose name is not given by an absolute path (does not start with `/`, `./` or `../`), `gp` will look for it in these directories, in the order they were written in `sopath`. Here, as usual, `.` means the current directory, and `..` its immediate parent. Environment expansion is performed.

The default value is `""`, corresponding to an empty list of directories: `install` will use the library name as input (and look in the current directory if the name is not an absolute path).

#### strictargs

This toggle is either 1 (on) or 0 (off). If on, all arguments to new user functions are mandatory unless the function supplies an explicit default value. Otherwise arguments have the default value 0.

In this example,

        fun(a,b=2)=a+b

`a` is mandatory, while `b` is optional. If `strictargs` is on:

      ? fun()
       ***   at top-level: fun()
       ***                 ^ — --
       ***   in function fun: a,b=2
       ***                    ^ — --
       ***   missing mandatory argument 'a' in user function.

This applies to functions defined while `strictargs` is on. Changing `strictargs` does not affect the behavior of previously defined functions.

The default value is `0`.

#### strictmatch

Obsolete. This toggle is now a no-op.

#### threadsize

This default is specific to the parallel version of PARI and gp (built via `Configure --mt = prthread` or `mpi`) and is ignored otherwise. In parallel mode, each thread allocates its own private stack for its computations, see `parisize`. This value determines the size in bytes of the stacks of each thread, so the total memory allocated will be `parisize`+`nbthreads` x `threadsize`.

If set to 0, the value used is the same as `parisize`. It is not easy to estimate reliably a sufficient value for this parameter because PARI itself will parallelize computations and we recommend to not set this value explicitly unless it solves a specific problem for you. For instance if you see frequent messages of the form

       *** Warning: not enough memory, new thread stack 10000002048

(Meaning that `threadsize` had to be temporarily increased.) On the other hand we strongly recommend to set `parisizemax` and `threadsizemax` to a non-zero value.

The default value is 0.

#### threadsizemax

This default is specific to the parallel version of PARI and gp (built via `Configure --mt = pthread` or `mpi`) and is ignored otherwise. In parallel mode, each threads allocates its own private stack for its computations, see `parisize` and `parisizemax`. The values of `threadsize` and `threadsizemax` determine the usual and maximal size in bytes of the stacks of each thread, so the total memory allocated will be between `parisize`+`nbthreads` x `threadsize`. and `parisizemax`+`nbthreads` x `threadsizemax`.

If set to 0, the value used is the same as `threadsize`. We strongy recommend to set both `parisizemax` and `threadsizemax` to a non-zero value.

The default value is 0.

#### timer

This toggle is either 1 (on) or 0 (off). Every instruction sequence in the gp calculator (anything ended by a newline in your input) is timed, to some accuracy depending on the hardware and operating system. When `timer` is on, each such timing is printed immediately before the output as follows:

      ? factor(2^2^7+1)
      time = 108 ms.     \\ this line omitted if 'timer' is 0
      %1 =
      [     59649589127497217 1]

      [5704689200685129054721 1]

(See also `#` and `##`.)

The time measured is the user CPU time, not including the time for printing the results. If the time is negligible ( < 1 ms.), nothing is printed: in particular, no timing should be printed when defining a user function or an alias, or installing a symbol from the library.

The default value is `0` (off).