# Apply a function to the internal sparse format of a polynomial: map

### 5.27.3 Apply a function to the internal sparse format of a polynomial: map

The map command can apply a function to the coefficients of a polynomial written in internal sparse format. (See Section 5.40.29 for other uses of map.)

- map takes two arguments:
  - P, a polynomial of k variables in internal sparse format.
  - f, a function of k+1 variables.
- map(P,f) applies f to the coefficients of P; namely, it returns a polynomial which replaces each term %%%{a,[n1,…, nk] %%%} in P by %%%{f(a,n1,…,nk),[n1,…, nk] %%%}

#### Example.

Input:

map(%%%{2,[2,1]%%%} + %%%{3,[1,4]%%%},(a,b,c)->a*b*c)

Output:

%%%{4,[2,1]%%%}+%%%{12,[1,4]%%%}