| Home | Trees | Indices | Help |
|---|
|
|
File: sage/rings/integer_ring.pyx (starting at line 1)
\protect{Ring $\Z$ of Integers}
The class \\class{IntegerRing} represents
the ring $\\mathbf{Z}$ of (arbitrary precision) integers. Each integer
is an instance of the class \\class{Integer}, which is defined
in a Pyrex extension module that wraps GMP integers
(the \\class{mpz_t} type in GMP).
sage: Z = IntegerRing(); Z
Integer Ring
sage: Z.characteristic()
0
sage: Z.is_field()
False
There is a unique instances of class \\class{IntegerRing}. To create
an \\class{Integer}, coerce either a Python int, long, or a string.
Various other types will also coerce to the integers, when it makes
sense.
sage: a = Z(1234); b = Z(5678); print a, b
1234 5678
sage: type(a)
<type 'sage.rings.integer.Integer'>
sage: a + b
6912
sage: Z('94803849083985934859834583945394')
94803849083985934859834583945394
TESTS:
sage: Z = IntegerRing()
sage: Z == loads(dumps(Z))
True
|
|||
|
IntegerRing_class File: sage/rings/integer_ring.pyx (starting at line 103) The ring of integers. |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Z =
|
|||
ZZ =
|
|||
|
|||
File: sage/rings/integer_ring.pyx (starting at line 821)
Return the integer ring
EXAMPLE:
sage: IntegerRing()
Integer Ring
sage: ZZ==IntegerRing()
True
|
File: sage/rings/integer_ring.pyx (starting at line 848)
Compute and return a Chinese Remainder Theorem basis for the list
X of coprime integers.
INPUT:
X -- a list of Integers that are coprime in pairs
OUTPUT:
E -- a list of Integers such that E[i] = 1 (mod X[i])
and E[i] = 0 (mod X[j]) for all j!=i.
The E[i] have the property that if A is a list of objects, e.g.,
integers, vectors, matrices, etc., where A[i] is moduli X[i], then
a CRT lift of A is simply
sum E[i] * A[i].
ALGORITHM:
To compute E[i], compute integers s and t such that
s * X[i] + t * (prod over i!=j of X[j]) = 1. (*)
Then E[i] = t * (prod over i!=j of X[j]). Notice that equation
(*) implies that E[i] is congruent to 1 modulo X[i] and to 0
modulo the other X[j] for j!=i.
COMPLEXITY: We compute len(X) extended GCD's.
EXAMPLES:
sage: X = [11,20,31,51]
sage: E = crt_basis([11,20,31,51])
sage: E[0]%X[0]; E[1]%X[0]; E[2]%X[0]; E[3]%X[0]
1
0
0
0
sage: E[0]%X[1]; E[1]%X[1]; E[2]%X[1]; E[3]%X[1]
0
1
0
0
sage: E[0]%X[2]; E[1]%X[2]; E[2]%X[2]; E[3]%X[2]
0
0
1
0
sage: E[0]%X[3]; E[1]%X[3]; E[2]%X[3]; E[3]%X[3]
0
0
0
1
|
File: sage/rings/integer_ring.pyx (starting at line 833)
Return the factorization of the positive integer $n$ as a sorted
list of tuples $(p_i,e_i)$ such that $n=\prod p_i^{e_i}$.
For further documentation see sage.rings.arith.factor()
EXAMPLE:
sage: sage.rings.integer_ring.factor(420)
2^2 * 3 * 5 * 7
|
File: sage/rings/integer_ring.pyx (starting at line 84) Internal funtion: returns true iff x is the ring ZZ of integers EXAMPLES: sage: from sage.rings.integer_ring import is_IntegerRing sage: is_IntegerRing(ZZ) True sage: is_IntegerRing(QQ) False sage: is_IntegerRing(parent(3)) True sage: is_IntegerRing(parent(1/3)) False |
|
|||
Z
|
ZZ
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:28 2008 | http://epydoc.sourceforge.net |