mapSlices#
Generate a matrix one dimension less than A by applying callback to each slice of A along dimension dim.
Available in: math cells, REPL.
Syntax#
mapSlices(A, dim, callback)
Arguments and behavior#
Dimension is one-based. Pass a supported callback such as sum. The app prod function is symbolic and cannot reduce a numeric slice.
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
Example
mapSlices([[1,2],[3,4]],1,sum)Interactive examples could not load. You can still copy the expressions.
Expected result: matrix.