Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wolfram mathematica n';Mathematica中多维列表中的第个最大数_Wolfram Mathematica - Fatal编程技术网

Wolfram mathematica n';Mathematica中多维列表中的第个最大数

Wolfram mathematica n';Mathematica中多维列表中的第个最大数,wolfram-mathematica,Wolfram Mathematica,假设我在Mathematica中有一个2D数字列表: myList = Table[{i,i*j},{i,1,10},{j,1,10}]; 我想以一种有效的方式检索第五高的值。使用RankedMax会产生错误。比如说, Max[myList] 给出100,但: RankedMax[myList,1] 给出: RankedMax::vec : "Input {{{1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, \ {1, 7}, {1, 8

假设我在Mathematica中有一个2D数字列表:

myList = Table[{i,i*j},{i,1,10},{j,1,10}];
我想以一种有效的方式检索第五高的值。使用RankedMax会产生错误。比如说,

Max[myList]
给出100,但:

RankedMax[myList,1]
给出:

 RankedMax::vec :  "Input {{{1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, \

{1, 7}, {1, 8}, {1, 9}, {1, 10}}, {{2, 2}, {2, 4}, {2, 6}, {2, 8}, {2, 10}, \

{2, 12}, {2, 14}, {2, 16}, {2, 18}, {2, 20}}, 6, {{9, 9}, {9, 18}, {9, 27}, \

{9, 36}, {9, 45}, {9, 54}, {9, 63}, {9, 72}, {9, 81}, {9, 90}}, {{10, 10}, \

{10, 20}, {10, 30}, {10, 40}, {10, 50}, {10, 60}, {10, 70}, {10, 80}, {10, \

90}, {10, 100}}} is not a vector
如何在我的数据上使用RankedMax,或者有其他方法吗?

使用扁平化

RankedMax[Flatten@myList,1]
使用扁平化

RankedMax[Flatten@myList,1]

如果他只是在寻找表中第五大的数字,这是很好的。如果,正如我所怀疑的,他正在寻找计算项中的第五大项——每对中的第二个元素——我们应该稍微修改前面的解决方案,如下所示:

RankedMax[Flatten@Map[Rest, myList, {2}], 5]

如果他只是在寻找表中第五大的数字,这是很好的。如果,正如我所怀疑的,他正在寻找计算项中的第五大项——每对中的第二个元素——我们应该稍微修改前面的解决方案,如下所示:

RankedMax[Flatten@Map[Rest, myList, {2}], 5]