Re: Greatest element in list
- To: mathgroup at smc.vnet.net
- Subject: [mg30495] Re: [mg30474] Greatest element in list
- From: BobHanlon at aol.com
- Date: Fri, 24 Aug 2001 04:05:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/8/23 2:25:18 AM,
oliver.friedrich at tz-mikroelektronik.de writes:
>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.
>
data = Table[Random[], {5}];
You left off the argument's brackets.
Position[#, Max[#]]& [data]
{{4}}
Can you provide a specific example wherein this does not work?
Bob Hanlon
Chantilly, VA USA