Append - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

ArrayTools

 Append
 append element to Array

 Calling Sequence Append(A,expr,opts)

Parameters

 A - : Array or Vector expr - : expression to append opts - : (optional) inplace=true or inplace=false

Options

 • inplace = true or false
 Specifies whether the append operation should reuse the existing Array or generate a new Array. The default value is true.

Description

 • The Append(A,expr) command appends the expression expr to the end of the Vector or the 1-D Array, A.
 • When inplace=false is specified, the append operation allocates a new Array and does not modify the existing one.
 • Otherwise, the existing object is modified, and, if necessary, resized. The resizing will be performed in such a way that it takes only constant time and space on average. This is achieved by reserving extra space whenever the Array/Vector needs to be grown, and then using this space for subsequent expansions without the need to reallocate memory. Maple always grows the space for the Array/Vector by at least a fixed percentage, which ensures the average constant time and space usage.
 • This function is part of the ArrayTools package, so it can be used in the short form Append(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[Append](..).

Examples

 > $\mathrm{with}\left(\mathrm{ArrayTools}\right):$
 > $A≔\mathrm{Array}\left(\left[2,3,5\right]\right)$
 ${A}{≔}\left[\begin{array}{ccc}{2}& {3}& {5}\end{array}\right]$ (1)
 > $\mathrm{Append}\left(A,\frac{1}{x}\right)$
 $\left[\begin{array}{cccc}{2}& {3}& {5}& \frac{{1}}{{x}}\end{array}\right]$ (2)
 > $\mathrm{Append}\left(A,\mathrm{sin}\left(x\right)\right)$
 $\left[\begin{array}{ccccc}{2}& {3}& {5}& \frac{{1}}{{x}}& {\mathrm{sin}}{}\left({x}\right)\end{array}\right]$ (3)
 > $v≔⟨1,2x⟩$
 ${v}{≔}\left[\begin{array}{c}{1}\\ {2}{}{x}\end{array}\right]$ (4)
 > $\mathrm{Append}\left(v,3{x}^{2},\mathrm{inplace}=\mathrm{false}\right)$
 $\left[\begin{array}{c}{1}\\ {2}{}{x}\\ {3}{}{{x}}^{{2}}\end{array}\right]$ (5)
 > $v$
 $\left[\begin{array}{c}{1}\\ {2}{}{x}\end{array}\right]$ (6)

Compatibility

 • The ArrayTools[Append] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.

 See Also