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
.
If true, enables the "break loop" debugging mode, see Section [Label: se:break_loop].
The default value is 1
if we are running an interactive gp
session, and 0
otherwise.
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 "a_1,...,a_k"
where k <=
7 and each
a_i 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 [c_0,c_1,c_2] where c_0 stands for foreground color, c_1 for background color, and c_2 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 a_i 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).
The GP function names and syntax have changed tremendously between versions 1.xx and 2.00. To help you cope with this we provide some kind of backward compatibility, depending on the value of this default:
compatible
= 0: no backward compatibility. In this mode, a very
handy function, to be described in Section [Label: se:whatnow], is whatnow
,
which tells you what has become of your favourite functions, which gp
suddenly can't seem to remember.
compatible
= 1: warn when using obsolete functions, but
otherwise accept them. The output uses the new conventions though, and
there may be subtle incompatibilities between the behavior of former and
current functions, even when they share the same name (the current function
is used in such cases, of course!). We thought of this one as a transitory
help for gp
old-timers. Thus, to encourage switching to compatible
= 0,
it is not possible to disable the warning.
compatible
= 2: use only the old function naming scheme (as
used up to version 1.39.15), but taking case into account. Thus
I
( = sqrt{-1}) is not the same as i
(user variable, unbound
by default), and you won't get an error message using i
as a loop
index as used to be the case.
compatible
= 3: try to mimic exactly the former behavior. This
is not always possible when functions have changed in a fundamental way.
But these differences are usually for the better (they were meant to,
anyway), and will probably not be discovered by the casual user.
One adverse side effect is that any user functions and aliases that have
been defined before changing compatible
will get erased if this
change modifies the function list, i.e. if you move between groups
{0,1} and {2,3} (variables are unaffected). We of course strongly
encourage you to try and get used to the setting compatible
= 0.
Note that the default new_galois_format
is another compatibility setting,
which is completely independent of compatible
.
The default value is 0
.
The name of directory containing the optional data files. For now,
this includes the elldata
, galdata
, galpol
, seadata
packages.
The default value is \datadir (the location of installed precomputed data,
can be specified via Configure --datadir =
).
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).
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).
Memory debugging level. If it is non-zero, gp
will regularly print
information on memory usage. If it's greater than 2, it will indicate any
important garbage collecting and the function it is taking place in
(see \gm
).
Important Note: As it noticeably slows down the performance, the first functionality (memory usage) is disabled if you're not running a version compiled for debugging (see Appendix A).
The default value is 0
(no debugging messages).
This toggle is either 1 (on) or 0 (off). 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
).
The default value is 0
(no echo).
This toggle is either 1 (on) or 0 (off). If on,
the integer factorization machinery calls addprimes
on primes
factor that were difficult to find (larger than 2^24), 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 defaut value is 0
.
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 defaut value is 0
.
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 \idx{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.
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 character strings, 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. For instance [250, 235, 215]
and
"antiquewhite"
represent the same color. RGB codes are cryptic but
often easier to generate.
The default value is ["white"
, "black"
, "blue"
,
"violetred"
, "red"
, "green"
, "grey"
,
"gainsboro"
].
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]
.
Name of the external help program to use from within gp
when
extended help is invoked, usually through a ??
or ???
request
(see Section [Label: se:exthelp]), or M-H
under readline (see
Section [Label: se:readline]).
The default value is the path to the gphelp
script we install.
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 >
The default value is < undefined >
(no history file).
gp
keeps a history of the last
histsize
results computed so far, which you can recover using the
%
notation (see Section [Label: 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
.
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 [Label: 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
.
If set to a positive value, gp
wraps every single line after
printing that many characters.
The default value is 0
(unset).
Principal branch of the natural logarithm of x belongs to C^*, i.e. such that {Im(log}(x)) belongs to ]-Pi,Pi]. The branch cut lies along the negative real axis, continuous with quadrant 2, i.e. such that lim_{b\to 0^+} log (a+bi) = log a for a belongs to R^*. The result is complex (with imaginary part equal to Pi) if x belongs to R and x < 0. In general, the algorithm uses the formula log(x) ~ (Pi)/(2{agm}(1, 4/s)) - m log 2, if s = x 2^m is large enough. (The result is exact to B bits provided s > 2^{B/2}.) At low accuracies, the series expansion near 1 is used.
p-adic arguments are also accepted for x, with the convention that log(p) = 0. Hence in particular exp(log(x))/x is not in general equal to 1 but to a (p-1)-th root of unity (or ±1 if p = 2) times a power of p.
The library syntax is GEN glog(GEN x, long prec)
.
For a t_PADIC
x, the function
GEN Qp_log(GEN x)
is also available.
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"
.
Number of threads to use for parallel computing.
The exact meaning an default depend on the mt
engine used:
* single
: not used (always one thread).
* pthread
: number of threads (unlimited, default: number of core)
* mpi
: number of MPI process to use (limited to the number allocated by mpirun
,
default: use all allocated process).
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 defaut value is 0
. This value will change to 1 (set) in the next
major version.
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).
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 strongly recommended you increase this
default (using the -s
command-line switch, or a gprc
) if you can
afford it. Don't increase it beyond the actual amount of RAM installed on
your computer or gp
will spend most of its time paging.
In case of emergency, you can use the allocatemem
function to
increase parisize
, once the session is started.
The default value is 4M, resp. 8M on a 32-bit, resp. 64-bit machine.
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.
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"
.
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 2^{32} - 2049 (resp 2^{64} -
2049) on a 32-bit (resp. 64-bit) machine, but values beyond 10^8,
allowing to iterate over primes up to 10^{16}, 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
.
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 [Label: 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 "? "
.
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 defaut value is ""
.
Name of the default file where
gp
is to dump its PostScript drawings (these are appended, so that no
previous data are lost). Environment and time expansion are performed.
The default value is "pari.ps"
.
In the following, C-
stands for "the Control
key combined with
another" and the same for M-
with the Meta
key; generally
C-
combinations act on characters, while the M-
ones operate on
words. The Meta
key might be called Alt
on some keyboards, will
display a black diamond on most others, and can safely be replaced by
Esc
in any case.
Typing any ordinary key inserts text where the cursor stands, the arrow keys
enabling you to move in the line. There are many more movement commands,
which will be familiar to the Emacs user, for instance C-a
/C-e
will take you to the start/end of the line, M-b
/M-f
move the
cursor backward/forward by a word, etc. Just press the < Return >
key at
any point to send your command to gp
.
All the commands you type at the gp
prompt are stored in a history,
a multiline command being saved as a single concatenated line. The Up and Down
arrows (or C-p
/C-n
) will move you through the history,
M- <
/M- >
sending you to the start/end of the history.
C-r
/C-s
will start an incremental backward/forward search. You
can kill text (C-k
kills till the end of line, M-d
to the end of
current word) which you can then yank back using the C-y
key (M-y
will rotate the kill-ring). C-_
will undo your last changes
incrementally (M-r
undoes all changes made to the current line).
C-t
and M-t
will transpose the character (word) preceding the
cursor and the one under the cursor.
Keeping the M-
key down while you enter an integer (a minus sign
meaning reverse behavior) gives an argument to your next readline command
(for instance M-- C-k
will kill text back to the start of line). If you
prefer Vi--style editing, M-C-j
will toggle you to Vi mode.
Of course you can change all these default bindings. For that you need to
create a file named .inputrc
in your home directory. For instance
(notice the embedding conditional in case you would want specific bindings
for gp
):
$if Pari-GP set show-all-if-ambiguous "\C-h": backward-delete-char "\e\C-h": backward-kill-word "\C-xd": dump-functions (: "\C-v()\C-b" # can be annoying when copy-pasting! [: "\C-v[]\C-b" $endif
C-x C-r
will re-read this init file, incorporating any
changes made to it during the current session.
Note. By default, (
and [
are bound to the function
pari-matched-insert
which, if "electric parentheses" are enabled
(default: off) will automatically insert the matching closure (respectively
)
and ]
). This behavior can be toggled on and off by giving
the numeric argument -2 to (
(M--2(
), which is useful if you
want, e.g to copy-paste some text into the calculator. If you do not want a
toggle, you can use M--0
/ M--1
to specifically switch it on or
off).
Note. In some versions of readline (2.1 for instance), the
Alt
or Meta
key can give funny results (output 8-bit accented
characters for instance). If you do not want to fall back to the Esc
combination, put the following two lines in your .inputrc
:
set convert-meta on set output-meta off
Command completion and online help. Hitting
< TAB >
will complete words for you. This mechanism is context-dependent:
gp
will strive to only give you meaningful completions in a given
context (it will fail sometimes, but only under rare and restricted
conditions).
For instance, shortly after a ~
, we expect a user name, then a
path to some file. Directly after default(
has been typed, we would
expect one of the default
keywords. After whatnow(
, we expect
the name of an old function, which may well have disappeared from this
version. After a '.', we expect a member keyword. And generally of course, we
expect any GP symbol which may be found in the hashing lists: functions (both
yours and GP's), and variables.
If, at any time, only one completion is meaningful, gp
will provide it
together with
* an ending comma if we are completing a default,
* a pair of parentheses if we are completing a function name. In
that case hitting < TAB >
again will provide the argument list as given
by the online help\footnote{*}{recall that you can always undo the effect
of the preceding keys by hitting C-_
}.
Otherwise, hitting < TAB >
once more will give you the list of possible
completions. Just experiment with this mechanism as often as possible,
you will probably find it very convenient. For instance, you can obtain
default(seriesprecision,10)
, just by hitting def < TAB > se < TAB > 10
,
which saves 18 keystrokes (out of 27).
Hitting M-h
will give you the usual short online help concerning the
word directly beneath the cursor, M-H
will yield the extended help
corresponding to the help
default program (usually opens a dvi
previewer, or runs a primitive tex-to-ASCII program). None of these disturb
the line you were editing.
The number of significant digits used to convert exact inputs given to
transcendental functions (see Section [Label: 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 behaviour, 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 <
log_{10}(2^{64}) < 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.
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
.
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
.
Number of significant terms
when converting a polynomial or rational function to a power series
(see \ps
).
The default value is 16
.
This function simplifies x as much as it can. Specifically, a complex or
quadratic number whose imaginary part is the integer 0 (i.e. not Mod(0,2)
or 0.E-28
) is converted to its real part, and a polynomial of degree 0
is converted to its constant term. Simplifications occur recursively.
This function is especially useful before using arithmetic functions, which expect integer arguments:
? x = 2 + y - y %1 = 2 ? isprime(x) *** at top-level: isprime(x) *** ^---------- *** isprime: not an integer argument in an arithmetic function ? type(x) %2 = "t_POL" ? type(simplify(x)) %3 = "t_INT"
Note that GP results are simplified as above before they are stored in the
history. (Unless you disable automatic simplification with \y
, that is.)
In particular
? type(%1) %4 = "t_INT"
The library syntax is GEN simplify(GEN x)
.
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).
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 optionnal. 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
.
This toggle is either 1 (on) or 0 (off). If on, unused characters after a sequence has been processed will produce an error. Otherwise just a warning is printed. This can be useful when you are unsure how many parentheses you have to close after complicated nested loops. Please do not use this; find a decent text-editor instead.
The default value is 1
.
In parallel mode, each threads needs its own private stack in which
to do its computations, see parisize
. This value determines the size
in bytes of the stacks of each threads, so the total memory allocated will be
parisize
+nbthreads
x threadsize
.
If set to 0, the value used is the same as parisize
.
The default value is 0.
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).