convert/MultiSet
convert tables, lists, sets or algebraic expressions to MultiSets
Calling Sequence
Parameters
Description
Examples
Compatibility
convert( t, MultiSet )
convert( t, MultiSet, g_opt )
convert( M, r )
t
-
object or expression to convert
g_opt
identical(generalized)=truefalse; whether to return a generalized MultiSet
M
MultiSet; MultiSet to be converted to something else
r
name; what to convert M to
convert(t, MultiSet) converts the expression t to a MultiSet, using the following rules:
if t is a MultiSet, then a copy of t is returned.
if t is a set or list, it is converted to a MultiSet by passing t (and the generalized option, if given) to the MultiSet object constructor.
if t is a table whose indices are expression sequences of length 1 and whose entries are positive integers (or any real numbers, if the generalized = true option is given), it is converted to a MultiSet whose elements are the table indices with multiplicities as given by the table entries.
if t is an algebraic expression of type * or ^, where the factor exponents are real numbers, it is converted to a MultiSet whose elements are the factors of the expression, with multiplicities the corresponding factor multiplicities; if the generalized = true option is not given, factors with non-positive-integer exponents will be treated as general algebraic expressions, with multiplicity 1.
if t is any other algebraic expression, the MultiSet constructed by the call MultiSet( [t, 1] ) (or MultiSet[generalized]( [t, 1] )) is returned.
The generalized = true option can be given simply as generalized.
convert( M, list ) converts the MultiSet M to a list; this is equivalent to [op(Entries(M))].
convert( M, set ) converts the MultiSet M to a set; this is equivalent to Members(M).
convert( M, table ) returns a copy of the Maple table which is used to hold the data which defines M; the indices of the returned table are the elements of M, and the entries of the table are the corresponding multiplicities. Note that this table has the sparse indexing function.
M≔convert⁡a,b,a,c,MultiSet
M≔a,2,b,1,c,1
convert⁡M,MultiSet
a,2,b,1,c,1
convert⁡table⁡a=13,b=−2,MultiSet,generalized
a,13,b,−2
convert⁡x2⁢x−33x3−2⁢x2,MultiSet
x,2,1x3−2⁢x2,1,x−3,3
convert⁡x2⁢x−33x3−2⁢x2,MultiSet,generalized
x,2,x−3,3,x3−2⁢x,−2
convert⁡x12⁢1−x−32,MultiSet,generalized
x,12,1−x,−32
convert⁡M,list
c,1,b,1,a,2
convert⁡M,set
a,b,c
t≔convert⁡M,table
t≔table⁡sparse,c=1,b=1,a=2
td≔3
The convert/MultiSet command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
convert/multiset
MultiSet
table
Download Help Document