ArrayTools
Insert
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Insert(A,pos,expr,opts)
A
-
Array or Vector
pos
position to insert
expr
expression to insert
opts
(optional) inplace=true or inplace=false
inplace = true or false
Specifies whether the insert operation should reuse the existing Array or generate a new Array. The default value is true.
The Insert(A,pos,expr) command inserts the expression expr into the Vector or the 1-D Array A at the position pos.
If there is already a value at position pos, this value and all remaining values are shifted rightwards in the array.
If the position pos is beyond the bounds of the array, then the array's size will be increased and any new elements in between exisiting elements and the inserted entry will be initialized to zero.
When inplace=false is specified, the insert operation allocates a new Array and does not modify the existing one. Otherwise, the existing object is modified.
This function is part of the ArrayTools package, so it can be used in the short form Insert(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[Insert](..).
with⁡ArrayTools:
A≔Array⁡2,3,5
A≔235
Insert⁡A,2,1x
21x35
Insert⁡A,3,sin⁡x
21xsin⁡x35
v≔1,2⁢x
v≔12⁢x
Insert⁡v,2,3⁢x2,inplace=false
13⁢x22⁢x
v
12⁢x
A2≔Array⁡−3..−2,7,8
Insert⁡A2,−3,6
A2−3
6
The ArrayTools[Insert] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
See Also
ArrayTools[Append]
ArrayTools[Extend]
Download Help Document