Dom::Integer -- the ring of
integer numbers
IntroductionDom::Integer is the ring of integer numbers represented
by elements of the domain DOM_INT.
Creating
ElementsDom::Integer(x)
Parametersx |
- | an integer |
Cat::EuclideanDomain
, Cat::FactorialDomain, Cat::DifferentialRing,
Cat::OrderedSet
Related
DomainsDom::Complex, Dom::Float, Dom::Numerical, Dom::Rational, Dom::Real
DetailsDom::Integer is the domain of integer numbers
represented by expressions of type DOM_INT.Dom::Integer are usually not created
explicitly. However, if one creates elements using the usual syntax, it
is checked whether the input is an integer number. This means that
Dom::Integer is a faēcade domain which creates elements of
domain type DOM_INT.Dom::Integer is trivial,
it contains constants only.Dom::Integer has the domain Dom::Numerical as its super domain,
i.e., it inherits each method which is defined by
Dom::Numerical and not re-implemented by
Dom::Integer. Methods described below are those
implemented by Dom::Integer._divide(dom x, dom
y)x/y if y divides
x and FAIL
otherwise._divides(dom x, dom
y)TRUE if x divides
yeuclideanDegree(dom x)x, i.e.,
abs(x).factor(dom x)x. The result
of this method is an object of the domain Factored.gcd(dom x1, dom
x2...)x1,
x2...gcdex(dom x, dom
y)_invert(dom x)x.
This is x if x is 1 or
-1, and FAIL
otherwise.irreducible(dom x)TRUE if and only if x is
prime.isUnit(dom x)TRUE if x is a unit, i.e.,
if x is 1 or -1, otherwise it
returns FALSE.lcm(dom x1, dom
x2...)x1,
x2...quo(dom x, dom
y)x and
y, i.e., x div y.random()random(integer n)n-1.random(integer m..integer n)m and
n.rem(dom x, dom
y)x and
y, i.e., modp(x,y).unitNormal(dom x)x, i.e.,
abs(x).convert_to(dom x, any
T)x to an
element of type T, or, if T is not a domain,
to the domain type of T. If the conversion fails, then
FAIL is returned.T: DOM_INT, Dom::Integer, Dom::Rational, DOM_FLOAT, Dom::Float and Dom::Numerical.testtype(any x, dom
T)x to the
domain Dom::Integer. This is the case if x is
of type DOM_INT. It
returns TRUE if it can perform the conversion. Otherwise
FAIL is returned.testtype and not directly by the
user. Example 2 demonstrates this
behavior.
Example
1Creating some integer numbers using
Dom::Integer. This example also shows that
Dom::Integer is a faēcade domain.
>> Dom::Integer(2); domtype(%)
2
DOM_INT
>> Dom::Integer(2/3)
Error: illegal arguments [Dom::Integer::new]
Example
2By tracing the method
Dom::Integer::testtype we can see the interaction between
testtype and
Dom::Integer::testtype.
>> prog::trace(Dom::Integer::testtype): delete x: testtype(x, Dom::Integer); testtype(3, Dom::Integer); prog::untrace(Dom::Integer::testtype):
enter 'Dom::Integer::testtype' with args : x, Dom::Integer
leave 'Dom::Integer::testtype' with result : FAIL
FALSE
enter 'Dom::Integer::testtype' with args : 3, Dom::Integer
leave 'Dom::Integer::testtype' with result : TRUE
TRUE
Super-DomainAx::canonicalRep
, Ax::systemRep,
Ax::canonicalOrder,
Ax::canonicalUnitNormal,
Ax::closedUnitNormals,
Ax::efficientOperation("_divide"),
Ax::efficientOperation("_mult")