Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Dom::Product

Homogeneous direct products

Syntax

Domain Creation

Dom::Product(Set, <n>)
Dom::ProductSetn(e1, e2, …, en)
Dom::ProductSetn(List)

Description

Dom::Product(Set, n) is an n-fold direct product of the domain 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.

Following to the definition of a direct product many of the methods such as "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.

Superdomain

Dom::BaseDomain

Axioms

If Set has Ax::canonicalRep, then Ax::canonicalRep.

If Set has Cat::AbelianMonoid, then Ax::normalRep.

Examples

Example 1

Define the 3-fold direct product of the rational numbers:

P3 := Dom::Product(Dom::Rational, 3)

and create elements:

a := P3([1, 2/3, 0])

b := P3(2/3, 4, 1/2)

We use the standard arithmetical operators to calculate with such tuples:

a + b, a*b, 2*a

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)

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)

But the components of b are no longer rational numbers!

Parameters

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

e1e2, en, …

Elements of Set or objects convertible into such

List

A list of n elements of Set or objects convertible into such

Entries

"dimen"

is the dimension of Dom::Product(Set, n), which is equal to n.

"coeffRing"

is the domain S.

"one"

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.

"zero"

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.

Methods

expand all

Mathematical Methods

_divide(x, y)

This method only exists if Set is a (multiplicative) group, i.e., a domain of category Cat::Group.

This method overloads the function _divide for n-tuples, i.e., one may use it in the form x / y, or in functional notation: _divide(x, y).

_invert(x)

This method only exists if Set is a (multiplicative) group, i.e., a domain of category Cat::Group.

This method overloads the function _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(x, y)

An implementation is provided only if Set is an ordered set, i.e., a domain of category Cat::OrderedSet.

This method overloads the function _less for n-tuples, i.e., one may use it in the form x < y, or in functional notation: _less(x, y).

_mult(x, y, …)

If 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).

This method only exists if Set is a semigroup, i.e., a domain of category Cat::SemiGroup.

This method also handles more than two arguments. In this case, the argument list is split into two parts of the same length which both are multiplied with the function _mult. These two result are multiplied again with _mult whose result then is returned.

This method overloads the function _mult for n-tuples, i.e., one may use it in the form x * y, or in functional notation: _mult(x, y).

_negate(x)

This method overloads the function _negate for n-tuples, i.e., one may use it in the form -x, or in functional notation: _negate(x).

_power(x, i)

An implementation is provided only if Set is a semigroup, i.e., a domain of category Cat::SemiGroup.

This method overloads the function _power for n-tuples, i.e., one may use it in the form x^i, or in functional notation: _power(x, i).

_plus(x, y, …)

The sum of two n-tuples x and y is defined component-wise as (x1 + y1, …, xn + yn).

This method overloads the function _plus for n-tuples, i.e., one may use it in the form x + y, or in functional notation: _plus(x, y).

D(x)

An implementation is provided only if Set is a partial differential ring, i.e., a domain of category Cat::PartialDifferentialRing.

This method overloads the operator D for n-tuples, i.e., one may use it in the form D(x).

diff(a, x)

This method overloads the function diff for n-tuples, i.e., one may use it in the form diff(a, x).

An implementation is provided only if Set is a partial differential ring, i.e., a domain of category Cat::PartialDifferentialRing.

equal(x, y)

intmult(x, k)

An implementation is provided only if Set is an Abelian semigroup, i.e., a domain of category Cat::AbelianSemiGroup.

iszero(x)

Note that there may be more than one representation of the zero n-tuple if R does not have Ax::canonicalRep.

This method overloads the function iszero for n-tuples, i.e., one may use it in the form iszero(x).

random()

Access Methods

_index(x, i)

See also the method "op".

This method overloads the function _index for n-tuples, i.e., one may use it in the form x[i], or in functional notation: _index(x, i).

map(x, func, <expr, …>)

    Note:   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.

This method overloads the function map for n-tuples, i.e., one may use it in the form map(x, func, ...).

mapCanFail(x, func, <expr, …>)

op(x, i)

op(x)

See also the method "_index".

This method overloads the function op for n-tuples, i.e., one may use it in the form op(x, i).

Returns a sequence of all components of x.

set_index(x, i, e)

See also the method "subsop".

    Note:   This method does not check whether e has the correct type.

This method overloads the indexed assignment _assign for n-tuples, i.e., one may use it in the form x[i] := e, or in functional notation: _assign(x[i], e).

sort(x)

This method overloads function sort for tuples, i.e. one may use it in the form sort(x).

subs(x, …)

    Note:   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.

This method overloads the function subs for n-tuples, i.e., one may use it in the form subs(x, ...). See subs for details and calling sequences.

testEach(x, func, <expr, …>)

func must return either TRUE or FALSE, otherwise a runtime error is raised.

testOne(x, func, <expr, …>)

func must return either TRUE or FALSE, otherwise a runtime error is raised.

zip(x, y, func, <expr, …>)

    Note:   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.

This method overloads the function zip for n-tuples, i.e., one may use it in the form zip(x, y, func, ...).

zipCanFail(x, y, func, <expr, …>)

Conversion Methods

convert(List)

convert(e1, <e2, …>)

FAIL is returned if this conversion fails.

Tries to convert the arguments into an element of the domain 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(x)

This method overloads the function expr for n-tuples, i.e., one may use it in the form expr(x).

Was this topic helpful?