MultiSet/Insert - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

MultiSet/Insert

insert an element into a MultiSet

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Insert( M, x, n )

Insert( M, x=n )

Insert( M, [x, n] )

Insert( M, x )

Parameters

M

-

MultiSet; a MultiSet

x

-

anything, an expression

n

-

nonnegint, number of copies of x to insert into M

Description

• 

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.

Examples

MMultiSeta=2,b=5

Ma,2,b,5

(1)

InsertM,b,3

8

(2)

InsertM,c

1

(3)

M

a,2,b,8,c,1

(4)

Compatibility

• 

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