这个纯函数的#1,#2咋理解,mathematica软件distances = SparseArray[{{1, 2} -> 5, {2, 1} -> 5, {1, 3} -> 2, {3, 1} -> 2, {3, 2} -> 2, {2, 3} -> 2, {2, 4} -> 4, {4, 2} -> 4, {3, 4} -> 5, {4, 3} -> 5, {4, 1} -> 6, {1, 4} -> 6, {4, 5} -> 8, {5, 4} -> 8, {1, 5} -> 1, {5, 1} -> 1}, {5, 5}, Infinity];{length, tour} = FindShortestTour[Range[5], DistanceFunction -> (distances[[#1, #2]] &)]#1,#2咋理解,纯函数的操作对象是什么?
问题描述:
这个纯函数的#1,#2咋理解,mathematica软件
distances =
SparseArray[{{1, 2} -> 5, {2, 1} -> 5, {1, 3} -> 2, {3, 1} ->
2, {3, 2} -> 2,
{2, 3} -> 2, {2, 4} -> 4, {4, 2} -> 4, {3, 4} -> 5, {4, 3} ->
5, {4, 1} -> 6, {1, 4} -> 6, {4, 5} -> 8, {5, 4} -> 8, {1, 5} ->
1, {5, 1} -> 1}, {5, 5}, Infinity];
{length, tour} =
FindShortestTour[Range[5],
DistanceFunction -> (distances[[#1, #2]] &)]
#1,#2咋理解,纯函数的操作对象是什么?
答