Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: I don't know how to ....

  • Subject: [mg2440] Re: I don't know how to ....
  • From: pehowland at taz.dra.hmg.gb (Paul E Howland)
  • Date: Thu, 9 Nov 1995 04:43:39 GMT
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: LSC2 Division, Defence Research Agency
  • Sender: daemon at wri.com ( )


In article <471hgv$gb3 at ralph.vnet.net>, bientin at cli.di.unipi.it (Paolo Bientinesi) writes:

|here's my problem:
|I need  a function that takea as input a list of pairs;
|the first element of every pair is a list, the second one is an integer;
|I want the function to calculate thhe
|biggest integer and to give as output the corresponding list.

Assuming your list is like:

	data = {{{1,2,3},0}, {{4,5,6},5}, {{7,8,9},3}}

then the following will work:

	In[1]:= Part[data, Position[
			Map[#[[2]]&, data],
			Max[Map[#[[2]]&, data]]
			][[1,1]], 1]
	Out[1]= {4, 5, 6}

Hope this helps,

Paul E Howland                                  Tel. +44 (0)1684 895767
Long Range Ground Radar Sensors                 Fax. +44 (0)1684 896315
LSC2 Division                                 Email. PEHOWLAND at DRA.HMG.GB
Defence Research Agency
St Andrews Road
Malvern
Worcestershire, WR14 3PS, UK
=========================================================================


  • Prev by Date: Re: remote kernels
  • Next by Date: Curve fitting
  • Previous by thread: Re: I don't know how to ....
  • Next by thread: Re: I don't know how to ....