MathGroup Archive 1992

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

Search the Archive

Position of Max

  • To: mathgroup at
  • Subject: Position of Max
  • From: Athanasios Orphanides <fed!m1axo99 at>
  • 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 

Athanasios Orphanides

  • Prev by Date: Reading data from file
  • Next by Date: polygon problem in 3D
  • Previous by thread: Reading data from file
  • Next by thread: Position of Max