MathGroup Archive 2009

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

Search the Archive

Re: Maximum in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97230] Re: Maximum in a list
  • From: "Nasser Abbasi" <nma at 12000.org>
  • Date: Mon, 9 Mar 2009 01:01:41 -0500 (EST)
  • References: <gp07ul$l0o$1@smc.vnet.net>
  • Reply-to: "Nasser Abbasi" <nma at 12000.org>

> Suppose a list
>
> mylist={{1,2},{3,4},{8,3}}
>
> I would like to extract the element {i,j} of mylist for which j is max
> (here, it is the second one {3,4}).
>
> Somebody could help me, please?
>
> Pacotomi
>

mylist = {{1, 2}, {8, 3}, {3, 4}}

First[Sort[mylist, #1[[2]] > #2[[2]] & ]]

{3,4}

--Nasser 



  • Prev by Date: Re: Bug in Pattern Matching with Condition?
  • Next by Date: Re: Maximum in a list
  • Previous by thread: Re: Maximum in a list
  • Next by thread: Re: Maximum in a list