MultiSet/Insert
insert an element into a MultiSet
Calling Sequence
Parameters
Description
Examples
Compatibility
Insert( M, x, n )
Insert( M, x=n )
Insert( M, [x, n] )
Insert( M, x )
M
-
MultiSet; a MultiSet
x
anything, an expression
n
nonnegint, number of copies of x to insert into M
Each of the first three calling sequences, Insert( M, x, n ), Insert( M, x=n ), and Insert( M, [x, n] ), increments the multiplicity of x in the MultiSet M by n.
The fourth calling sequence, Insert( M, x ) is equivalent to Insert( M, x, 1 ).
The new multiplicity of x in M is returned.
To set the multiplicity of an element to a specific value, use the selection operator. For example, to set the multiplicity of x to 3, use M[x] := 3.
M≔MultiSet⁡a=2,b=5
M≔a,2,b,5
Insert⁡M,b,3
8
Insert⁡M,c
1
a,2,b,8,c,1
The MultiSet/Insert command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
MultiSet
MultiSet Selection
MultiSet/Entries
MultiSet/Remove
Download Help Document