MultiSet/Remove - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : MultiSet : MultiSet/Remove

MultiSet/Remove

remove a number of occurrences of an element of a MultiSet

 Calling Sequence Remove( M, x, n ) Remove( M, x=n ) Remove( M, [x, n] ) Remove( M, x )

Parameters

 M - MultiSet; a MultiSet x - anything, an expression n - nonnegint, number of copies of x to remove from M

Description

 • Each of the first three calling sequences, Remove( M, x, n ), Remove( M, x=n ), and Remove( M, [x, n ] ), reduces the multiplicity of x in the MultiSet M by n.
 • The fourth calling sequence, Remove( M, x ), removes all occurrences of x from M.
 • The new multiplicity of x in M is returned.

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)
 > $\mathrm{Remove}\left(M,b,3\right)$
 ${2}$ (2)
 > $M$
 $\left\{\left[{a}{,}{2}\right]{,}\left[{b}{,}{2}\right]{,}\left[{c}{,}{4}\right]\right\}$ (3)
 > $\mathrm{Remove}\left(M,b=2\right)$
 ${0}$ (4)
 > $M$
 $\left\{\left[{a}{,}{2}\right]{,}\left[{c}{,}{4}\right]\right\}$ (5)
 > $\mathrm{Remove}\left(M,c\right)$
 ${0}$ (6)
 > $M$
 $\left\{\left[{a}{,}{2}\right]\right\}$ (7)

Compatibility

 • The MultiSet/Remove command was introduced in Maple 2016.