# FreeAbelianMonoidCategory(S, E)¶

A free abelian monoid on a set S is the monoid of finite sums of the form reduce(+, [ni * si]) where the si's are in S, and the ni's are in a given abelian monoid. The operation is commutative.

0: %
from AbelianMonoid
*: (E, S) -> %
e * s returns e times s.
*: (NonNegativeInteger, %) -> %
from AbelianMonoid
*: (PositiveInteger, %) -> %
from AbelianSemiGroup
+: (%, %) -> %
from AbelianSemiGroup
+: (S, %) -> %
s + x returns the sum of s and x.
=: (%, %) -> Boolean
from BasicType
~=: (%, %) -> Boolean
from BasicType
coefficient: (S, %) -> E
coefficient(s, e1 a1 + ... + en an) returns ei such that ai = s, or 0 if s is not one of the ai's.
coerce: % -> OutputForm
from CoercibleTo OutputForm
coerce: S -> %
from RetractableTo S
hash: % -> SingleInteger
from SetCategory
hashUpdate!: (HashState, %) -> HashState
from SetCategory
highCommonTerms: (%, %) -> % if E has OrderedAbelianMonoid
highCommonTerms(e1 a1 + ... + en an, f1 b1 + ... + fm bm) returns reduce(+, [max(ei, fi) ci]) where ci ranges in the intersection of {a1, ..., an} and {b1, ..., bm}.
latex: % -> String
from SetCategory
mapCoef: (E -> E, %) -> %
mapCoef(f, e1 a1 +...+ en an) returns f(e1) a1 +...+ f(en) an.
mapGen: (S -> S, %) -> %
mapGen(f, e1 a1 +...+ en an) returns e1 f(a1) +...+ en f(an).
nthCoef: (%, Integer) -> E
nthCoef(x, n) returns the coefficient of the n^th term of x.
nthFactor: (%, Integer) -> S
nthFactor(x, n) returns the factor of the n^th term of x.
opposite?: (%, %) -> Boolean
from AbelianMonoid
retract: % -> S
from RetractableTo S
retractIfCan: % -> Union(S, failed)
from RetractableTo S
sample: %
from AbelianMonoid
size: % -> NonNegativeInteger
size(x) returns the number of terms in x. mapGen(f, a1\^e1 … an\^en) returns f(a1)\^e1 ... f(an)\^en.
subtractIfCan: (%, %) -> Union(%, failed)
from CancellationAbelianMonoid
terms: % -> List Record(gen: S, exp: E)
terms(e1 a1 + ... + en an) returns [[a1, e1], ..., [an, en]].
zero?: % -> Boolean
from AbelianMonoid

AbelianMonoid

AbelianSemiGroup

BasicType

CancellationAbelianMonoid

SetCategory