Operations and functions.

The PARI philosophy. The basic philosophy which governs PARI is that operations and functions should first give as exact a result as possible, and second, be permitted if they make any kind of sense.

More specifically, if you do an operation (not a transcendental one) between exact objects, you will get an exact object. For example, dividing 1 by 3 does not give 0.33333 ... as you could expect, but simply the rational number (1/3). If you really want the result in type real, evaluate 1./3 or add 0. to (1/3).

The result of operations between imprecise objects will be as precise as possible. Consider for example one of the most difficult cases, that is the addition of two real numbers x and y. The [*] of the result is a priori unpredictable; it depends on the precisions of x and y, on their sizes (i.e. their exponents), and also on the size of x + y. PARI works out automatically the right precision for the result, even when it is working in calculator mode GP where there is a [*]. See the technical reference manual for the precise formulas giving the precision of the result.

The second part of the PARI philosophy is that PARI operations are in general quite permissive. For instance taking the exponential of a vector should not make sense. However, it is frequent that a computation comes out with a result which is a vector with many components, and one wants to get the exponential of each one. This could easily be done either under GP or in library mode, but in fact PARI assumes that this is exactly what you want to do when you take the exponential of a vector, so no work is necessary. Most transcendental functions work in the same way (see chapter 3 for details).

An ambiguity would arise with square matrices. PARI always considers that you want to do componentwise function evaluation, hence to get for example the exponential of a square matrix you would need to use a function with a different name, matexp for instance. In the present version , this is not yet implemented. See however the program in Appendix C, which is a first attempt for this particular function.

The available operations and functions in PARI are described in detail in chapter 3. Here is a brief summary:

Standard operations.

The four standard operators +, -, *, / of course exist. It should be once more emphasized that division is, as far as it can, an exact operation (4 divided by 3 gives (4/3)). In addition to this, operations on integers or polynomials, like \ (Euclidean division), % (Euclidean remainder) exist. There is also the exponentiation operator $\hat{{\ }}$, when the exponent is of type integer (otherwise it is considered as a transcendental function). Finally, the logical operators && (and operator), | | (or operator) exist, giving as results 1 (true) or 0 (false). Note that the C-syntax & and | is also accepted as a synonym. However, there is no bitwise and or or.

Conversions and similar functions.

Many conversion functions are available to convert between different types. For example floor, ceiling, rounding, truncation, etc.... Other simple functions are included like real and imaginary part, conjugation, norm, absolute value, changing precision or creating an integermod or a polymod.

Transcendental functions.

They usually operate on any object in $\Bbb$C, and some also on p-adics. The list is everexpanding and of course contains all the elementary functions, plus already a number of others. Recall that by extension, PARI usually allows a transcendental function to operate componentwise on vectors or matrices.

Arithmetic functions.

Apart from a few like the factorial function or the Fibonacci numbers, these are functions which explicitly use the prime factor decomposition of integers. The standard functions are included. In the present version , a primitive, but useful version of Lenstra's Elliptic Curve Method (ECM) has been implemented. More sophisticated functions are implemented, like finding integral bases and discriminants of number fields, computing class numbers and regulators (for quadratic fields only), and also many functions dealing with elliptic curves over $\Bbb$Q or over local fields.

Other functions.

Quite a number of other functions dealing with polynomials (e.g. finding complex or p-adic roots, factoring,...), power series (e.g. substitution, reversion), linear algebra (e.g. determinant, characteristic polynomial, linear systems), and different kinds of recursions are also included. In addition, standard numerical analysis routines like Romberg integration (open or closed, on a finite or infinite interval), real root finding when the root is bracketed, polynomial interpolation, series acceleration, and plotting are included. See the last sections of chapter 3 for details.