Cat::ModuleWithBasis – the category of modules with a distinguished basis

Cat::ModuleWithBasis(coeffRing) represents the category of modules with a distinguished basis.

→ Examples

Creating the Category

Cat::ModuleWithBasis(coeffRing)

Parameters:

coeffRing

A domain which must be from the category Cat::Ring.

Categories

Cat::Module(coeffRing)

Details:

Entries

"basisIndices"

the combinatorial class baseClass of the indices of the basis; it must be a Cat::CombinatorialClass.

"zero"

the zero element

term – term constructor

Cat::ModuleWithBasis::term(baseClass lambda)

Returns the basis element math indexed by the element lambda of the combinatorial class baseClass.

monomial – monomial constructor

Cat::ModuleWithBasis::monomial(coeffRing c, baseClass lambda)

Returns the monomial math indexed by the element lambda of baseClass with coefficient c.

fromList – constructor from list

Cat::ModuleWithBasis::fromList(l)

l should be a list of the form math, where math belong to coeffRing and math are elements in baseClass. This list does not need to be sorted in any way, and the maths are not required to be distinct.

Returns the linear combination math described by the list.

This method is very similar to the creation of MuPAD polynomials from a list.

toList – list

Cat::ModuleWithBasis::toList(dom x)

Returns a list describing the structure of x.

This is the inverse function of "fromList".

This method is very similar to the poly2list method for MuPAD polynomials.

nterms – number of terms

Cat::ModuleWithBasis::nterms(dom x)

Returns the number of terms of x.

support – support

Cat::ModuleWithBasis::support(dom x)

Returns the support of math; that is, the list of all maths such that math. It returns a list of elements of baseClass whereas terms (see below) gives a list of elements of dom.

terms – terms

Cat::ModuleWithBasis::terms(dom x)

Returns the list of the terms of math; that is, the list of all maths such that math. It returns a list of elements in dom, whereas support gives a list of elements of baseClass.

monomials – monomials

Cat::ModuleWithBasis::monomials(dom x)

Returns the list of the monomials of math; that is, the list of all math.

coeffs – coefficients

Cat::ModuleWithBasis::coeffs(dom x)

Returns the list of all the non-zero coefficients math of x.

coeff – coefficient(s)

Cat::ModuleWithBasis::coeff(dom x)

Cat::ModuleWithBasis::coeff(dom x, baseClass lambda)

Returns the sequence of all the non-zero coefficients math of x.

Returns the coefficient math of x at the index lambda.

_lessBasis – Term order on basis elements

Cat::ModuleWithBasis::_lessBasis(baseClass lambda1, baseClass lambda2)

Compare the two basis elements lambda1 and lambda2, returning TRUE if math and FALSE otherwise.

This must be compatible with the term order used in "lterm", "poly2list", and so on. The (slow) default implementation guarantees this.

lsupport – support of the leading term

Cat::ModuleWithBasis::lsupport(dom x)

Returns the support of the leading term of x.

If x is zero, then FAIL is returned.

lterm – leading term

Cat::ModuleWithBasis::lterm(dom x)

Returns the leading term of x.

If x is zero, then the zero of the domain is returned. This convention ensures the compatibility with standard MuPAD polynomials.

lmonomial – leading monomial

Cat::ModuleWithBasis::lmonomial(dom x)

Returns the leading monomial of x.

If x is zero, then the zero of the domain is returned. This convention ensures the compatibility with standard MuPAD polynomials.

lcoeff – leading coefficient

Cat::ModuleWithBasis::lcoeff(dom x)

Returns the leading coefficient of x.

If x is zero, then the zero of the coefficient ring is returned.

tsupport – support of the trailing term

Cat::ModuleWithBasis::tsupport(dom x)

Returns the support of the trailing term of x.

If x is zero, then FAIL is returned.

tterm – trailing term

Cat::ModuleWithBasis::tterm(dom x)

Returns the trailing term of x.

If x is zero, then the zero of the domain is returned. This convention ensures the compatibility with standard MuPAD polynomials.

tmonomial – trailing monomial

Cat::ModuleWithBasis::tmonomial(dom x)

Returns the trailing monomial of x.

If x is zero, then the zero of the domain is returned. This convention ensures the compatibility with standard MuPAD polynomials.

tcoeff – trailing coefficient

Cat::ModuleWithBasis::tcoeff(dom x)

Returns the trailing coefficient of x.

If x is zero, then the zero of the coefficient ring is returned.

nthsupport – support of the n-th term

