MAP _ _ _ _ _ _ _ _ _ _ _ _ operator
The map operator applies a uniform evaluation pattern to all members of a composite structure: a matrix, a list or the arguments of an operator expression. The evaluation pattern can be a unary procedure, an operator, or an algebraic expression with one free variable.
map(<function>,<object>)
<object> is a list, a matrix or an operator expression.
<function> is the name of an operator for a single argument: the operator is evaluated once with each element of <object> as its single argument,
or an algebraic expression with exactly one free variable, that is a variable preceded by the tilde symbol: the expression is evaluated for each element of <object> where the element is substituted for the free variable,
or a replacement rule of the form
var=> rep
where <var> is a variable (a <kernel> without subscript) and <rep> is an expression which contains <var>. Here rep is evaluated for each element of <object> where the element is substituted for var. var may be optionally preceded by a tilde.
The rule form for <function> is needed when more than one free variable occurs.
map(abs,{1,-2,a,-a}); 1,2,abs(a),abs(a) map(int(~w,x), mat((x^2,x^5),(x^4,x^5))); [ 3 6 ] [ x x ] [---- ----] [ 3 6 ] [ ] [ 5 6 ] [ x x ] [---- ----] [ 5 6 ] map(~w*6, x^2/3 = y^3/2 -1); 2 3 2*x =3*(y -2)
You can use map in nested expressions. It is not allowed to apply map for a non-composed object, e.g. an identifier or a number.