convert tables, lists, sets or algebraic expressions to MultiSets
convert( t, MultiSet )
convert( t, MultiSet, g_opt )
convert( M, r )
object or expression to convert
identical(generalized)=truefalse; whether to return a generalized MultiSet
MultiSet; MultiSet to be converted to something else
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
t ≔ convert⁡M,table
td ≔ 3
The convert/MultiSet command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
Download Help Document