MathGroup Archive 2008

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

Search the Archive

How to fix the position of maximal or minimal element(s) in one List.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92117] How to fix the position of maximal or minimal element(s) in one List.
  • From: Aya <sh_liuhuashan at 163.com>
  • Date: Sat, 20 Sep 2008 05:00:52 -0400 (EDT)

Hi friends:

    To fix the position of maximal or minimal element(s) in one List,
I code as follows:

------------------------------
    MaxElementPosition[ list_?ListQ ] := Position[ list, Max[list]]
[[1,1]];

    MinElementPosition[ list_?ListQ ] := Position[ list, Min[list]]
[[1,1]];

e.g.

    lst = {3, 2, 4,2,1}
   MaxElementPosition[lst] ----------> 3
   MinElementPosition[lst]  -----------> 5
------------------------------
would you show me more efficient mathelets to update them.

Thanks~~~


  • Prev by Date: Re: Variable names in Mathematica
  • Next by Date: Re: the graphic of a function
  • Previous by thread: RE: How to show polynomial with leading order at the left of the line?
  • Next by thread: How to consider two fitting methods when using Findfit in Mathematica