Re: Greatest element in list

• To: mathgroup at smc.vnet.net
• Subject: [mg30505] Re: Greatest element in list
• From: "Souvik Banerjee" <s-banerjee at nwu.edu>
• Date: Fri, 24 Aug 2001 04:06:04 -0400 (EDT)
• Organization: Northwestern University, Evanston, IL, US
• References: <9m27in\$gqd\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Not sure if best way but

PosMax[l_List] := Flatten[Position[l, Max[l]]]

seems to be working. For example:

In[10]:= PosMax[{1, 4, 6, 2, 5, 3, 5, 6}]

Out[10]= {3, 8}

Also, can you give an example where Max[.]  returns an empty set?

BTW, the pure function construct which you posted will not work since it
will apply Max[] and Position[] to each individual element of the list.

-Souvik

Oliver Friedrich <oliver.friedrich at tz-mikroelektronik.de> wrote in message
news:9m27in\$gqd\$1 at smc.vnet.net...
> Hi,
>
> what's the best way to get the position of the greatest number in list of
> reals? I've tried
>
> Position[#,Max[#]]&list
>
> but surprisingly, it doesn't work all the time, sometimes it returns an
> empty list. How is that, because a theorem says that a non empty set of
real
> numbers must have at least one biggest element. So Max[#] can't be empty.
>
> Any solutions ?
>
> Oliver Friedrich
>
>

```

• Prev by Date: RE: Greatest element in list
• Next by Date: Re: Greatest element in list
• Previous by thread: RE: Greatest element in list
• Next by thread: Re: Greatest element in list