Ring of pari objects

AUTHORS:

  • William Stein (2004): Initial version.

  • Simon King (2011-08-24): Use UniqueRepresentation, element_class and proper initialisation of elements.

class sage.rings.pari_ring.Pari(x, parent=None)[source]

Bases: RingElement

Element of Pari pseudo-ring.

class sage.rings.pari_ring.PariRing[source]

Bases: Singleton, Parent

EXAMPLES:

sage: R = PariRing(); R
Pseudoring of all PARI objects.
sage: loads(R.dumps()) is R
True
>>> from sage.all import *
>>> R = PariRing(); R
Pseudoring of all PARI objects.
>>> loads(R.dumps()) is R
True
Element[source]

alias of Pari

characteristic()[source]
is_field(proof=True)[source]
random_element(x=None, y=None, distribution=None)[source]

Return a random integer in Pari.

Note

The given arguments are passed to ZZ.random_element(...).

INPUT:

  • \(x\), \(y\) – optional integers, that are lower and upper bound for the result. If only \(x\) is provided, then the result is between 0 and \(x-1\), inclusive. If both are provided, then the result is between \(x\) and \(y-1\), inclusive.

  • distribution – (optional) string, so that ZZ can make sense of it as a probability distribution

EXAMPLES:

sage: R = PariRing()
sage: R.random_element().parent() is R
True
sage: R(5) <= R.random_element(5,13) < R(13)
True
sage: R.random_element(distribution='1/n').parent() is R
True
>>> from sage.all import *
>>> R = PariRing()
>>> R.random_element().parent() is R
True
>>> R(Integer(5)) <= R.random_element(Integer(5),Integer(13)) < R(Integer(13))
True
>>> R.random_element(distribution='1/n').parent() is R
True
zeta()[source]

Return -1.

EXAMPLES:

sage: R = PariRing()
sage: R.zeta()
-1
>>> from sage.all import *
>>> R = PariRing()
>>> R.zeta()
-1