Creating a matrix in Mathematica with Pure Functions -
i know how create one-dimensional array in mathematica using pure functions , mapping on range. syntax follows:
# & /@ range[1,3]
this returns:
{1, 2, 3}
i know how create two-dimensional array similar syntax. two- dimensional array returned be:
{ {{1, 1}, {1, 2}, {1, 3}}, {{2, 1}, {2, 2}, {2, 3}}, {{3, 1}, {3, 2}, {3, 3}} }
the syntax had hoped work is:
{#1, #2} & @@ {range[1,3] , range[1,3]}
(or similar), instead returns:
{ {1, 2, 3}, {1, 2, 3} }
you can use table[] function create matrix of ordered pairs, pure function syntax seems more dynamic, perhaps.
Comments
Post a Comment