Dom::Product
-- homogeneous
direct productsDom::Product
(Set, n)
is an
n-fold direct product of the domain Set.
Dom::Product(Set <, n>)
Set |
- | an arbitrary domain of elements, i.e., a domain of
category Cat::BaseCategory |
n |
- | the dimension of the product (a positive integer); default is 1 |
Dom::Product
(Set <, n>)(e1, e2...,
en)
Dom::Product
(Set <, n>)(List)
e1, e2..., en |
- | elements of Set or objects convertible
into such |
List |
- | a list of n elements of Set
or objects convertible into such |
Cat::HomogeneousFiniteProduct(Set)
Dom::Product
(Set, n)(e1, e2..., en)
creates the n-tuple (e1, e2, ..., en.
The objects e1
, e2
..., en
must be convertible into elements of the domain Set
,
otherwise an error message is issued.
Dom::Product
(Set, n)(List)
creates the
n-tuple (l1, l2, ..., ln).
The n elements li of List
must be
convertible into elements of the domain Set
, otherwise an
error message is issued.
The list must consist of exactly n
elements, otherwise
an error message is issued.
"D"
and "_negate"
just map the
operation to all the components of the tuple.
Most n-ary methods like "_plus"
and
"_mult"
apply the operation component-wise to the
tuples.
is the cardinal number of Dom::Product
(Set,
n)
, which is equal to n
.
is the domain S
.
is the n-tuple (Set::one, Set::one, ...,
Set::one)
. This entry only exists if Set
is a
monoid, i.e., a domain of category Cat::Monoid
.
is the n-tuple (Set::zero, Set::zero, ...,
Set::zero)
. This entry only exists if Set
is an
Abelian group, i.e., a domain of category Cat::AbelianGroup
.
_divide(dom x, dom
y)
x
by y
,
i.e., it divides the ith component of x
by the
ith component of y
(i ranges from
1 to n).Set
is a (multiplicative)
group, i.e., a domain of category Cat::Group
._divide
for n-tuples,
i.e., one may use it in the form x / y
, or in functional
notation: _divide(x, y)
._invert(dom x)
x
.Set
is a (multiplicative)
group, i.e., a domain of category Cat::Group
._invert
for n-tuples,
i.e., one may use it in the form 1/x
or
x^(-1)
, or in functional notation:
_inverse(x)
._less(dom x, dom
y)
TRUE
if x
is lexically smaller
than y
.Set
is an
ordered set, i.e., a domain of category Cat::OrderedSet
._less
for n-tuples, i.e.,
one may use it in the form x < y
, or in functional
notation: _less(x, y)
._mult(any x, any
y...)
x
and y
both are n-tuples
defined over Set
the n-tuple with the
ith component defined by x[i] * y[i]
(i ranges from 1 to n) is
returned.x
is not of the type
Dom::Product
(Set,n)
, it is considered as a
scalar which is multiplied to each component of the n-tuple
y
(and vice versa).Set
is a semigroup, i.e., a
domain of category Cat::SemiGroup
._mult
. These two result are multiplied
again with _mult
whose result then is returned._mult
for n-tuples, i.e.,
one may use it in the form x * y
, or in functional
notation: _mult(x, y)
._negate(dom x)
_negate
for n-tuples,
i.e., one may use it in the form -x
, or in functional
notation: _negate(x)
._power(dom x, integer
i)
x
to the
ith power.Set
is a
semigroup, i.e., a domain of category Cat::SemiGroup
._power
for n-tuples, i.e.,
one may use it in the form x^i
, or in functional notation:
_power(x, i)
._plus(dom x, dom
y...)
_plus
for n-tuples, i.e.,
one may use it in the form x + y
, or in functional
notation: _plus(x, y)
.D(dom x)
x
using the
method "D"
of the domain S
.Set
is a partial
differential ring, i.e., a domain of category Cat::PartialDifferentialRing
.D
for n-tuples, i.e., one may
use it in the form D(x)
.diff(dom a,
variable x)a
using the method
"diff"
of the domain S
.diff
for n-tuples, i.e., one
may use it in the form diff(a, x)
.Set
is a partial
differential ring, i.e., a domain of category Cat::PartialDifferentialRing
.equal(dom x, dom
y)
x
is equal to
y
, and returns TRUE
, FALSE
or
UNKNOWN
, respectively. x
and y
are equal if and only if for each index i from 1
to n the ith components of x
and
y
are equal.intmult(dom x, integer k)
"intmult"
of
Set
).Set
is an
Abelian semigroup, i.e., a domain of category Cat::AbelianSemiGroup
.iszero(dom x)
x
consists of
zero components only and returns TRUE
, FALSE
and UNKNOWN
,
respectively.R
does not have Ax::canonicalRep
.iszero
for n-tuples, i.e.,
one may use it in the form iszero(x)
.random()
"random"
of the domain Set
to randomly
generate the components of the tuple._index(dom x, index
i)
x
(an error message is issued if i
is less than one or
greater than the number of components of x
)."op"
._index
for n-tuples, i.e.,
one may use it in the form x[i]
, or in functional
notation: _index(x, i)
.map(dom x, function
func <, any expr...>)
func
onto the components
of the n-tuple x
, with the additional function
parameters expr...
passed to func
, if given.
See the system function map
for details.
Note that the function values will not be
implicitly converted into elements of the domain Set
. One
has to take care that the function calls return elements of the domain
type Set
.
map
for
n-tuples, i.e., one may use it in the form map(x,
func...)
.mapCanFail(dom x, function func <, any
expr...>)
"map"
but returns
FAIL
if one of the function calls returned
FAIL
.op(dom x, positive
integer i)
x
,
or FAIL
if i
is greater than the number of
components of x
."_index"
.op
for n-tuples, i.e., one may
use it in the form op(x, i)
.op(dom x)
x
.set_index(dom x, index i, Set e)
x
by e
."subsop"
.This method does not check whether e
has the correct type.
_assign
for n-tuples,
i.e., one may use it in the form x[i] := e
, or in
functional notation: _assign(x[i], e)
.subs(dom x...)
subs
with additionally given parameters
to the entries of the tuple x
.The objects obtained by the substitutions will not
be implicitly converted into elements of the domain Set
.
One has to take care that the substitutions return elements of the
domain Set
.
subs
for
n-tuples, i.e., one may use it in the form
subs(x...)
. See subs
for details and calling
sequences.testEach(dom x, function func <, any
expr...>)
func
onto the components
of the tuple x
, with the additional function parameters
expr...
passed to func
, if given.
It returns TRUE
if all of these function calls returned
TRUE
, and FALSE
otherwise.
func
must return either TRUE
or
FALSE
, otherwise a runtime error is raised.testOne(dom x, function func <, any
expr...>)
func
onto the components
of the tuple x
, with the additional function parameters
expr...
passed to func
, if given.
It returns TRUE
if one of these function calls returned
TRUE
, and FALSE
otherwise.
func
must return either TRUE
or
FALSE
, otherwise a runtime error is raised.zip(dom x, y, function func <, any
expr...>)
x
and y
component-wise, where the function call func(a, b <,
expr...>)
is executed for each pair (xi, yi) of
tuple components xi of x
and yi of
y
.
See the system function zip
for details.
The function values will not be implicitly converted
into elements of the domain Set
. One has to take care that
the function calls return elements of the domain Set
.
zip
for
n-tuples, i.e., one may use it in the form zip(x, y,
func, ...)
.zipCanFail(dom x, y, function func <, any
expr...>)
"zip"
but returns
FAIL
if one of the function calls return
FAIL
.convert(list List)
List
into an element of the domain
Dom::Product
(Set, n)
. This can be done if
List
is a list of n
elements where each
element can be converted into an element of the domain
Set
.FAIL
is returned if this conversion fails.convert(any e1 <, any e2...>)
Dom::Product
(Set, n)
. This can be done if
exactly n
arguments are given where each argument can be
converted into an element of the domain Set
.FAIL
is returned if this conversion fails.expr(dom x)
"expr"
of Set
to each element of x
and returns a list of the converted
elements, i.e., an object of type DOM_LIST
.expr
for
n-tuples, i.e., one may use it in the form
expr(x)
.Define the 3-fold direct product of the rational numbers:
>> P3 := Dom::Product(Dom::Rational, 3)
Dom::Product(Dom::Rational, 3)
and create elements:
>> a := P3([1, 2/3, 0])
[1, 2/3, 0]
>> b := P3(2/3, 4, 1/2)
[2/3, 4, 1/2]
We use the standard arithmetical operators to calculate with such tuples:
>> a + b, a*b, 2*a
[5/3, 14/3, 1/2], [2/3, 8/3, 0], [2, 4/3, 0]
Some system functions were overloaded for such elements,
such as diff
, map
or zip
(see the description of the
corresponding methods "diff"
, "map"
and
"zip"
above).
For example, to divide each component of a
by 2 we
enter:
>> map(a, `/`, 2)
[1/2, 1/3, 0]
The quoted character `/`
is another
notation for the function _divide
, the functional form of
the division operator /
.
Be careful that the mapping function returns elements of the domain
the product is defined over. This is not checked by the function
map
(for efficiency reasons) and may lead to ``invalid''
tuples. For example:
>> b := map(a, sin); domtype(b)
[sin(1), sin(2/3), 0] Dom::Product(Dom::Rational, 3)
But the components of b
are no longer
rational numbers!
coeffRing
.