MTM - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Connectivity : MTM Package : MTM/Zip

MTM

 Zip
 Apply a function to matched elements in two arrays

 Calling Sequence Zip(fn,M1,M2)

Parameters

 M1 - Array M2 - Array fn - procedure outputoptions - equation of the form outputoptions = list

Description

 • The Zip(fn,M1,M2) command applies the bivariate function f to the paired entries of the Arrays, arrays, or scalars M1 and M2.
 • M1 and M2 must be the same size, or scalars.  If M1 is an array and M2 is a scalar, the result will be an array the same size as M1 with the scalar M2 used as the second argument to fn at each entry.
 • outputoptions specify additional attributes of the result Array, like datatype.  These arguments are ignored for table-based arrays.

Examples

 > $\mathrm{with}\left(\mathrm{MTM}\right):$
 > $\mathrm{M1}≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right):$
 > $\mathrm{M2}≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,5\right]\right]\right):$
 > $\mathrm{Zip}\left(\left(a,b\right)→a+b,\mathrm{M1},\mathrm{M2}\right)$
 $\left[\begin{array}{rr}{2}& {4}\\ {6}& {9}\end{array}\right]$ (1)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam