Position of Max
- To: mathgroup at yoda.physics.unc.edu
- Subject: Position of Max
- From: Athanasios Orphanides <fed!m1axo99 at uunet.uu.net>
- Date: Fri, 22 May 92 17:24:48 -0400
I am trying to find the most efficient way to get the maximum element in a list AND its first position in the list. This is done a few thousand times in an iteration program so any saving would be useful. Currently I use Max and Position. For example: x=Table[100 i^2-i^3, {i,2000}] Timing[xm=Max[x]; Position[x,xm][[1,1]]] Is there a way to retrieve the position by just doing Max[] and identifying the index of the result without having to use Position[]? Athanasios Orphanides