+ - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

MultiSet/+

MultiSet + operator

 Calling Sequence M + N M + N + P + ...

Parameters

 M, N, P, ... - MultiSet; MultiSets, sets, or lists

Description

 • M + N returns the MultiSet which is the sum of M and N, accounting for multiplicities.  For example, if a has multiplicity 2 in M and 3 in N then it will have multiplicity 5 in M + N.
 • The M + N + P ... command performs the n-ary sum of the arguments
 • At least one argument must be a MultiSet for this routine to be invoked.  Any other argument which is expected to be a MultiSet can be a MultiSet, a set or a list; in the latter two cases the argument is converted to a MultiSet before proceeding to evaluate this command.  IsGeneralized(M) must return the same value for all MultiSet arguments M, and all non-MultiSet arguments will be promoted to MultiSets with this same property.

Examples

 > $M≔\mathrm{MultiSet}\left(a=2,b=5,c=4\right)$
 ${M}{≔}\left\{\left[{a}{,}{2}\right]{,}\left[{b}{,}{5}\right]{,}\left[{c}{,}{4}\right]\right\}$ (1)
 > $N≔\mathrm{MultiSet}\left(a=4,c=3,d=7\right)$
 ${N}{≔}\left\{\left[{a}{,}{4}\right]{,}\left[{c}{,}{3}\right]{,}\left[{d}{,}{7}\right]\right\}$ (2)
 > $M+N$
 $\left\{\left[{a}{,}{6}\right]{,}\left[{b}{,}{5}\right]{,}\left[{c}{,}{7}\right]{,}\left[{d}{,}{7}\right]\right\}$ (3)
 > $M+N+\left[b,c,c,e\right]$
 $\left\{\left[{a}{,}{6}\right]{,}\left[{b}{,}{6}\right]{,}\left[{c}{,}{9}\right]{,}\left[{d}{,}{7}\right]{,}\left[{e}{,}{1}\right]\right\}$ (4)

Increment the multiplicity of every element by 1:

 > $M+\mathrm{convert}\left(M,\mathrm{set}\right)$
 $\left\{\left[{a}{,}{3}\right]{,}\left[{b}{,}{6}\right]{,}\left[{c}{,}{5}\right]\right\}$ (5)

Compatibility

 • The MultiSet/+ operator was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.