Find the largest element in a list and its position? - Online ...
community.wolfram.com › groups › -findLargest1[list_List] := Module[ {max, poss}, (* Find largest element in list *) {max} = TakeLargest[list, 1]; (* Find all positions of largest element in list *) poss = Flatten[Position[list, max]]; (* Return *) {max, poss} ] absTime = AbsoluteTime[]; {max, poss} = findLargest1[list]; absTime = AbsoluteTime[] - absTime; show[absTime, max, poss, findLargest1, "TakeLargest & Position", list]; findLargest1 (TakeLargest & Position): 0.923 sek.
Position—Wolfram Language Documentation
reference.wolfram.com › language › refPosition returns a list of positions in a form suitable for use in Extract, ReplacePart, and MapAt. The form is different from the one used in Part. Position looks only for matches to values in Association objects that appear in expr. It returns any part specifications within Association objects in the form Key [ k].
Position—Wolfram Language Documentation
https://reference.wolfram.com/language/ref/Position.htmlPosition[expr, pattern] gives a list of the positions at which objects matching pattern appear in expr. Position[expr, pattern, levelspec] finds only objects that appear on levels specified by levelspec. Position[expr, pattern, levelspec, n] gives the positions of the first n objects found. Position[pattern] represents an operator form of Position that can be applied to an expression.
sorting - How to find the location of the highest element in ...
stackoverflow.com › questions › 25829680Sep 14, 2014 · For example, here is a random list of lists of of lists of reals: data = Table [RandomReal [], {i, 1, RandomInteger [ {4, 8}]}, {j, 1, RandomInteger [ {4, 8}]}, {k, 1, RandomInteger [ {4, 8}]} ]; You can just do: m = Max [data] Position [data, m] This will tell you the position of the maximum value.
Finding the position in a list where the maximum or minimum ...
mathematica.stackexchange.com › questions › 45645Will give positions of minimum and maximum, respectively. Computation times order[n_] := Block[{}, list = RandomReal[1, n]; t1 = (Position[list, Min@list]; // RepeatedTiming // First); t2 = (Ordering[list, 1]; // RepeatedTiming // First); {{n, t1}, {n, t2}}] tab = ParallelTable[order[Floor[1.1^n]], {n, 1, 100, 1}]; ListLogLogPlot[{tab[[All, 1]], tab[[All, 2]]}]