
Dom::IntegerMod
-- residue
class rings modulo integers
Introduction
Dom::IntegerMod(
n)
creates the residue
class ring of integers modulo n
.
Domain
Dom::IntegerMod(n)
Parameters
n |
- |
positive integer greater than 1 |
Introduction
Dom::IntegerMod(
n)
(a)
creates
the residue class of a
modulo n
.
Creating
Elements
Dom::IntegerMod(
n)
(a)
Parameters
a |
- |
any integer or a rational number whose denominator is
coprime to n |
Categories
Related
Domains
Dom::Integer
, Dom::GaloisField
Entries
- characteristic
-
the characteristic of the residue class ring, n
- one
-
the unit element, 1 mod n
- zero
-
the zero element, 0 mod n
Method _divide: division of two elements
_divide(dom element1, dom element2)
-
- This method divides two elements. The result is an element of the
residue class ring.
- This method overloads
_divide
.
Method _invert: invert elements
_invert(dom element)
-
- This method inverts an element. The result is an element of the
residue class ring.
- This method overloads
_invert
.
Method _mult: multiply elements
_mult(dom element...)
-
- This method multiplies elements. The result is an element of the
residue class ring.
- This method overloads
_mult
.
Method _negate: negate elements
_negate(dom element)
-
- This method negates an element. The result is an element of the
residue class ring.
- This method overloads
_negate
.
Method _plus: add elements
_plus(dom element...)
-
- This method adds elements. The result is an element of the residue
class ring.
- This method overloads
_plus
.
Method _power: power of elements
_power(dom element, integer power)
-
- This method returns the
power
th power of an element.
The result is an element of the residue class ring.
- This method overloads
_power
.
Method _subtract: subtraction of two elements
_subtract(dom element1, dom element2)
-
- This method subtracts two elements. The result is an element of the
residue class ring.
- This method overloads
_subtract
.
Method isSquare: test for being a square
isSquare(dom element)
-
- This method returns
TRUE
if element
is the
square of another element, and FALSE
otherwise.
Method iszero: zero test
iszero(dom element)
-
- This method returns
TRUE
, if element
is zero,
otherwise FALSE
.
- This method overloads
iszero
.
Method ln: discrete logarithm
ln(dom element, dom
base)
-
- This method returns the discrete logarithm of
element
with respect to the base base
.
- The result is
infinity
if element
is
not in the subgroup generated by base
.
- The result is
FAIL
if
base
is not a unit.
- This method overloads
ln
.
Method order: order
order(dom element)
-
- This method returns the order of
element
in the group
of multiplicative units.
- The result is
FAIL
if
element
is not a unit.
Method TeX: TeX output
TeX(dom element)
-
- This method converts
element
to a TeX-formatted
string.
Method convert: conversion
convert(Type::Rational
number)
-
- This method converts an integer or rational number into an element
of the domain.
- The conversion fails if the denominator of
number
and
the modulus n
are not relatively prime.
Method convert_to: conversion
convert_to(dom element, DOM_DOMAIN domain)
-
- This method converts
element
into an element of the
given domain if possible (now DOM_INT
and Dom::Integer
).
Method expr: convert an element to an expression
expr(dom element)
-
- This method converts
element
into an integer
number.
- This method overloads
expr
.
Method print: printing elements
print(dom element)
-
- This method returns an expression used for displaying the
element.
Method random: random element
random()
-
- This method creates a random element of the domain.
- This method overloads
random
.
Example
1
We define the residue class ring Z7:
>> Z7:= Dom::IntegerMod(7)
Dom::IntegerMod(7)
Next, we create some elements:
>> a:= Z7(1); b:= Z7(2); c:= Z7(3)
1 mod 7
2 mod 7
3 mod 7
We may use infix notation for arithmetical operations
since the operators have been overloaded:
>> a + b, a*b*c, 1/c, b/c/a/c
3 mod 7, 6 mod 7, 5 mod 7, 1 mod 7
a
and b
are squares while
c
is not:
>> Z7::isSquare(a), Z7::isSquare(b), Z7::isSquare(c)
TRUE, TRUE, FALSE
Indeed, c
is a generator of the group of
units:
>> Z7::order(a), Z7::order(b), Z7::order(c)
1, 3, 6
Super-Domain
Dom::BaseDomain
Axioms
Ax::normalRep
, Ax::canonicalRep
, Ax::noZeroDivisors
, Ax::closedUnitNormals
,
Ax::canonicalUnitNormal
,
Ax::efficientOperation("_invert")
,
Ax::efficientOperation("_divide")
,
Ax::efficientOperation("_mult")
Changes
Do you have
questions or comments?
Copyright © SciFace Software GmbH & Co. KG
2000