MTM - Maple Programming Help

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

MTM

 Map
 Apply a function to a list of elements

 Calling Sequence Map(f,M1,...,Mn) Map[k](f,M1,...,Mn)

Parameters

 f - procedure M1,...,Mn - Array, list, set, scalar k - (optional) positive integer

Description

 • The function Map(f,M1,...,Mn) applies the function f to each element of M1, with extra arguments M2,...,Mn.
 • The function Map[k](f,M1,...,Mn) applies the function f to each element of Mk, with extra arguments M1,...,Mk-1,Mk+1,...,Mn.
 • For scalar Mk, the function Map[k](f,M1,...,Mn) is equivalent to f(M1,...,Mn).

Examples

 > $\mathrm{with}\left(\mathrm{MTM}\right):$
 > $M≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right):$
 > $\mathrm{Map}\left(a→{a}^{2},M\right)$
 $\left[\begin{array}{rr}{1}& {4}\\ {9}& {16}\end{array}\right]$ (1)
 > $\mathrm{Map}\left(a→{a}^{2},b+c\right)$
 ${\left({b}{+}{c}\right)}^{{2}}$ (2)
 > $\mathrm{Map}[2]\left(\mathrm{+},a,\left[b,c\right],d\right)$
 $\left[{a}{+}{b}{+}{d}{,}{a}{+}{c}{+}{d}\right]$ (3)