Insert - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


SignalProcessing

  

Insert

  

insert 1-D rtable into another 1-D rtable

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Insert( A, k, B, options )

Parameters

A, B

-

1-D rtables or lists with entries of type complexcons

k

-

integer; specifies the index of A where B is to be inserted

inplace

-

(optional) Either true or false, specifies if the insertion of B into A at k is to be performed in-place.

Description

• 

The Insert command inserts 1-D rtable or list B into 1-D rtable or list A at index k, and returns the combined container.

• 

When A is an rtable, the rtable order and subtype of the output are the same as for A. When A is a list, on the other hand, the output is an Array having Fortran order.

• 

Any passed rtables must have no indexing function, and use rectangular storage.

• 

Suppose m=numelems⁡A, n=numelems⁡B, and A has dimensions α..β. The result of Insert⁡A&comma;k&comma;B contains m+n elements, with B inserted to the left of element Ak. When A is an Array with initial index different than 1, the insertion index k must satisfy α≤k and k≤β+1. When A is a Vector or an Array with initial index 1, on the other hand, the insertion index must satisfy k≠0 and k≤m+1, with k<0 corresponding to element m+1−k.

• 

The extreme case k=α corresponds to inserting B before A, and k=β+1 corresponds to inserting B after A.

• 

Internally, A and B will both be converted to float[8] Vectors, if possible. If this is not possible, they will both be converted to complex[8] Vectors, if possible. For this reason, it is more efficient for the passed containers A and B to both be 1-D rtables of the same double precision hardware float datatype (float[8] or complex[8]).

• 

Suppose inplace=true. The container A must have either float[8] or complex[8] datatype, and the container B must be coercible to the same datatype. Moreover, if B is an alias of A, or A and B are both aliases of the same rtable, then a copy of B is created in order to avoid complications during insertion.

• 

The Insert command is not thread safe.

Examples

> 

with⁡SignalProcessing&colon;

Example 1

> 

A≔Vectorrow⁡1&comma;2&comma;3&comma;4&comma;5

A≔12345

(1)
> 

B≔Vectorrow⁡6&comma;7

B≔67

(2)
> 

U≔Insert⁡A&comma;1&comma;B

U≔6.7.1.2.3.4.5.

(3)
> 

V≔Insert⁡A&comma;4&comma;B

V≔1.2.3.6.7.4.5.

(4)
> 

W≔Insert⁡A&comma;6&comma;B

W≔1.2.3.4.5.6.7.

(5)

Example 2

> 

P≔Vectorcolumn⁡0.803716108032327&comma;−0.356056399933928&comma;0.933528218742667&comma;0.0114341122580131&comma;0.554152583724131&comma;datatype=float8

P≔0.803716108032327−0.3560563999339280.9335282187426670.01143411225801310.554152583724131

(6)
> 

Q≔Vectorrow⁡−0.0882886912893828&comma;0.561179894580472&comma;0.588474727401137&comma;0.926146043843513&comma;0.821206761885317&comma;datatype=float8

Q≔−0.08828869128938280.5611798945804720.5884747274011370.9261460438435130.821206761885317

(7)
> 

Insert⁡P&comma;2&comma;Q&comma;inplace&colon;

> 

P=P

P=0.803716108032327−0.08828869128938280.5611798945804720.5884747274011370.9261460438435130.821206761885317−0.3560563999339280.9335282187426670.01143411225801310.554152583724131

(8)

Example 3

> 

G≔1&comma;2−3⁢I&comma;5+6⁢I

G≔1&comma;2−3⁢I&comma;5+6⁢I

(9)
> 

H≔4

H≔4

(10)
> 

Insert⁡G&comma;3&comma;H

1.+0.⁢I2.−3.⁢I4.+0.⁢I5.+6.⁢I

(11)

Example 4

> 

n≔210&colon;

> 

X≔GenerateSignal⁡sin⁡4⁢t+5&comma;t=0..2⁢π&comma;n&comma;includefinishtime=false&colon;

> 

Y≔GenerateSignal⁡110⁢sin⁡40⁢t+5&comma;t=0..2⁢π&comma;n&comma;includefinishtime=false&colon;

> 

Z≔Insert⁡X&comma;floor⁡n2+1&comma;Y&colon;

> 

SignalPlot⁡Z&comma;view=DEFAULT&comma;0..10&comma;color=blue

Example 5

> 

m≔105

m≔100000

(12)
> 

n≔floor⁡23⁢m

n≔66666

(13)
> 

A≔LinearAlgebra:-RandomVector⁡m&comma;generator=−5.0..5.0&comma;datatype=complex8

A≔−0.0917383737863284+2.13912325874864⁢I−3.39854682246889+3.49786418049004⁢I−2.59564823185160−1.78383585689513⁢I3.24486104632469+0.895908298152884⁢I−0.362935391020486+2.31720737051418⁢I−2.09070685601688+0.815907533479054⁢I−0.693638170304207+0.315918805455907⁢I4.57091864654335+2.61722374093498⁢I−3.68294960599541+3.20691408998534⁢I−1.22788436311340−2.39044573657899⁢I⋮100000 element Vector[column]

(14)
> 

B≔LinearAlgebra:-RandomVector⁡n&comma;generator=−5.0..5.0&comma;datatype=complex8

B≔−4.14267742232442−3.51051319815677⁢I−0.476582854156399+3.13480576149592⁢I3.93630307721684+3.71363640103653⁢I1.78944820932699−1.58190977422684⁢I0.801823487528903+2.04706019479377⁢I1.81849787205073−2.31204470134407⁢I−3.08889695735301+3.45093746504436⁢I1.96874658944417−3.49513013073011⁢I0.920907021678026+2.13975559787115⁢I−3.10131345103975−4.42719506129223⁢I⋮66666 element Vector[column]

(15)
> 

CodeTools:-Usage⁡Insert⁡A&comma;floor⁡n2&comma;B

memory used=2.57MiB, alloc change=2.55MiB, cpu time=2.00ms, real time=2.00ms, gc time=0ns

−0.0917383737863284+2.13912325874864⁢I−3.39854682246889+3.49786418049004⁢I−2.59564823185160−1.78383585689513⁢I3.24486104632469+0.895908298152884⁢I−0.362935391020486+2.31720737051418⁢I−2.09070685601688+0.815907533479054⁢I−0.693638170304207+0.315918805455907⁢I4.57091864654335+2.61722374093498⁢I−3.68294960599541+3.20691408998534⁢I−1.22788436311340−2.39044573657899⁢I⋮166666 element Vector[column]

(16)

Compatibility

• 

The SignalProcessing[Insert] command was introduced in Maple 2022.

• 

For more information on Maple 2022 changes, see Updates in Maple 2022.

See Also

ArrayTools[Copy]

ArrayTools[Extend]

ArrayTools[Insert]

SignalProcessing