Annotation of OpenXM_contrib/pari-2.2/doc/appc.tex, Revision 1.1
1.1 ! noro 1: % $Id: appc.tex,v 1.8 2000/11/06 18:59:00 karim Exp $
! 2: % Copyright (c) 2000 The PARI Group
! 3: %
! 4: % This file is part of the PARI/GP documentation
! 5: %
! 6: % Permission is granted to copy, distribute and/or modify this document
! 7: % under the terms of the GNU Free Documentation License
! 8: \appendix{Summary of Available Constants}
! 9:
! 10: In this appendix we give the list of predefined constants available in the
! 11: PARI library. All of them are in the \idx{heap} and {\it not\/} on the PARI
! 12: \idx{stack}. We start by recalling the \idx{universal object}s introduced in
! 13: \secref{se:intro4}:
! 14: %
! 15: \bprog
! 16: t_INT: gzero (zero), gun (un), gdeux (deux)
! 17: t_FRAC: ghalf (lhalf)
! 18: t_COMPLEX: gi
! 19: t_POL: polun[..] (lpolun[..]), polx[..] (lpolx[..])
! 20: @eprog
! 21: \noindent Only polynomials in the variables \kbd{0} and \kbd{MAXVARN} are
! 22: defined initially. Use \kbd{fetch\_var()} (see \secref{se:fetch_var}) to
! 23: create new ones.
! 24:
! 25: \noindent The other objects are not initialized by default:
! 26:
! 27: \tet{bern}(i). This is the $2i$-th Bernoulli number ($B_0=1$, $B_2=1/6$,
! 28: $B_4=-1/30$, etc\dots). To initialize them, use the function:
! 29:
! 30: \fun{void}{mpbern}{long n, long prec}
! 31:
! 32: This creates the even numbered Bernoulli numbers up to $B_{2n-2}$ {\it as
! 33: real numbers\/} of precision \kbd{prec}. They can then be used with the macro
! 34: \kbd{bern(i)}. Note that this is not a function but simply an abbreviation,
! 35: hence care must be taken that \kbd{i} is inside the right bounds (i.e. $0\le
! 36: \kbd{i}\le n-1$) before using it, since no checking is done by PARI itself.
! 37:
! 38: \tet{geuler}. This is Euler's constant. It is initialized by the first call
! 39: to \tet{mpeuler} (see \secref{se:euler}).
! 40:
! 41: \tet{gpi}. This is the number $\pi$. It is initialized by the first call to
! 42: \tet{mppi} (see \secref{se:pi}).
! 43:
! 44: The use of both \tet{geuler} and \tet{gpi} is deprecated since it's always
! 45: possible that some library function increases the precision of the constant
! 46: {\it after} you've computed it, hence modifying the computation accuracy
! 47: without your asking for it and increasing your running times for no good
! 48: reason. You should always use \tet{mpeuler} and \tet{mppi} (note that only
! 49: the first call will actually compute the constant, unless a higher precision
! 50: is required).
! 51:
! 52: Finally, one has access to a table of (differences of) primes through the
! 53: pointer \tet{diffptr}. This is used as follows: when
! 54:
! 55: \fun{void}{pari_init}{long size, long maxprime}
! 56:
! 57: \noindent is called, this table is initialized with the successive
! 58: differences of primes up to (just a little beyond) \kbd{maxprime}
! 59: (see \secref{se:intro4}). \tet{maxprime} has to be less than $436272744$,
! 60: whatever memory is available. A difference of $0$ means we have reached the
! 61: end of the table. The largest prime computable using this table is
! 62: available as the output of
! 63:
! 64: \fun{ulong}{maxprime}{}
! 65:
! 66: \noindent Here's a small example:
! 67: %
! 68: \bprog
! 69: byteptr d = diffptr;
! 70: ulong p = 0;
! 71:
! 72: if (maxprime() < goal) err(primer1); /*@Ccom not enough primes */
! 73: while (p <= goal) /*@Ccom run through all primes up to \kbd{goal} */
! 74: {
! 75: p += *d++;
! 76: ...
! 77: }
! 78: @eprog\noindent
! 79: Here, we use the general error handling function \kbd{err} (see
! 80: \secref{se:err}), with the codeword \kbd{primer1}. This will just print
! 81: the error message:
! 82:
! 83: \kbd{*** not enough precomputed primes}
! 84:
! 85: \noindent and then abort the computations.
! 86:
! 87: You can use the function \kbd{initprimes} from the file \kbd{arith2.c} to
! 88: compute a new table on the fly and assign it to \kbd{diffptr} or to a
! 89: similar variable of your own. Beware that before changing \kbd{diffptr},
! 90: you should really free the (\kbd{malloc}ed) precomputed table first, and then
! 91: all pointers into the old table will become invalid.
! 92:
! 93: PARI currently guarantees that the first 6547 primes, up to and including
! 94: 65557, will be present in the table, even if you set \kbd{maxnum} to zero.
! 95:
! 96: In addition, some single or double-precision real numbers are predefined,
! 97: and their list is in the file \kbd{paricom.h}.
! 98: \vfill\eject
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>