Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to find the index of a maximal element in a list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72962] Re: [mg72911] How to find the index of a maximal element in a list?
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 26 Jan 2007 07:34:40 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Last[Ordering[listName]]


Bob Hanlon

---- Valter Sorana <vsorana at yahoo.com> wrote: 
> I may have a mental block, but I cannot find anything better than
> 
> Position[listName,Max[listName]]
> 
> that traverses the list twice - once to find the maximum and once to find where it is.
> 
> Isn't there a way to get both the index and the max value in one go?
> 
> (of course one could write a loop that does this, but I want to avoid loops)
> 
> Thanks,
> 
> Valter.
> 


  • Prev by Date: eps exports with dashes in them (important - to me, anyway)
  • Next by Date: Re: when draw the piechart,how to write the label outside
  • Previous by thread: Re: Re: How to find the index of a maximal element in a list?
  • Next by thread: Re: How to find the index of a maximal element in a list?