Cat::ModuleWithBasis::nthsupport(dom x, Type::PosInt n)

Returns the support of the n-th term of x.

If n exceeds strictly the number of terms of x, then FAIL is returned.

nthterm – n-th term

Cat::ModuleWithBasis::nthterm(dom x, Type::PosInt n)

Returns the n-th term of x.

If n exceeds strictly the number of terms of x, then FAIL is returned.

nthmonomial – n-th monomial

Cat::ModuleWithBasis::nthmonomial(dom x, Type::PosInt n)

Returns the n-th monomial of x.

If n exceeds strictly the number of terms of x, then FAIL is returned.

nthcoeff – n-th coefficient

Cat::ModuleWithBasis::nthcoeff(dom x, Type::PosInt n)

Returns the n-th coefficient of x.

If n exceeds strictly the number of terms of x, then FAIL is returned.

mapcoeffs – apply a function to all the coefficients

Cat::ModuleWithBasis::mapcoeffs(dom x, function f, <opt1, ...>)

Returns a copy of x in which each coefficient c has been replaced by f(c, opt1, …).

f should always return elements of the coefficient ring. For efficiency reasons, this is not necessarily checked.

multcoeffs – (right) multiplication of all coefficients by a scalar

Cat::ModuleWithBasis::multcoeffs(dom x, coeffRing c)

Returns a copy of x where all the coefficients have been multiplied (from the right) by c.

multcoeffsLeft – left multiplication of all coefficients by a scalar

Cat::ModuleWithBasis::multcoeffsLeft(dom c, coeffRing x)

Returns a copy of x where all the coefficients have been multiplied from the left by c.

If coeffRing is commutative, multcoeffsLeft and multcoeffs coincide.

mapsupport – apply a function on all elements of the support

Cat::ModuleWithBasis::mapsupport(dom x, function f, <opt1, ...>)

Returns a copy of x in which each element c of the support has been replaced by f(c, opt1, …).

f should always return elements in coeffRing. For efficiency reasons, this is not necessarily checked.

content – content

Cat::ModuleWithBasis::content(dom x)

computes the content of x, i.e., the gcd of all its coefficients.

This method only exists if coeffRing is a domain of category Cat::GcdDomain.

moduleMorphism – extension by linearity

Cat::ModuleWithBasis::moduleMorphism(function f, <Options>)

Parameters:

f

A function from the basis of this domain (basisIndices) to some coeffRing-module M.

Options:

ImageSet = M

The module M

Plus = plusM

The function used for additions in M. Defaults to M::plus or _plus.

Zero = zeroM

The zero of M. Defaults to M::zero or 0.

Multcoeffs = multM

The function used for multiplication by scalar. Defaults to M::multcoeffs or multcoeffs.

dom::moduleMorphism returns the module morphism from dom to M obtained by extending f by linearity.

In case dom is not a free module over "basisIndices", it is the user's responsibility to make sure that f is compatible with the module-relations, and does indeed define a proper module morphism.

In case coeffRing is non commutative, beware that multcoeffs multiplies by scalars on the right, whereas the standard pretty printing of module elements suggests that the scalar coefficients are considered as being on the left of the basis elements. This inconsistency will be fixed one way or the other in a later release. In the meantime, you may use Multcoeffs = M::multcoeffsLeft to force the multiplication to be done on the left.

Example 1:

We demonstrate how to define module morphisms on the free module M over the rationals with basis indexed by words. We start by constructing a function which maps a word to the basis element of M indexed by its reverted word:

M := Dom::FreeModule(Dom::Rational, combinat::words):

f := M::term @ revert:

f([a, b, c])

math

Now, we can extend f by linearity to a module morphism from M to M:

g := M::moduleMorphism(f, ImageSet=M):

x := 3*M([a, b, c]) - 2*M([a, e]);

g(x)

math

math

Note that, for a simple endomorphism like this one, we could have achieved the same effect with mapsupport:

M::mapsupport(x, revert)

math

Funny and sometimes interesting results may be achieved by specifying manually the operations to be used for addition and scalar multiplication. Here is an example:

g := M::moduleMorphism(hold(f), ImageSet = Dom::ExpressionField(),

                       Plus = hold(plus), Multcoeffs = hold(s)):

g(x)

math

In particular, this can be used to define a module morphism to a module having a different (but compatible) coefficient ring:

M2 := Dom::FreeModule(Dom::IntegerMod(7), combinat::words):

f  := M2::term@revert:

g  := M::moduleMorphism(f, ImageSet = M2, Multcoeffs=_mult):

g(x)

math