map#
Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.
Available in: math cells, REPL.
Syntax#
map(x, callback)
map(x, y, ..., callback)
Arguments and behavior#
Pass an array/matrix and a named callback such as f(x)=x^2. The callback can also accept index and source arguments.
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
Example
f(x) = x^2
map([1,2,3],f)Interactive examples could not load. You can still copy the expressions.
Expected result: matrix.