# Extract the element with maximum value from a nested list

I am struggling with how to extract specific contents of the list out. I am not very good at English, so I'm not sure whether I can tell clearly.

For example, I have the following nested list:

list1= {{10,{5,2}},{11.29,{3,2}},{9.22,{3,2}},
{13.55,{3,1}},{11,{3, 1}},{0.79,{3,1}},{17.57,{5,1}},
{0.57,{5,1}},{15,{5,1}},{18.993,{2,3}},{5.763,{5,3}},
{13.11,{5,3}},{10,{5,3}}}


The maximum value is 18.993. The Max formula returns this.

   Max[list1] = 18.993


But I want Mathematica to extract the following element:

{18.993,{2,3}}


The {1,2} and {2,3} and so on... after the numbers represent positions. For example, in the case of {18.993,{2,3}} the value is 18.993 that occurs at {2,3}.

What should I do?

• Welcome to the Mathematica Stack Exchange. Try: MaximalBy[First][list1]. If you have started learning Mathematica, then you will find that the introductory book written by the inventor is a good learning resource. There is a fast intro for math students as well as a fast intro for programmers to choose from.
– Syed
Apr 14 at 6:28
• Its always a good idea to look at the documentation for "Max" and scrolling down to the bottom. There is always the list of functions similar to or to be used in context with the function Max. Apr 14 at 6:40
MaximalBy[list1, (First[#] &)]

• FWIW, you don't need a full Function, you can just use First: MaximalBy[list1, First]. Also, since MaximalBy returns a list and the OP wanted just a single element, you could do something along the lines of First[MaximalBy[list1, (First[#] &)]]. Apr 14 at 7:07