 ArrayTools - Maple Programming Help

Home : Support : Online Help : Programming : Low-level Manipulation : Matrices, Vectors, and Arrays : ArrayTools : ArrayTools/Element

ArrayTools

 ElementDivide
 element-wise division of Array entries
 ElementMultiply
 element-wise multiplication of Array entries
 ElementPower
 element-wise power of Array entries

 Calling Sequence ElementMultiply(A,B) ElementDivide(A,B) ElementPower(A,B)

Parameters

 A - scalar, Matrix, Vector, or Array B - scalar, Matrix, Vector, or Array

Description

 • These commands apply operations on individual elements of an Array. If one of A or B are scalars and the other is an Array, the operation is mapped over the Array.  If both A or B are Arrays of the same size, then the operation is applied using zip.
 • These functions are part of the ArrayTools package, so they can be used in the short form ElementMultiply(..), ElementDivide(..), or ElementPower(..) only after executing the command with(ArrayTools).  However, they can always be accessed through the long form of the commands by using ArrayTools[ElementMultiply](..), ArrayTools[ElementDivide](..), or ArrayTools[ElementPower(..), respectively.

Examples

 > $\mathrm{with}\left(\mathrm{ArrayTools}\right):$
 > $\mathrm{ElementPower}\left(\mathrm{Array}\left(\left[a,b,c\right]\right),2\right)$
 $\left[\begin{array}{ccc}{{a}}^{{2}}& {{b}}^{{2}}& {{c}}^{{2}}\end{array}\right]$ (1)
 > $\mathrm{ElementDivide}\left(\mathrm{Array}\left(\left[a,b,c\right]\right),\mathrm{Array}\left(\left[e,f,g\right]\right)\right)$
 $\left[\begin{array}{ccc}\frac{{a}}{{e}}& \frac{{b}}{{f}}& \frac{{c}}{{g}}\end{array}\right]$ (2)
 > $\mathrm{ElementMultiply}\left(3,\mathrm{Array}\left(\left[a,b,c\right]\right)\right)$
 $\left[\begin{array}{ccc}{3}{}{a}& {3}{}{b}& {3}{}{c}\end{array}\right]$ (3)