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?
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. $\endgroup$