Package sage :: Package rings :: Module integer_mod_ring :: Class IntegerModRing
[show private | hide private]
[frames | no frames]

Type IntegerModRing

               Ring --+
                      |
         object --+   |
                  |   |
_uniqIntegerModRing --+
                      |
                     IntegerModRing


The ring of integers modulo N, e.g., when N is prime
this is a prime finite field.

Create with the command
      IntegerModRing(modulus)

INPUT:
    modulus -- an integer > 1
OUTPUT:
    IntegerModRing -- the ring of integers modulo N.

EXAMPLES:
    >>> from sage.rings.rings import *
    >>> FF = IntegerModRing(17)
    >>> FF
    Ring of integers modulo 17
    >>> type(FF)
    <class 'sage.rings.integer_mod_ring.IntegerModRing'>
    >>> FF.is_field()
    True
    >>> FF.characteristic()
    17
    >>> FF.modulus()
    17
    >>> gens = FF.unit_gens()
    >>> a = gens[0]
    >>> a
    3
    >>> type(a)
    <class 'sage.rings.integer_mod.IntegerMod'>
    >>> a.is_square()
    False
    >>> def pow(i): return a**i
    >>> [pow(i) for i in range(16)]
    [1, 3, 9, 10, 13, 5, 15, 11, 16, 14, 8, 7, 4, 12, 2, 6]
    
    >>> Z16 = IntegerModRing(16)
    >>> Z16.is_field()
    False
    >>> Z16.modulus()
    16
    >>> Z16.characteristic() 
    16
    >>> gens = Z16.unit_gens()
    >>> gens
    [15, 5]
    >>> a = gens[0]
    >>> b = gens[1]
    >>> def powa(i): return a**i
    >>> def powb(i): return b**i
    >>> gp_exp = FF.unit_group_exponent()
    >>> gp_exp
    16
    >>> [powa(i) for i in range(15)]
    [1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1]
    >>> [powb(i) for i in range(15)]
    [1, 5, 9, 13, 1, 5, 9, 13, 1, 5, 9, 13, 1, 5, 9]
    >>> a.order()
    2
    >>> b.order()
    4

Method Summary
  __init__(self, modulus)
  __call__(self, x)
Coerce x into the ring.
  __cmp__(self, other)
  __getitem__(self, n)
  __repr__(self)
  characteristic(self)
  factored_modulus(self)
  is_field(self)
  modulus(self)
  name(self)
  random(self)
  unit_gens(self)
Returns generators for the (Z/NZ)^*.
  unit_group_exponent(self)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)
    Inherited from Ring
  is_atomic_repr(self)
True if the elements have atomic string representations, in the sense that they print if they print at s, then -s means the negative of s.
  type(self)

Instance Method Details

__call__(self, x)
(Call operator)

Coerce x into the ring.
Overrides:
sage.rings.ring.Ring.__call__ (inherited documentation)

unit_gens(self)

Returns generators for the (Z/NZ)^*.

We compute the list of generators using a deterministic
algorithm, so the generators list will always be the same.
Each generator corresponds to a prime divisor of N (or
possibly two prime divisors for p=2).

INPUT: (none)
OUTPUT:
    list -- a list of elements of self

Generated by Epydoc 2.1 on Fri Jun 24 17:58:45 2005 http://epydoc.sf.net