 convert/multiset - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Conversion : convert/multiset

convert/multiset

convert to a multiset

 Calling Sequence convert( f, multiset )

Parameters

 f - table, list, or algebraic expression

Description

 • This utility function converts f to a multiset. A multiset is represented in the form $[[{e}_{1},{m}_{1}],...,[{e}_{n},{m}_{n}]]$; it is a list of pairs where each ${e}_{i}$ is a value (an expression), and ${m}_{i}$ is its multiplicity (an integer).
 • If f is a table, each index is interpreted as a value and the associated entry (which should be an integer) is interpreted as its multiplicity.
 • If f is an algebraic expression, each factor is interpreted as a value, and the exponent to which this factor is raised (which should be an integer) is interpreted as its multiplicity.
 • If f is a list, the number of instances of each entry in the list is interpreted as its multiplicity.
 • Note: The output from this command is a list-of-lists structure, which is not the same as the MultiSet object introduced in Maple 2016.

Examples

 > $t≔\mathrm{table}\left(\left[x=1,y=3,z=2\right]\right):$
 > $\mathrm{convert}\left(t,\mathrm{multiset}\right)$
 $\left[\left[{z}{,}{2}\right]{,}\left[{y}{,}{3}\right]{,}\left[{x}{,}{1}\right]\right]$ (1)
 > $\mathrm{convert}\left(\frac{x{y}^{3}}{{z}^{2}},\mathrm{multiset}\right)$
 $\left[\left[{x}{,}{1}\right]{,}\left[{y}{,}{3}\right]{,}\left[{z}{,}{-2}\right]\right]$ (2)
 > $\mathrm{convert}\left(\left[x,y,z,y,z,y\right],\mathrm{multiset}\right)$
 $\left[\left[{z}{,}{2}\right]{,}\left[{y}{,}{3}\right]{,}\left[{x}{,}{1}\right]\right]$ (3)