Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Maximum in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97241] Re: [mg97209] Maximum in a list
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 9 Mar 2009 01:03:42 -0500 (EST)
  • References: <22062341.1236509722675.JavaMail.root@m02>

One might wish that Max had a MaxTest option. Since it doesn't one could do
something like the following:

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

maxelement = First[mylist];
Scan[If[Part[#, 2] > Part[maxelement, 2], maxelement = #] &, mylist];
maxelement

{3, 4}


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  




From: pacotomi [mailto:pacotomi at orange.fr] 


Hi,
 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



 




  • Prev by Date: Re: Careless use of Scaled leads to hard crash in V7
  • Next by Date: Notebook that auto-executes when opened?
  • Previous by thread: Re: Maximum in a list
  • Next by thread: Re: Maximum in a list