Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

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

Search the Archive

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





  • 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